Commit 1c550b0c authored by Philipp Schafft's avatar Philipp Schafft 🦁

Feature: Added support for management-url="" in <role>

This adds setting a URL for manegement of roles to the framework.
If no URl is given in the config file this defaults to internal
(/admin/manageauth.xsl) interface if supported by the backend.
See #2123
parent fb088de5
......@@ -165,6 +165,8 @@ void auth_release (auth_t *authenticator) {
xmlFree (authenticator->type);
if (authenticator->role)
xmlFree (authenticator->role);
if (authenticator->management_url)
xmlFree (authenticator->management_url);
thread_mutex_unlock(&authenticator->lock);
thread_mutex_destroy(&authenticator->lock);
if (authenticator->mount)
......@@ -440,6 +442,7 @@ auth_t *auth_get_authenticator(xmlNodePtr node)
auth->id = _next_auth_id();
auth->type = (char*)xmlGetProp(node, XMLSTR("type"));
auth->role = (char*)xmlGetProp(node, XMLSTR("name"));
auth->management_url = (char*)xmlGetProp(node, XMLSTR("management-url"));
if (!auth->type) {
auth_release(auth);
......@@ -538,6 +541,12 @@ auth_t *auth_get_authenticator(xmlNodePtr node)
free (opt);
}
if (!auth->management_url && (auth->adduser || auth->deleteuser || auth->listuser)) {
char url[128];
snprintf(url, sizeof(url), "/admin/manageauth.xsl?id=%lu", auth->id);
auth->management_url = (char*)xmlCharStrdup(url);
}
return auth;
}
......
......@@ -71,6 +71,9 @@ typedef struct auth_tag
/* unique ID */
unsigned long id;
/* URL for any kind of UI used to configure this or NULL. */
char *management_url;
char *mount;
/* filters */
......
......@@ -880,6 +880,8 @@ static xmlNodePtr _dump_stats_to_doc (xmlNodePtr root, const char *show_mount, i
xmlSetProp(role, XMLSTR("id"), XMLSTR(idbuf));
if (auth->role)
xmlSetProp(role, XMLSTR("name"), XMLSTR(auth->role));
if (auth->management_url)
xmlSetProp(role, XMLSTR("management-url"), XMLSTR(auth->management_url));
auth_release(auth);
auth_stack_next(&stack);
}
......
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