Skip to content

Commit

Permalink
Use the original property instead of depending on OC for isAdmin
Browse files Browse the repository at this point in the history
Signed-off-by: Louis Chemineau <louis@chmn.me>
  • Loading branch information
artonge committed Sep 20, 2023
1 parent 455259a commit b5f96ee
Showing 1 changed file with 1 addition and 7 deletions.
8 changes: 1 addition & 7 deletions lib/user.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,3 @@
/// <reference types="@nextcloud/typings" />

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)
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit b5f96ee

Please sign in to comment.