mirror of
https://gitlab.xiph.org/xiph/icecast-server.git
synced 2025-02-02 15:07:36 -05:00
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
This commit is contained in:
parent
fb088de568
commit
1c550b0c8e
@ -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);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user