Skip to content

Commit

Permalink
core: return correct acls for admins
Browse files Browse the repository at this point in the history
  • Loading branch information
koush committed Apr 3, 2023
1 parent df09d8e commit ed1ceed
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 3 deletions.
4 changes: 2 additions & 2 deletions plugins/core/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion plugins/core/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@scrypted/core",
"version": "0.1.107",
"version": "0.1.108",
"description": "Scrypted Core plugin. Provides the UI, websocket, and engine.io APIs.",
"author": "Scrypted",
"license": "Apache-2.0",
Expand Down
9 changes: 9 additions & 0 deletions plugins/core/src/user.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,15 @@ export class User extends ScryptedDeviceBase implements Settings, ScryptedUser {
})

async getScryptedUserAccessControl(): Promise<ScryptedUserAccessControl> {
const usersService = await sdk.systemManager.getComponent('users');
const users: DBUser[] = await usersService.getAllUsers();
const user = users.find(user => user.username === this.username);
if (!user)
throw new Error("user not found");

if (user.admin)
return;

const self = sdk.deviceManager.getDeviceState(this.nativeId);

const ret: ScryptedUserAccessControl = {
Expand Down

0 comments on commit ed1ceed

Please sign in to comment.