return assigned permissions from /i endpoint (resolves #657)
This commit is contained in:
parent
8955d05962
commit
7a6ac302f5
4 changed files with 36 additions and 3 deletions
|
|
@ -379,6 +379,7 @@ export class ApiCallService implements OnApplicationShutdown {
|
|||
}
|
||||
|
||||
if ((ep.meta.requireModerator || ep.meta.requireAdmin) && (this.meta.rootUserId !== user?.id)) {
|
||||
// Sync with UserEntityService
|
||||
const myRoles = user ? await this.roleService.getUserRoles(user) : [];
|
||||
const isAdmin = myRoles.some(r => r.isAdministrator) && (token?.rank == null || token.rank === 'admin');
|
||||
const isModerator = myRoles.some(r => r.isAdministrator || r.isModerator) && (token?.rank == null || token.rank === 'admin' || token.rank === 'mod');
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue