Skip to content
Snippets Groups Projects
Commit 30444e5f authored by syuilo's avatar syuilo
Browse files

#2359 など

parent f0d818de
No related branches found
No related tags found
No related merge requests found
......@@ -118,6 +118,7 @@ export interface IRemoteUser extends IUserBase {
publicKeyPem: string;
};
updatedAt: Date;
isAdmin: false;
}
export type IUser = ILocalUser | IRemoteUser;
......
......@@ -21,7 +21,7 @@ export default (endpoint: string, user: IUser, app: IApp, data: any, file?: any)
return rej('YOUR_ACCOUNT_HAS_BEEN_SUSPENDED');
}
if (ep.meta.requireAdmin && !(isLocalUser(user) && user.isAdmin)) {
if (ep.meta.requireAdmin && !user.isAdmin) {
return rej('YOU_ARE_NOT_ADMIN');
}
......
......@@ -34,6 +34,10 @@ export default (params: any) => new Promise(async (res, rej) => {
return rej('user not found');
}
if (user.isAdmin) {
return rej('cannot suspend admin');
}
await User.findOneAndUpdate({
_id: user._id
}, {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment