Skip to content

Commit b5f96ee

Browse files
committed
Use the original property instead of depending on OC for isAdmin
Signed-off-by: Louis Chemineau <louis@chmn.me>
1 parent 455259a commit b5f96ee

File tree

1 file changed

+1
-7
lines changed

1 file changed

+1
-7
lines changed

lib/user.ts

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,3 @@
1-
/// <reference types="@nextcloud/typings" />
2-
3-
declare var OC: Nextcloud.v23.OC
4-
| Nextcloud.v24.OC
5-
| Nextcloud.v25.OC;
6-
71
const getAttribute = (el: HTMLHeadElement | undefined, attribute: string): string | null => {
82
if (el) {
93
return el.getAttribute(attribute)
@@ -40,7 +34,7 @@ export function getCurrentUser(): NextcloudUser | null {
4034
currentUser = {
4135
uid,
4236
displayName: getAttribute(head, 'data-user-displayname'),
43-
isAdmin: (typeof OC === 'undefined') ? false : OC.isUserAdmin(),
37+
isAdmin: !!(window as any)._oc_isadmin,
4438
} as NextcloudUser
4539

4640
return currentUser

0 commit comments

Comments
 (0)