Переглянути джерело

refactor: Update isAdmin usage

Owen Diffey 2 тижнів тому
батько
коміт
fc5fc60776

+ 3 - 1
backend/src/modules/DataModule/models/User/events/UserCreatedEvent.ts

@@ -6,5 +6,7 @@ import User from "../../User";
 export default abstract class UserCreatedEvent extends ModelCreatedEvent {
 	protected static _model = User;
 
-	protected static _hasModelPermission = [isAdmin, isSelf];
+	protected static _hasPermission = isAdmin;
+
+	protected static _hasModelPermission = isSelf;
 }

+ 3 - 1
backend/src/modules/DataModule/models/User/events/UserDeletedEvent.ts

@@ -6,5 +6,7 @@ import User from "../../User";
 export default abstract class UserDeletedEvent extends ModelDeletedEvent {
 	protected static _model = User;
 
-	protected static _hasModelPermission = [isAdmin, isSelf];
+	protected static _hasPermission = isAdmin;
+
+	protected static _hasModelPermission = isSelf;
 }

+ 3 - 1
backend/src/modules/DataModule/models/User/events/UserUpdatedEvent.ts

@@ -6,5 +6,7 @@ import User from "../../User";
 export default abstract class UserUpdatedEvent extends ModelUpdatedEvent {
 	protected static _model = User;
 
-	protected static _hasModelPermission = [isAdmin, isSelf];
+	protected static _hasPermission = isAdmin;
+
+	protected static _hasModelPermission = isSelf;
 }

+ 3 - 1
backend/src/modules/DataModule/models/User/jobs/FindById.ts

@@ -6,5 +6,7 @@ import isSelf from "@/modules/DataModule/permissions/modelPermissions/isSelf";
 export default class FindById extends FindByIdJob {
 	protected static _model = User;
 
-	protected static _hasModelPermission = [isAdmin, isSelf];
+	protected static _hasPermission = isAdmin;
+
+	protected static _hasModelPermission = isSelf;
 }

+ 3 - 1
backend/src/modules/DataModule/models/User/jobs/UpdateById.ts

@@ -9,7 +9,9 @@ import isSelf from "@/modules/DataModule/permissions/modelPermissions/isSelf";
 export default class UpdateById extends UpdateByIdJob {
 	protected static _model = User;
 
-	protected static _hasModelPermission = [isAdmin, isSelf];
+	protected static _hasPermission = isAdmin;
+
+	protected static _hasModelPermission = isSelf;
 
 	protected static _payloadSchema = Joi.object({
 		_id: Joi.string()