Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Coscine
backend
apis
Project
Commits
1a81318c
Commit
1a81318c
authored
Jun 28, 2021
by
Petar Hristov
💬
Browse files
Merge branch 'Hotfix/1615-membersCreatingProject' into 'master'
Hotfix/1615 members creating project See merge request
!156
parents
f15224d7
7a8857e6
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
src/Project/Controllers/ProjectController.cs
View file @
1a81318c
...
...
@@ -193,7 +193,7 @@ namespace Coscine.Api.Project.Controllers
return
NotFound
(
$"Could not find project with id:
{
projectId
}
"
);
}
if
(!
_projectModel
.
HasAccess
(
user
,
project
,
UserRoles
.
Owner
))
if
(!
_projectModel
.
HasAccess
(
user
,
project
,
UserRoles
.
Member
,
UserRoles
.
Owner
))
{
return
Unauthorized
(
"The user is not authorized to perform a get on the selected project!"
);
}
...
...
@@ -552,7 +552,7 @@ namespace Coscine.Api.Project.Controllers
var
projectObject
=
ObjectFactory
<
ProjectObject
>.
DeserializeFromStream
(
Request
.
Body
);
if
(
projectObject
?.
ParentId
!=
new
Guid
()
&&
!
_projectModel
.
HasAccess
(
user
,
_projectModel
.
GetById
(
projectObject
.
ParentId
),
UserRoles
.
Owner
))
&&
!
_projectModel
.
HasAccess
(
user
,
_projectModel
.
GetById
(
projectObject
.
ParentId
),
UserRoles
.
Member
,
UserRoles
.
Owner
))
{
return
Unauthorized
(
"User is not allowed to create SubProjects."
);
}
...
...
@@ -560,8 +560,8 @@ namespace Coscine.Api.Project.Controllers
var
project
=
_projectModel
.
StoreFromObject
(
projectObject
,
user
,
_rdfStoreConnector
.
GetQuotaDefault
(
user
.
Id
.
ToString
()));
if
(
projectObject
.
ParentId
!=
new
Guid
()
//
for now, only an own
er can add subprojects to projects
&&
_projectModel
.
HasAccess
(
user
,
_projectModel
.
GetById
(
projectObject
.
ParentId
),
UserRoles
.
Owner
))
//
Both an owner and a memb
er can add subprojects to projects
&&
_projectModel
.
HasAccess
(
user
,
_projectModel
.
GetById
(
projectObject
.
ParentId
),
UserRoles
.
Member
,
UserRoles
.
Owner
))
{
var
subProjectModel
=
new
SubProjectModel
();
subProjectModel
.
LinkSubProject
(
projectObject
.
ParentId
,
project
.
Id
);
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment