Commit 04d3d9d1 authored by Jörg Richter's avatar Jörg Richter

Global: add dm5.isAdmin()

... returns a promise for a true/false value

See dmx-platform/dmx-platform#242
parent 3113172e
Pipeline #10340 passed with stage
in 1 second
......@@ -6,7 +6,9 @@ import typeCache from './type-cache'
import permCache from './permission-cache'
import utils from './utils'
console.log('[DMX] Client Library 2020/06/20')
console.log('[DMX] Client Library 2020/06/29')
let adminWorkspaceId // promise
export default {
......@@ -19,6 +21,16 @@ export default {
init (config) {
config.onHttpError && restClient.setErrorHandler(config.onHttpError)
adminWorkspaceId = restClient.getAdminWorkspaceId()
return typeCache.init(config.store)
},
/**
* @return a promise for a true/false value
*/
isAdmin () {
return adminWorkspaceId
.then(id => permCache.isWritable(id))
// .then(isAdmin => console.log('isAdmin', isAdmin))
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment