mirror of
https://github.com/IT4Change/gradido.git
synced 2026-02-06 09:56:05 +00:00
rework PR-comment
This commit is contained in:
parent
e018234591
commit
d4bfaaa52c
@ -77,26 +77,20 @@ export class User {
|
|||||||
|
|
||||||
@Field(() => [String], { nullable: true })
|
@Field(() => [String], { nullable: true })
|
||||||
roles: string[] | null
|
roles: string[] | null
|
||||||
}
|
|
||||||
|
|
||||||
export function isAdmin(user: User): boolean {
|
@Field(() => Boolean)
|
||||||
if (user.roles) {
|
isAdmin(): boolean {
|
||||||
for (const role of user.roles) {
|
if (this.roles) {
|
||||||
if (role === ROLE_NAMES.ROLE_NAME_ADMIN) {
|
return this.roles.includes(ROLE_NAMES.ROLE_NAME_ADMIN)
|
||||||
return true
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
return false
|
||||||
}
|
}
|
||||||
return false
|
|
||||||
}
|
|
||||||
|
|
||||||
export function isModerator(user: User): boolean {
|
@Field(() => Boolean)
|
||||||
if (user.roles) {
|
isModerator(): boolean {
|
||||||
for (const role of user.roles) {
|
if (this.roles) {
|
||||||
if (role === ROLE_NAMES.ROLE_NAME_MODERATOR) {
|
return this.roles.includes(ROLE_NAMES.ROLE_NAME_MODERATOR)
|
||||||
return true
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
return false
|
||||||
}
|
}
|
||||||
return false
|
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user