return_flitter.error(res,404,'Project not found with the specified ID.')
return_flitter.error(res,404,{reason:'Project not found with the specified ID.'})
}
if(!req.body||!req.body.name){
return_flitter.view(res,'dash_v1:project',{show_back:true,title:'Update Project',project_name:project.name,errors:['Project name is required.']})
return_flitter.view(res,'dash_v1:project',{user:req.session.auth.user,show_back:true,title:'Update Project',project_name:project.name,errors:['Project name is required.']})
}
// check access perms
if(!(project.user_id===req.session.auth.uuid)){
return_flitter.error(res,401,{reason:'Project not found with the specified ID.'})
}
project.name=req.body.name
@ -54,7 +74,7 @@ class v1 {
asyncnew_project_do(req,res,next){
if(!req.body.name){
return_flitter.view(res,'dash_v1:project',{show_back:true,title:'Create Project',errors:['Project name is required.']})
return_flitter.view(res,'dash_v1:project',{user:req.session.auth.user,show_back:true,title:'Create Project',errors:['Project name is required.']})
}
constproject=newProject({
@ -76,31 +96,78 @@ class v1 {
constproject=awaitProject.findById(req.params.id)
if(!project){
_flitter.error(res,404,'Project not found.')
return_flitter.error(res,404,{reason:'Project not found with the specified ID.'})
return_flitter.view(res,'dash_v1:confirm',{show_back:true,title:'Are you sure?',text:'Deleting this project will remove all stored breakpoint data. This action cannot be undone.',destination:'/dash/v1/project/delete/'+req.params.id})
asyncproject_delete_show(req,res,next){
constproject=awaitProject.findById(req.params.id)
if(!project){
return_flitter.error(res,404,{reason:'Project not found with the specified ID.'})
}
if(!(project.user_id===req.session.auth.uuid)){
return_flitter.error(res,401,{reason:'You do not have permission to edit this project.'})
}
return_flitter.view(res,'dash_v1:confirm',{user:req.session.auth.user,project,show_back:true,title:'Are you sure?',text:'Deleting this project will remove all stored breakpoint data. This action cannot be undone.',destination:'/dash/v1/project/delete/'+req.params.id})
if(!target_user)return_flitter.error(res,404,{reason:'User not found with the specified ID.'})
if(!(project.user_id===req.session.auth.uuid||project.shared_user_ids.includes(req.session.auth.uuid)))return_flitter.error(res,401,{reason:"You do not have permission to edit this project."})