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.
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>
<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>
<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)..
<dt><b>HTSP Streaming</b>
<dd>
Enables access to streaming for the HTSP protocol (Showtime, XBMC etc.).
<dt><b>Streaming Profile</b>
<dd>
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>
<dd>
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.
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>
<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.

View file

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

View file

@ -57,6 +57,7 @@ typedef struct access_entry {
int ae_streaming;
int ae_adv_streaming;
int ae_htsp_streaming;
struct profile *ae_profile;
LIST_ENTRY(access_entry) ae_profile_link;
@ -113,13 +114,15 @@ typedef struct access_ticket {
#define ACCESS_ANONYMOUS 0
#define ACCESS_STREAMING (1<<0)
#define ACCESS_ADVANCED_STREAMING (1<<1)
#define ACCESS_WEB_INTERFACE (1<<2)
#define ACCESS_RECORDER (1<<3)
#define ACCESS_ADMIN (1<<4)
#define ACCESS_HTSP_STREAMING (1<<2)
#define ACCESS_WEB_INTERFACE (1<<3)
#define ACCESS_RECORDER (1<<4)
#define ACCESS_ADMIN (1<<5)
#define ACCESS_OR (1<<30)
#define ACCESS_FULL \
(ACCESS_STREAMING | ACCESS_ADVANCED_STREAMING | \
ACCESS_HTSP_STREAMING | \
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_AUTOREC 0x03
#define HTSP_PRIV_MASK (ACCESS_STREAMING)
#define HTSP_PRIV_MASK (ACCESS_HTSP_STREAMING)
extern char *dvr_storage;
@ -2182,14 +2182,14 @@ struct {
} htsp_methods[] = {
{ "hello", htsp_method_hello, ACCESS_ANONYMOUS},
{ "authenticate", htsp_method_authenticate, ACCESS_ANONYMOUS},
{ "getDiskSpace", htsp_method_getDiskSpace, ACCESS_STREAMING},
{ "getSysTime", htsp_method_getSysTime, ACCESS_STREAMING},
{ "enableAsyncMetadata", htsp_method_async, ACCESS_STREAMING},
{ "getChannel", htsp_method_getChannel, ACCESS_STREAMING},
{ "getEvent", htsp_method_getEvent, ACCESS_STREAMING},
{ "getEvents", htsp_method_getEvents, ACCESS_STREAMING},
{ "epgQuery", htsp_method_epgQuery, ACCESS_STREAMING},
{ "getEpgObject", htsp_method_getEpgObject, ACCESS_STREAMING},
{ "getDiskSpace", htsp_method_getDiskSpace, ACCESS_HTSP_STREAMING},
{ "getSysTime", htsp_method_getSysTime, ACCESS_HTSP_STREAMING},
{ "enableAsyncMetadata", htsp_method_async, ACCESS_HTSP_STREAMING},
{ "getChannel", htsp_method_getChannel, ACCESS_HTSP_STREAMING},
{ "getEvent", htsp_method_getEvent, ACCESS_HTSP_STREAMING},
{ "getEvents", htsp_method_getEvents, ACCESS_HTSP_STREAMING},
{ "epgQuery", htsp_method_epgQuery, ACCESS_HTSP_STREAMING},
{ "getEpgObject", htsp_method_getEpgObject, ACCESS_HTSP_STREAMING},
{ "getDvrConfigs", htsp_method_getDvrConfigs, ACCESS_RECORDER},
{ "addDvrEntry", htsp_method_addDvrEntry, ACCESS_RECORDER},
{ "updateDvrEntry", htsp_method_updateDvrEntry, ACCESS_RECORDER},
@ -2198,16 +2198,16 @@ struct {
{ "addAutorecEntry", htsp_method_addAutorecEntry, ACCESS_RECORDER},
{ "deleteAutorecEntry", htsp_method_deleteAutorecEntry, ACCESS_RECORDER},
{ "getDvrCutpoints", htsp_method_getDvrCutpoints, ACCESS_RECORDER},
{ "getTicket", htsp_method_getTicket, ACCESS_STREAMING},
{ "subscribe", htsp_method_subscribe, ACCESS_STREAMING},
{ "unsubscribe", htsp_method_unsubscribe, ACCESS_STREAMING},
{ "subscriptionChangeWeight", htsp_method_change_weight, ACCESS_STREAMING},
{ "subscriptionSeek", htsp_method_skip, ACCESS_STREAMING},
{ "subscriptionSkip", htsp_method_skip, ACCESS_STREAMING},
{ "subscriptionSpeed", htsp_method_speed, ACCESS_STREAMING},
{ "subscriptionLive", htsp_method_live, ACCESS_STREAMING},
{ "subscriptionFilterStream", htsp_method_filter_stream, ACCESS_STREAMING},
{ "getProfiles", htsp_method_getProfiles, ACCESS_STREAMING},
{ "getTicket", htsp_method_getTicket, ACCESS_HTSP_STREAMING},
{ "subscribe", htsp_method_subscribe, ACCESS_HTSP_STREAMING},
{ "unsubscribe", htsp_method_unsubscribe, ACCESS_HTSP_STREAMING},
{ "subscriptionChangeWeight", htsp_method_change_weight, ACCESS_HTSP_STREAMING},
{ "subscriptionSeek", htsp_method_skip, ACCESS_HTSP_STREAMING},
{ "subscriptionSkip", htsp_method_skip, ACCESS_HTSP_STREAMING},
{ "subscriptionSpeed", htsp_method_speed, ACCESS_HTSP_STREAMING},
{ "subscriptionLive", htsp_method_live, ACCESS_HTSP_STREAMING},
{ "subscriptionFilterStream", htsp_method_filter_stream, ACCESS_HTSP_STREAMING},
{ "getProfiles", htsp_method_getProfiles, ACCESS_HTSP_STREAMING},
{ "fileOpen", htsp_method_file_open, ACCESS_RECORDER},
{ "fileRead", htsp_method_file_read, ACCESS_RECORDER},
{ "fileClose", htsp_method_file_close, ACCESS_RECORDER},

View file

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