ACL: add HTSP streaming, reshuffle fields, fixes #2518

This commit is contained in:
Jaroslav Kysela 2014-11-30 13:29:05 +01:00
parent 9778bca323
commit 8265dbd902
5 changed files with 73 additions and 56 deletions

View file

@ -56,19 +56,35 @@ The columns have the following functions:
IPv4 prefix for matching based on source IP address. IPv4 prefix for matching based on source IP address.
If set to 0.0.0.0/0 it will match everything. If set to 0.0.0.0/0 it will match everything.
<dt><b>Web interface</b>
<dd>
Required for web user interface access. Also gives access to the EPG.
<dt><b>Admin</b>
<dd>
Enables access to the Configuration tab.
<dt><b>Streaming</b> <dt><b>Streaming</b>
<dd> <dd>
Enables access to streaming functionality. This permission is enough to stream over HTSP to VLC, Showtime and similar. Enables access to streaming functionality for HTTP (web).
<dt><b>Advanced Streaming</b> <dt><b>Advanced Streaming</b>
<dd> <dd>
Enables access to advanced streaming function for HTTP - like direct Enables access to advanced streaming function for HTTP (web) - like direct
service or whole MPEG-TS stream (mux).. service or whole MPEG-TS stream (mux)..
<dt><b>HTSP Streaming</b>
<dd>
Enables access to streaming for the HTSP protocol (Showtime, XBMC etc.).
<dt><b>Streaming Profile</b> <dt><b>Streaming Profile</b>
<dd> <dd>
Specify a streaming profile to be used when this user logs in; use the (default) stream if not specified. Specify a streaming profile to be used when this user logs in; use the (default) stream if not specified.
<dt><b>Limit Connections</b>
<dd>
If set, this will limit the number of concurrent streaming connections a user is permitted to have. 0=disabled
<dt><b>Video Recorder</b> <dt><b>Video Recorder</b>
<dd> <dd>
Enables access to all video recording functions. This also include administration of the auto recordings. Enables access to all video recording functions. This also include administration of the auto recordings.
@ -79,18 +95,6 @@ The columns have the following functions:
equal to this value. equal to this value.
Note that this field is unset when the DVR Config Profile is removed. Note that this field is unset when the DVR Config Profile is removed.
<dt><b>Web interface</b>
<dd>
Required for web user interface access. Also gives access to the EPG.
<dt><b>Admin</b>
<dd>
Enables access to the Configuration tab.
<dt><b>Limit Connections</b>
<dd>
If set, this will limit the number of concurrent streaming connections a user is permitted to have. 0=disabled
<dt><b>Min Channel Num</b> <dt><b>Min Channel Num</b>
<dd> <dd>
If non-zero, this sets the lower limit of the channels accessible by a user, i.e. the user will only be able to access channels where the channel number is equal to or greater than this value. If non-zero, this sets the lower limit of the channels accessible by a user, i.e. the user will only be able to access channels where the channel number is equal to or greater than this value.

View file

@ -840,6 +840,7 @@ access_entry_create(const char *uuid, htsmsg_t *conf)
TAILQ_INIT(&ae->ae_ipmasks); TAILQ_INIT(&ae->ae_ipmasks);
if (conf) { if (conf) {
ae->ae_htsp_streaming = 1;
idnode_load(&ae->ae_id, conf); idnode_load(&ae->ae_id, conf);
/* note password has PO_NOSAVE, thus it must be set manually */ /* note password has PO_NOSAVE, thus it must be set manually */
if ((s = htsmsg_get_str(conf, "password")) != NULL) if ((s = htsmsg_get_str(conf, "password")) != NULL)
@ -1263,6 +1264,12 @@ const idclass_t access_entry_class = {
.name = "Advanced Streaming", .name = "Advanced Streaming",
.off = offsetof(access_entry_t, ae_adv_streaming), .off = offsetof(access_entry_t, ae_adv_streaming),
}, },
{
.type = PT_BOOL,
.id = "htsp_streaming",
.name = "HTSP Streaming",
.off = offsetof(access_entry_t, ae_htsp_streaming),
},
{ {
.type = PT_STR, .type = PT_STR,
.id = "profile", .id = "profile",
@ -1379,12 +1386,13 @@ access_init(int createdefault, int noacl)
free(ae->ae_comment); free(ae->ae_comment);
ae->ae_comment = strdup("Default access entry"); ae->ae_comment = strdup("Default access entry");
ae->ae_enabled = 1; ae->ae_enabled = 1;
ae->ae_streaming = 1; ae->ae_streaming = 1;
ae->ae_adv_streaming = 1; ae->ae_adv_streaming = 1;
ae->ae_dvr = 1; ae->ae_htsp_streaming = 1;
ae->ae_webui = 1; ae->ae_dvr = 1;
ae->ae_admin = 1; ae->ae_webui = 1;
ae->ae_admin = 1;
access_entry_update_rights(ae); access_entry_update_rights(ae);
TAILQ_INIT(&ae->ae_ipmasks); TAILQ_INIT(&ae->ae_ipmasks);

View file

@ -57,6 +57,7 @@ typedef struct access_entry {
int ae_streaming; int ae_streaming;
int ae_adv_streaming; int ae_adv_streaming;
int ae_htsp_streaming;
struct profile *ae_profile; struct profile *ae_profile;
LIST_ENTRY(access_entry) ae_profile_link; LIST_ENTRY(access_entry) ae_profile_link;
@ -113,13 +114,15 @@ typedef struct access_ticket {
#define ACCESS_ANONYMOUS 0 #define ACCESS_ANONYMOUS 0
#define ACCESS_STREAMING (1<<0) #define ACCESS_STREAMING (1<<0)
#define ACCESS_ADVANCED_STREAMING (1<<1) #define ACCESS_ADVANCED_STREAMING (1<<1)
#define ACCESS_WEB_INTERFACE (1<<2) #define ACCESS_HTSP_STREAMING (1<<2)
#define ACCESS_RECORDER (1<<3) #define ACCESS_WEB_INTERFACE (1<<3)
#define ACCESS_ADMIN (1<<4) #define ACCESS_RECORDER (1<<4)
#define ACCESS_ADMIN (1<<5)
#define ACCESS_OR (1<<30) #define ACCESS_OR (1<<30)
#define ACCESS_FULL \ #define ACCESS_FULL \
(ACCESS_STREAMING | ACCESS_ADVANCED_STREAMING | \ (ACCESS_STREAMING | ACCESS_ADVANCED_STREAMING | \
ACCESS_HTSP_STREAMING | \
ACCESS_WEB_INTERFACE | ACCESS_RECORDER | ACCESS_ADMIN) ACCESS_WEB_INTERFACE | ACCESS_RECORDER | ACCESS_ADMIN)
/** /**

View file

@ -78,7 +78,7 @@ static void *htsp_server, *htsp_server_2;
#define HTSP_ASYNC_AUX_DVR 0x02 #define HTSP_ASYNC_AUX_DVR 0x02
#define HTSP_ASYNC_AUX_AUTOREC 0x03 #define HTSP_ASYNC_AUX_AUTOREC 0x03
#define HTSP_PRIV_MASK (ACCESS_STREAMING) #define HTSP_PRIV_MASK (ACCESS_HTSP_STREAMING)
extern char *dvr_storage; extern char *dvr_storage;
@ -2182,14 +2182,14 @@ struct {
} htsp_methods[] = { } htsp_methods[] = {
{ "hello", htsp_method_hello, ACCESS_ANONYMOUS}, { "hello", htsp_method_hello, ACCESS_ANONYMOUS},
{ "authenticate", htsp_method_authenticate, ACCESS_ANONYMOUS}, { "authenticate", htsp_method_authenticate, ACCESS_ANONYMOUS},
{ "getDiskSpace", htsp_method_getDiskSpace, ACCESS_STREAMING}, { "getDiskSpace", htsp_method_getDiskSpace, ACCESS_HTSP_STREAMING},
{ "getSysTime", htsp_method_getSysTime, ACCESS_STREAMING}, { "getSysTime", htsp_method_getSysTime, ACCESS_HTSP_STREAMING},
{ "enableAsyncMetadata", htsp_method_async, ACCESS_STREAMING}, { "enableAsyncMetadata", htsp_method_async, ACCESS_HTSP_STREAMING},
{ "getChannel", htsp_method_getChannel, ACCESS_STREAMING}, { "getChannel", htsp_method_getChannel, ACCESS_HTSP_STREAMING},
{ "getEvent", htsp_method_getEvent, ACCESS_STREAMING}, { "getEvent", htsp_method_getEvent, ACCESS_HTSP_STREAMING},
{ "getEvents", htsp_method_getEvents, ACCESS_STREAMING}, { "getEvents", htsp_method_getEvents, ACCESS_HTSP_STREAMING},
{ "epgQuery", htsp_method_epgQuery, ACCESS_STREAMING}, { "epgQuery", htsp_method_epgQuery, ACCESS_HTSP_STREAMING},
{ "getEpgObject", htsp_method_getEpgObject, ACCESS_STREAMING}, { "getEpgObject", htsp_method_getEpgObject, ACCESS_HTSP_STREAMING},
{ "getDvrConfigs", htsp_method_getDvrConfigs, ACCESS_RECORDER}, { "getDvrConfigs", htsp_method_getDvrConfigs, ACCESS_RECORDER},
{ "addDvrEntry", htsp_method_addDvrEntry, ACCESS_RECORDER}, { "addDvrEntry", htsp_method_addDvrEntry, ACCESS_RECORDER},
{ "updateDvrEntry", htsp_method_updateDvrEntry, ACCESS_RECORDER}, { "updateDvrEntry", htsp_method_updateDvrEntry, ACCESS_RECORDER},
@ -2198,16 +2198,16 @@ struct {
{ "addAutorecEntry", htsp_method_addAutorecEntry, ACCESS_RECORDER}, { "addAutorecEntry", htsp_method_addAutorecEntry, ACCESS_RECORDER},
{ "deleteAutorecEntry", htsp_method_deleteAutorecEntry, ACCESS_RECORDER}, { "deleteAutorecEntry", htsp_method_deleteAutorecEntry, ACCESS_RECORDER},
{ "getDvrCutpoints", htsp_method_getDvrCutpoints, ACCESS_RECORDER}, { "getDvrCutpoints", htsp_method_getDvrCutpoints, ACCESS_RECORDER},
{ "getTicket", htsp_method_getTicket, ACCESS_STREAMING}, { "getTicket", htsp_method_getTicket, ACCESS_HTSP_STREAMING},
{ "subscribe", htsp_method_subscribe, ACCESS_STREAMING}, { "subscribe", htsp_method_subscribe, ACCESS_HTSP_STREAMING},
{ "unsubscribe", htsp_method_unsubscribe, ACCESS_STREAMING}, { "unsubscribe", htsp_method_unsubscribe, ACCESS_HTSP_STREAMING},
{ "subscriptionChangeWeight", htsp_method_change_weight, ACCESS_STREAMING}, { "subscriptionChangeWeight", htsp_method_change_weight, ACCESS_HTSP_STREAMING},
{ "subscriptionSeek", htsp_method_skip, ACCESS_STREAMING}, { "subscriptionSeek", htsp_method_skip, ACCESS_HTSP_STREAMING},
{ "subscriptionSkip", htsp_method_skip, ACCESS_STREAMING}, { "subscriptionSkip", htsp_method_skip, ACCESS_HTSP_STREAMING},
{ "subscriptionSpeed", htsp_method_speed, ACCESS_STREAMING}, { "subscriptionSpeed", htsp_method_speed, ACCESS_HTSP_STREAMING},
{ "subscriptionLive", htsp_method_live, ACCESS_STREAMING}, { "subscriptionLive", htsp_method_live, ACCESS_HTSP_STREAMING},
{ "subscriptionFilterStream", htsp_method_filter_stream, ACCESS_STREAMING}, { "subscriptionFilterStream", htsp_method_filter_stream, ACCESS_HTSP_STREAMING},
{ "getProfiles", htsp_method_getProfiles, ACCESS_STREAMING}, { "getProfiles", htsp_method_getProfiles, ACCESS_HTSP_STREAMING},
{ "fileOpen", htsp_method_file_open, ACCESS_RECORDER}, { "fileOpen", htsp_method_file_open, ACCESS_RECORDER},
{ "fileRead", htsp_method_file_read, ACCESS_RECORDER}, { "fileRead", htsp_method_file_read, ACCESS_RECORDER},
{ "fileClose", htsp_method_file_close, ACCESS_RECORDER}, { "fileClose", htsp_method_file_close, ACCESS_RECORDER},

View file

@ -5,8 +5,9 @@
tvheadend.acleditor = function(panel, index) tvheadend.acleditor = function(panel, index)
{ {
var list = 'enabled,username,password,prefix,' + var list = 'enabled,username,password,prefix,' +
'streaming,adv_streaming,profile,' + 'webui,admin,' +
'dvr,dvr_config,webui,admin,conn_limit,' + 'streaming,adv_streaming,htsp_streaming,' +
'profile,conn_limit,dvr,dvr_config,' +
'channel_min,channel_max,channel_tag,comment'; 'channel_min,channel_max,channel_tag,comment';
tvheadend.idnode_grid(panel, { tvheadend.idnode_grid(panel, {
@ -15,18 +16,19 @@ tvheadend.acleditor = function(panel, index)
titleP: 'Access Entries', titleP: 'Access Entries',
iconCls: 'group', iconCls: 'group',
columns: { columns: {
enabled: { width: 120 }, enabled: { width: 120 },
username: { width: 250 }, username: { width: 250 },
password: { width: 250 }, password: { width: 250 },
prefix: { width: 350 }, prefix: { width: 350 },
streaming: { width: 110 }, streaming: { width: 110 },
adv_streaming: { width: 200 }, adv_streaming: { width: 200 },
dvr: { width: 150 }, htsp_streaming: { width: 200 },
webui: { width: 140 }, dvr: { width: 150 },
admin: { width: 100 }, webui: { width: 140 },
conn_limit: { width: 160 }, admin: { width: 100 },
channel_min: { width: 160 }, conn_limit: { width: 160 },
channel_max: { width: 160 } channel_min: { width: 160 },
channel_max: { width: 160 }
}, },
tabIndex: index, tabIndex: index,
edit: { edit: {