Skip to content

Commit d84172e

Browse files
committed
fix: permissions to update/delete invites 2
1 parent 403ad0d commit d84172e

File tree

2 files changed

+5
-10
lines changed

2 files changed

+5
-10
lines changed

src/routes/projectMemberInvites/delete.js

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -42,17 +42,13 @@ module.exports = [
4242
&& !util.hasPermission(PERMISSION.DELETE_REQUESTED_INVITE, req.authUser, req.context.currentProjectMembers)
4343
) {
4444
error = 'You don\'t have permissions to cancel requested invites.';
45-
}
46-
47-
if (
45+
} else if (
4846
invite.role !== PROJECT_MEMBER_ROLE.CUSTOMER
4947
&& !ownInvite
5048
&& !util.hasPermission(PERMISSION.DELETE_NON_CUSTOMER_INVITE, req.authUser, req.context.currentProjectMembers)
5149
) {
5250
error = 'You don\'t have permissions to cancel invites to Topcoder Team for other users.';
53-
}
54-
55-
if (
51+
} else if (
5652
invite.role === PROJECT_MEMBER_ROLE.CUSTOMER
5753
&& !ownInvite
5854
&& !util.hasPermission(PERMISSION.DELETE_CUSTOMER_INVITE, req.authUser, req.context.currentProjectMembers)

src/routes/projectMemberInvites/update.js

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -62,10 +62,9 @@ module.exports = [
6262
&& !util.hasPermission(PERMISSION.UPDATE_REQUESTED_INVITE, req.authUser, req.context.currentProjectMembers)
6363
) {
6464
error = 'You don\'t have permissions to update requested invites.';
65-
}
66-
67-
if (
68-
!ownInvite
65+
} else if (
66+
invite.status !== INVITE_STATUS.REQUESTED
67+
&& !ownInvite
6968
&& !util.hasPermission(PERMISSION.UPDATE_NOT_OWN_INVITE, req.authUser, req.context.currentProjectMembers)
7069
) {
7170
error = 'You don\'t have permissions to update invites for other users.';

0 commit comments

Comments
 (0)