mirror of
https://gitlab.xiph.org/xiph/icecast-server.git
synced 2025-06-30 22:18:19 -04: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);
|
xmlFree (authenticator->type);
|
||||||
if (authenticator->role)
|
if (authenticator->role)
|
||||||
xmlFree (authenticator->role);
|
xmlFree (authenticator->role);
|
||||||
|
if (authenticator->management_url)
|
||||||
|
xmlFree (authenticator->management_url);
|
||||||
thread_mutex_unlock(&authenticator->lock);
|
thread_mutex_unlock(&authenticator->lock);
|
||||||
thread_mutex_destroy(&authenticator->lock);
|
thread_mutex_destroy(&authenticator->lock);
|
||||||
if (authenticator->mount)
|
if (authenticator->mount)
|
||||||
@ -440,6 +442,7 @@ auth_t *auth_get_authenticator(xmlNodePtr node)
|
|||||||
auth->id = _next_auth_id();
|
auth->id = _next_auth_id();
|
||||||
auth->type = (char*)xmlGetProp(node, XMLSTR("type"));
|
auth->type = (char*)xmlGetProp(node, XMLSTR("type"));
|
||||||
auth->role = (char*)xmlGetProp(node, XMLSTR("name"));
|
auth->role = (char*)xmlGetProp(node, XMLSTR("name"));
|
||||||
|
auth->management_url = (char*)xmlGetProp(node, XMLSTR("management-url"));
|
||||||
|
|
||||||
if (!auth->type) {
|
if (!auth->type) {
|
||||||
auth_release(auth);
|
auth_release(auth);
|
||||||
@ -538,6 +541,12 @@ auth_t *auth_get_authenticator(xmlNodePtr node)
|
|||||||
free (opt);
|
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;
|
return auth;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -71,6 +71,9 @@ typedef struct auth_tag
|
|||||||
/* unique ID */
|
/* unique ID */
|
||||||
unsigned long id;
|
unsigned long id;
|
||||||
|
|
||||||
|
/* URL for any kind of UI used to configure this or NULL. */
|
||||||
|
char *management_url;
|
||||||
|
|
||||||
char *mount;
|
char *mount;
|
||||||
|
|
||||||
/* filters */
|
/* filters */
|
||||||
|
@ -880,6 +880,8 @@ static xmlNodePtr _dump_stats_to_doc (xmlNodePtr root, const char *show_mount, i
|
|||||||
xmlSetProp(role, XMLSTR("id"), XMLSTR(idbuf));
|
xmlSetProp(role, XMLSTR("id"), XMLSTR(idbuf));
|
||||||
if (auth->role)
|
if (auth->role)
|
||||||
xmlSetProp(role, XMLSTR("name"), XMLSTR(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_release(auth);
|
||||||
auth_stack_next(&stack);
|
auth_stack_next(&stack);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user