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
96be7d0c
Commit
96be7d0c
authored
Jul 01, 2021
by
Benedikt Heinrichs
Browse files
Merge branch 'Topic/1531-UseMangmntTableView' into 'Product/1548-projectInviteMngmnt'
Update: Improve invitation handling See merge request
!152
parents
302af7a0
9b86d483
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
src/Project/Controllers/ProjectController.cs
View file @
96be7d0c
...
...
@@ -600,7 +600,7 @@ namespace Coscine.Api.Project.Controllers
return
Unauthorized
(
$"You are not an owner of the project."
);
}
var
invitations
=
_invitationModel
.
GetAllWhere
(
x
=>
x
.
Project
==
projectId
&&
x
.
Expiration
>
DateTime
.
UtcNow
)
var
invitations
=
_invitationModel
.
GetAllWhere
(
x
=>
x
.
Project
==
projectId
)
.
Select
(
x
=>
new
InvitationReturnObject
{
Id
=
x
.
Id
,
...
...
@@ -652,11 +652,22 @@ namespace Coscine.Api.Project.Controllers
x
.
Expiration
>
DateTime
.
UtcNow
);
if
(
invitations
!=
null
&&
invitations
.
Any
())
if
(
invitations
.
Any
())
{
return
BadRequest
(
"This invitee already has a valid invitation to this project."
);
}
var
expiredInvitations
=
_invitationModel
.
GetAllWhere
(
x
=>
x
.
Project
==
sendInvitationObject
.
Project
&&
x
.
InviteeEmail
==
sendInvitationObject
.
Email
&&
x
.
Expiration
<=
DateTime
.
UtcNow
);
foreach
(
var
expiredInvitation
in
expiredInvitations
)
{
_invitationModel
.
Delete
(
expiredInvitation
);
}
var
token
=
_invitationModel
.
CreateInvitation
(
sendInvitationObject
.
Project
,
user
.
Id
,
sendInvitationObject
.
Role
,
sendInvitationObject
.
Email
);
var
body
=
new
JObject
...
...
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