Skip to content
Snippets Groups Projects
Commit 374c850d authored by Henrik tom Wörden's avatar Henrik tom Wörden
Browse files

Merge branch 'f-user-management-button' into 'dev'

F user management button

See merge request !99
parents 214b82bf 952d511d
No related branches found
No related tags found
2 merge requests!103Quick main-release of documentation,!99F user management button
Pipeline #35524 passed
...@@ -17,6 +17,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ...@@ -17,6 +17,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
* `form_elements.make_form_modal` and * `form_elements.make_form_modal` and
`form_elements.make_scripting_submission_button` functions to create a form `form_elements.make_scripting_submission_button` functions to create a form
modal and an SSS submission button, respectively. modal and an SSS submission button, respectively.
* `BUILD_MODULE_EXT_ENTITY_ACL_USER_MANAGEMENT_BUTTON` build variable with which
a button to the user management is added to the navbar for users with role
administration if `BUILD_MODULE_EXT_ENTITY_ACL=ENABLED`.
### Changed (for changes in existing functionality) ### Changed (for changes in existing functionality)
......
...@@ -32,10 +32,15 @@ ...@@ -32,10 +32,15 @@
* *
* BUILD_MODULE_EXT_ENTITY_ACL_URI_ROOT=[scheme://host:port]/what/evs * BUILD_MODULE_EXT_ENTITY_ACL_URI_ROOT=[scheme://host:port]/what/evs
* *
* Enable/disable the creation of a user-management link that is shown to
* administrators with
*
* BUILD_MODULE_EXT_ENTITY_ACL_USER_MANAGEMENT_BUTTON=ENABLED
*
* *
* @author Timm Fitschen * @author Timm Fitschen
*/ */
var ext_entity_acl = function ($, connection, getEntityVersion, getEntityID, logger) { var ext_entity_acl = function ($, connection, getEntityVersion, getEntityID, logger, navbar, userIsAdministrator) {
const BUILD_MODULE_EXT_ENTITY_ACL_URI_ROOT = connection.getBasePath() + "webinterface/acm/entityacl/"; const BUILD_MODULE_EXT_ENTITY_ACL_URI_ROOT = connection.getBasePath() + "webinterface/acm/entityacl/";
const _buttons_list_class = "caosdb-v-entity-header-buttons-list"; const _buttons_list_class = "caosdb-v-entity-header-buttons-list";
...@@ -69,6 +74,14 @@ var ext_entity_acl = function ($, connection, getEntityVersion, getEntityID, log ...@@ -69,6 +74,14 @@ var ext_entity_acl = function ($, connection, getEntityVersion, getEntityID, log
$(entity).find(`.${_buttons_list_class} .${_entity_acl_link_class}`).remove(); $(entity).find(`.${_buttons_list_class} .${_entity_acl_link_class}`).remove();
} }
var showUserManagementLink = function () {
if (userIsAdministrator()) {
navbar.add_button($('<a class="nav-link" href="/webinterface/acm/">User Administration</a>')[0], {
title: "Go to user administration"
});
}
}
var _init = function () { var _init = function () {
for (let entity of $(".caosdb-entity-panel")) { for (let entity of $(".caosdb-entity-panel")) {
remove_entity_acl_link(entity); remove_entity_acl_link(entity);
...@@ -82,6 +95,10 @@ var ext_entity_acl = function ($, connection, getEntityVersion, getEntityID, log ...@@ -82,6 +95,10 @@ var ext_entity_acl = function ($, connection, getEntityVersion, getEntityID, log
* Removes all respective buttons if present before adding a new one. * Removes all respective buttons if present before adding a new one.
*/ */
var init = function () { var init = function () {
if ("${BUILD_MODULE_EXT_ENTITY_ACL_USER_MANAGEMENT_BUTTON}" == "ENABLED") {
showUserManagementLink();
}
_init(); _init();
// edit-mode-listener // edit-mode-listener
...@@ -95,7 +112,7 @@ var ext_entity_acl = function ($, connection, getEntityVersion, getEntityID, log ...@@ -95,7 +112,7 @@ var ext_entity_acl = function ($, connection, getEntityVersion, getEntityID, log
init: init init: init
}; };
}($, connection, getEntityVersion, getEntityID, log.getLogger("ext_entity_acl")); }($, connection, getEntityVersion, getEntityID, log.getLogger("ext_entity_acl"), navbar, userIsAdministrator);
$(document).ready(function () { $(document).ready(function () {
if ("${BUILD_MODULE_EXT_ENTITY_ACL}" == "ENABLED") { if ("${BUILD_MODULE_EXT_ENTITY_ACL}" == "ENABLED") {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment