Fixing merge artifact
This commit is contained in:
parent
6a25804b23
commit
f94d8ba870
|
@ -238,8 +238,8 @@ export function builtinRoleToNumber(id: string) {
|
||||||
const builtins = getBuiltinRoles()
|
const builtins = getBuiltinRoles()
|
||||||
const MAX = Object.values(builtins).length + 1
|
const MAX = Object.values(builtins).length + 1
|
||||||
if (
|
if (
|
||||||
compareRoleIds(id, BUILTIN_IDS.ADMIN) ||
|
roleIDsAreEqual(id, BUILTIN_IDS.ADMIN) ||
|
||||||
compareRoleIds(id, BUILTIN_IDS.BUILDER)
|
roleIDsAreEqual(id, BUILTIN_IDS.BUILDER)
|
||||||
) {
|
) {
|
||||||
return MAX
|
return MAX
|
||||||
}
|
}
|
||||||
|
@ -278,7 +278,7 @@ export async function roleToNumber(id: string) {
|
||||||
const highestBuiltin: number | undefined = role.inherits
|
const highestBuiltin: number | undefined = role.inherits
|
||||||
.map(roleId => {
|
.map(roleId => {
|
||||||
const foundRole = hierarchy.find(role =>
|
const foundRole = hierarchy.find(role =>
|
||||||
compareRoleIds(role._id!, roleId)
|
roleIDsAreEqual(role._id!, roleId)
|
||||||
)
|
)
|
||||||
if (foundRole) {
|
if (foundRole) {
|
||||||
return findNumber(foundRole) + 1
|
return findNumber(foundRole) + 1
|
||||||
|
@ -403,7 +403,7 @@ async function getAllUserRoles(
|
||||||
): Promise<RoleDoc[]> {
|
): Promise<RoleDoc[]> {
|
||||||
const allRoles = await getAllRoles()
|
const allRoles = await getAllRoles()
|
||||||
// admins have access to all roles
|
// admins have access to all roles
|
||||||
if (compareRoleIds(userRoleId, BUILTIN_IDS.ADMIN)) {
|
if (roleIDsAreEqual(userRoleId, BUILTIN_IDS.ADMIN)) {
|
||||||
return allRoles
|
return allRoles
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -515,7 +515,7 @@ export async function getAllRoles(appId?: string): Promise<RoleDoc[]> {
|
||||||
for (let builtinRoleId of externalBuiltinRoles) {
|
for (let builtinRoleId of externalBuiltinRoles) {
|
||||||
const builtinRole = builtinRoles[builtinRoleId]
|
const builtinRole = builtinRoles[builtinRoleId]
|
||||||
const dbBuiltin = roles.filter(dbRole =>
|
const dbBuiltin = roles.filter(dbRole =>
|
||||||
compareRoleIds(dbRole._id!, builtinRoleId)
|
roleIDsAreEqual(dbRole._id!, builtinRoleId)
|
||||||
)[0]
|
)[0]
|
||||||
if (dbBuiltin == null) {
|
if (dbBuiltin == null) {
|
||||||
roles.push(builtinRole || builtinRoles.BASIC)
|
roles.push(builtinRole || builtinRoles.BASIC)
|
||||||
|
@ -574,9 +574,9 @@ export class AccessController {
|
||||||
if (
|
if (
|
||||||
tryingRoleId == null ||
|
tryingRoleId == null ||
|
||||||
tryingRoleId === "" ||
|
tryingRoleId === "" ||
|
||||||
compareRoleIds(tryingRoleId, BUILTIN_IDS.BUILDER) ||
|
roleIDsAreEqual(tryingRoleId, BUILTIN_IDS.BUILDER) ||
|
||||||
compareRoleIds(userRoleId!, tryingRoleId) ||
|
roleIDsAreEqual(userRoleId!, tryingRoleId) ||
|
||||||
compareRoleIds(userRoleId!, BUILTIN_IDS.BUILDER)
|
roleIDsAreEqual(userRoleId!, BUILTIN_IDS.BUILDER)
|
||||||
) {
|
) {
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue