@data-fair/lib-common-types 1.5.2 → 1.5.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/session/index.js +2 -1
package/package.json
CHANGED
package/session/index.js
CHANGED
|
@@ -22,8 +22,9 @@ function matchAccount (userAccount, resourceAccount, acceptDepAsRoot = false) {
|
|
|
22
22
|
export function getAccountRole (sessionState, account, options = {}) {
|
|
23
23
|
if (!isAuthenticated(sessionState)) { return null }
|
|
24
24
|
if (sessionState.user.adminMode) { return 'admin' }
|
|
25
|
+
// user is always admin of themself even if currently switched in an orga
|
|
26
|
+
if (account.type === 'user' && sessionState.user.id === account.id) { return 'admin' }
|
|
25
27
|
if (options.allAccounts) {
|
|
26
|
-
if (account.type === 'user' && sessionState.user.id === account.id) { return 'admin' }
|
|
27
28
|
for (const org of sessionState.user.organizations) {
|
|
28
29
|
if (matchAccount({ type: 'organization', id: org.id, department: org.department }, account, options.acceptDepAsRoot)) { return org.role }
|
|
29
30
|
}
|