Browse Source

refactor(EditUser): Prevent moderators from changing user emails

Owen Diffey 2 years ago
parent
commit
f0ce8f2f32
2 changed files with 5 additions and 2 deletions
  1. 1 1
      backend/logic/actions/users.js
  2. 4 1
      frontend/src/components/modals/EditUser.vue

+ 1 - 1
backend/logic/actions/users.js

@@ -2083,7 +2083,7 @@ export default {
 			[
 				next => {
 					if (updatingUserId === session.userId) return next();
-					return hasPermission("users.update", session)
+					return hasPermission("users.update.restricted", session)
 						.then(() => next())
 						.catch(() => next("Invalid permissions."));
 				},

+ 4 - 1
frontend/src/components/modals/EditUser.vue

@@ -210,10 +210,13 @@ onBeforeUnmount(() => {
 								type="text"
 								placeholder="Email Address"
 								autofocus
+								:disabled="
+									!hasPermission('users.update.restricted')
+								"
 							/>
 						</span>
 						<span
-							v-if="hasPermission('users.update')"
+							v-if="hasPermission('users.update.restricted')"
 							class="control"
 						>
 							<a class="button is-info" @click="updateEmail()"