Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions src/backend/src/modules/apps/ProtectedAppService.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,18 +59,20 @@ class ProtectedAppService extends BaseService {
// Owner of procted app has implicit permission to access it
svc_permission.register_implicator(PermissionImplicator.create({
matcher: permission => {
return permission.startsWith('app:');
return permission.startsWith('app:') || permission.startsWith('manage:app');
},
checker: async ({ actor, permission }) => {
if ( ! (actor.type instanceof UserActorType) ) {
return undefined;
}

const parts = PermissionUtil.split(permission);
if ( parts.length !== 3 ) return undefined;

const [_, uid_part, lvl] = parts;
if ( lvl !== 'access' ) return undefined;
if ( parts[0] === 'manage' ) parts.shift();

if ( parts.length < 2 ) return undefined;

const [_, uid_part] = parts;

// track: slice a prefix
const uid = uid_part.slice('uid#'.length);
Expand Down
4 changes: 1 addition & 3 deletions src/backend/src/services/auth/PermissionService.js
Original file line number Diff line number Diff line change
Expand Up @@ -887,9 +887,7 @@ class PermissionService extends BaseService {

// DELETE permission
await this.services.get('su').sudo(() =>
this.kvService.set(PermissionUtil.join(PERM_KEY_PREFIX, user.id, permission), {
deleted: true,
}));
this.kvService.del({ key: PermissionUtil.join(PERM_KEY_PREFIX, user.id, permission) }));

}
/**
Expand Down
Loading