From b5f96ee2e5067d877b01ad1a91941d71ba871afa Mon Sep 17 00:00:00 2001 From: Louis Chemineau Date: Wed, 20 Sep 2023 12:19:23 +0200 Subject: [PATCH] Use the original property instead of depending on OC for isAdmin Signed-off-by: Louis Chemineau --- lib/user.ts | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/lib/user.ts b/lib/user.ts index bea8a4e3..64f76be7 100644 --- a/lib/user.ts +++ b/lib/user.ts @@ -1,9 +1,3 @@ -/// - -declare var OC: Nextcloud.v23.OC - | Nextcloud.v24.OC - | Nextcloud.v25.OC; - const getAttribute = (el: HTMLHeadElement | undefined, attribute: string): string | null => { if (el) { return el.getAttribute(attribute) @@ -40,7 +34,7 @@ export function getCurrentUser(): NextcloudUser | null { currentUser = { uid, displayName: getAttribute(head, 'data-user-displayname'), - isAdmin: (typeof OC === 'undefined') ? false : OC.isUserAdmin(), + isAdmin: !!(window as any)._oc_isadmin, } as NextcloudUser return currentUser