soumaeda 2 лет назад
Родитель
Сommit
2fe04679b3

+ 7 - 7
apps/app/src/server/models/user.js

@@ -265,31 +265,31 @@ module.exports = function(crowi) {
     });
   };
 
-  userSchema.methods.revokeFromAdmin = async function() {
-    logger.debug('Remove from admin', this);
+  userSchema.methods.revokeAdmin = async function() {
+    logger.debug('Revove admin', this);
     this.admin = 0;
     return this.save();
   };
 
-  userSchema.methods.makeAdmin = async function() {
-    logger.debug('Admin', this);
+  userSchema.methods.grantAdmin = async function() {
+    logger.debug('Grant Admin', this);
     this.admin = 1;
     return this.save();
   };
 
   userSchema.methods.grantReadOnly = async function() {
-    logger.debug('Grant read only flag', this);
+    logger.debug('Grant read only access', this);
     this.readOnly = 1;
     return this.save();
   };
 
   userSchema.methods.revokeReadOnly = async function() {
-    logger.debug('Revoke read only flag', this);
+    logger.debug('Revoke read only access', this);
     this.readOnly = 0;
     return this.save();
   };
 
-  userSchema.methods.asyncMakeAdmin = async function(callback) {
+  userSchema.methods.asyncGrantAdmin = async function(callback) {
     this.admin = 1;
     return this.save();
   };

+ 1 - 1
apps/app/src/server/routes/apiv3/users.js

@@ -482,7 +482,7 @@ module.exports = (crowi) => {
 
     try {
       const userData = await User.findById(id);
-      await userData.makeAdmin();
+      await userData.grantAdmin();
 
       const serializedUserData = serializeUserSecurely(userData);
 

+ 1 - 1
apps/app/src/server/service/installer.ts

@@ -146,7 +146,7 @@ export class InstallerService {
         name, username, email, password,
       } = firstAdminUserToSave;
       adminUser = await User.createUser(name, username, email, password, globalLang);
-      await adminUser.asyncMakeAdmin();
+      await adminUser.asyncGrantAdmin();
     }
     catch (err) {
       throw new FailedToCreateAdminUserError(err);