Skip to content

Commit

Permalink
Merge pull request #583 from nextcloud-libraries/artonge/debt/dont_us…
Browse files Browse the repository at this point in the history
…e_oc_in_user

Use the original property instead of depending on OC for isAdmin
  • Loading branch information
skjnldsv committed Sep 20, 2023
2 parents 455259a + b5f96ee commit 7ba8f5f
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 7ba8f5f

Please sign in to comment.