33 lines
1 KiB
JavaScript
33 lines
1 KiB
JavaScript
const MszAuthAppScopeEntry = function(text, warn) {
|
|
const icon = <div class="auth-scope-perm-icon"/>;
|
|
if(warn)
|
|
icon.classList.add('auth-scope-perm-icon-warn');
|
|
|
|
const element = <div class="auth-scope-perm">
|
|
{icon}
|
|
<div class="auth-scope-perm-text">{text}</div>
|
|
</div>;
|
|
|
|
return {
|
|
get element() { return element; },
|
|
};
|
|
};
|
|
|
|
const MszAuthAppScopeList = function(scopes) {
|
|
const permsElem = <div class="auth-scope-perms"/>;
|
|
if(Array.isArray(scopes) && scopes.length > 0) {
|
|
for(const scope of scopes)
|
|
if(typeof scope === 'string')
|
|
permsElem.appendChild(new MszAuthAppScopeEntry(scope).element);
|
|
} else
|
|
permsElem.appendChild(new MszAuthAppScopeEntry('A limited amount of things. No scope was specified by the developer.', true).element);
|
|
|
|
const element = <div class="auth-scope">
|
|
<div class="auth-scope-header">This application will be able to:</div>
|
|
{permsElem}
|
|
</div>;
|
|
|
|
return {
|
|
get element() { return element; },
|
|
};
|
|
};
|