Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ALS-5332] Add Admin consoles and Fix bug with saving a user #282

Merged
merged 3 commits into from
Feb 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions biodatacatalyst-ui/src/main/webapp/picsureui/header/header.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,20 @@
<img class="logo-img" src="{{logoPath}}" tabindex="0" title="BioData Catalyst Powered by PIC-SURE">
</a>
<nav id="header-tabs" class="nav-menu" role="navigation" aria-label="Main Navigation. You are on the main navigation of Pic-sure. Please use the arrow keys to navigate through the tabs. Use Enter or space to select the tab." tabindex="0">
{{#contains privileges "SUPER_ADMIN"}}
<button id="super-admin-dropdown-toggle" class="dropdown-toggle nav-dropdown header-btn long-name" aria-expanded="false" tabindex="-1" title="Super Admin Console" aria-label="Super Admin Console Dropdown" aria-controls="super-admin-console-menu-list">
<span>Super Admin Console</span><i class="fa fa-caret-down" aria-hidden="true"></i>
</button>
<ul id="super-admin-console-menu-list" class="nav-dropdown-menu" role="menu" tabindex="-1">
<li class="dropdown"><a id="appMgmt-super-admin" class="header-navigation" data-href="/psamaui/applicationManagement" href="#">Applications</a></li>
<li class="dropdown"><a id="connMgmt-super-admin" class="header-navigation" data-href="/psamaui/connectionManagement">Connections</a></li>
<li class="dropdown"><a id="privMgmt-super-admin" class="header-navigation" data-href="/psamaui/privilegeManagement">Privileges</a></li>
<li class="dropdown"><a id="roleMgmt-super-admin" class="header-navigation" data-href="/psamaui/roleManagement">Roles</a></li>
</ul>
{{/contains}}
{{#contains privileges 'ADMIN'}}
<a class="header-btn header-navigation" id="admin-btn" data-href="/psamaui/userManagement" href="#" tabindex="-1">Users</a>
{{/contains}}
{{#contains privileges "FENCE_AUTHORIZED_ACCESS"}}
<a class="header-btn header-navigation" data-href="/picsureui/dataAccess" href="#" id="data-access-btn" tabindex="-1" title="Explore" aria-label="Explore">Data Access Dashboard</a>
<a class="header-btn authorized-access-visible header-navigation" data-href="/picsureui/queryBuilder" href="#" id="query-builder-btn" tabindex="-1" title="Authorized Access" aria-label="Authorized Access">Authorized Access</a>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
define(["underscore", "picSure/userFunctions"], function(_, userFunctions){
return {
/*
* Override save user action for BDC specific metadata
* Instead of replacing the entire user object, just update the roles
*/
saveUserAction : function(e, userDetails = {}){
e?.preventDefault();
let user = {};
if (userDetails?.model.get("selectedUser") != null && userDetails?.model.get("selectedUser")?.uuid?.trim().length > 0) {
user = userDetails.model.get("selectedUser");
}
let newRoles = [];
_.each(userDetails?.$('input:checked'), function (checkbox) {
newRoles.push({uuid: checkbox.value});
});
if (_.isEqual(newRoles, user?.roles)) {
console.log("No change to roles");
userDetails?.render();
userDetails?.closeDialog();
return;
}
user.roles = newRoles;
user.generalMetadata = JSON.stringify(user.generalMetadata); //DB expects string
userFunctions.createOrUpdateUser([user], user.uuid === null ? 'POST' : 'PUT', function(result) {
console.log(result);
userDetails?.render();
userDetails?.closeDialog();
}.bind(userDetails));
}
};
});
Loading