admin role enhancment
basic invitation flow
This commit is contained in:
1 parent
d112dbb122
commit
b1f01208fa
6 files changed
+59
-13
No files matched your search
@@ -414,14 +414,15 @@ export async function PUT(request: NextRequest) {
|
||||
return forbiddenResponse(`Not authorized to assign role '${role}'`);
|
||||
}
|
||||
|
||||
// Authorization: trainers cannot reassign users to different gyms
|
||||
// Authorization: trainers and admins cannot reassign users to different gyms
|
||||
// Only superAdmins can reassign gyms
|
||||
if (
|
||||
requesterRole === "trainer" &&
|
||||
requesterRole !== "superAdmin" &&
|
||||
gymId !== undefined &&
|
||||
gymId !== existingUser.gymId
|
||||
) {
|
||||
return forbiddenResponse(
|
||||
"Trainers cannot reassign users to different gyms",
|
||||
"Only superAdmins can reassign users to different gyms",
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user