]> git.ipfire.org Git - thirdparty/tvheadend.git/commitdiff
ACL: add "All DVR (rw)" to delete a DVR entry.
authorBen Kibbey <bjk@luxsci.net>
Thu, 29 Jan 2015 02:07:49 +0000 (21:07 -0500)
committerJaroslav Kysela <perex@perex.cz>
Wed, 4 Feb 2015 16:53:09 +0000 (17:53 +0100)
This is to let a user remove a DVR entry created by another user rather
than only being able to access it.

docs/html/config_access.html
src/access.c
src/access.h
src/dvr/dvr.h
src/webui/static/app/acleditor.js

index a27e289222392a2c89a4d0e52d65551baead5754..50300dbd05e0d859953ac4ef277c0c50f925b48a 100644 (file)
@@ -97,6 +97,11 @@ The columns have the following functions:
   <dd>
   Enable to access to DVR entries created by other users (read-only).
 
+  <dt><b>All DVR (rw)</b>
+  <dd>
+  Enable to access to DVR entries created by other users with the ability to
+  remove the DVR entries.
+
   <dt><b>DVR Config Profile</b>
   <dd>
   If set, the user will only be able to use the DVR config profile
index 4d68338ea3cbb914abdb905ae73933683ce4f31b..443fad1a0594f976a1b17b79f9ddcfb0f889f8e5 100644 (file)
@@ -357,7 +357,7 @@ access_dump_a(access_t *a)
   int first;
 
   snprintf(buf, sizeof(buf),
-    "%s:%s [%c%c%c%c%c%c%c%c], conn=%u, chmin=%llu, chmax=%llu%s",
+    "%s:%s [%c%c%c%c%c%c%c%c%c], conn=%u, chmin=%llu, chmax=%llu%s",
     a->aa_representative ?: "<no-id>",
     a->aa_username ?: "<no-user>",
     a->aa_rights & ACCESS_STREAMING          ? 'S' : ' ',
@@ -367,6 +367,7 @@ access_dump_a(access_t *a)
     a->aa_rights & ACCESS_RECORDER           ? 'R' : ' ',
     a->aa_rights & ACCESS_HTSP_RECORDER      ? 'E' : ' ',
     a->aa_rights & ACCESS_ALL_RECORDER       ? 'L' : ' ',
+    a->aa_rights & ACCESS_ALL_RW_RECORDER    ? 'D' : ' ',
     a->aa_rights & ACCESS_ADMIN              ? '*' : ' ',
     a->aa_conn_limit,
     (long long)a->aa_chmin, (long long)a->aa_chmax,
@@ -819,6 +820,8 @@ access_entry_update_rights(access_entry_t *ae)
     r |= ACCESS_WEB_INTERFACE;
   if (ae->ae_admin)
     r |= ACCESS_ADMIN;
+  if (ae->ae_all_rw_dvr)
+    r |= ACCESS_ALL_RW_RECORDER;
   ae->ae_rights = r;
 }
 
@@ -1308,6 +1311,12 @@ const idclass_t access_entry_class = {
       .name     = "All DVR",
       .off      = offsetof(access_entry_t, ae_all_dvr),
     },
+    {
+      .type     = PT_BOOL,
+      .id       = "all_rw_dvr",
+      .name     = "All DVR (rw)",
+      .off      = offsetof(access_entry_t, ae_all_rw_dvr),
+    },
     {
       .type     = PT_STR,
       .id       = "dvr_config",
@@ -1417,6 +1426,7 @@ access_init(int createdefault, int noacl)
     ae->ae_dvr            = 1;
     ae->ae_htsp_dvr       = 1;
     ae->ae_all_dvr        = 1;
+    ae->ae_all_rw_dvr     = 1;
     ae->ae_webui          = 1;
     ae->ae_admin          = 1;
     access_entry_update_rights(ae);
index 22f030831ca48759184cdb2491e465ca85ab9abb..5dd3fc367308148a366fd7a8e31fe9d1c058cf60 100644 (file)
@@ -67,6 +67,7 @@ typedef struct access_entry {
   int ae_dvr;
   int ae_htsp_dvr;
   int ae_all_dvr;
+  int ae_all_rw_dvr;
   struct dvr_config *ae_dvr_config;
   LIST_ENTRY(access_entry) ae_dvr_config_link;
 
@@ -122,13 +123,14 @@ typedef struct access_ticket {
 #define ACCESS_HTSP_RECORDER      (1<<5)
 #define ACCESS_ALL_RECORDER       (1<<6)
 #define ACCESS_ADMIN              (1<<7)
+#define ACCESS_ALL_RW_RECORDER    (1<<8)
 #define ACCESS_OR                 (1<<30)
 
 #define ACCESS_FULL \
   (ACCESS_STREAMING | ACCESS_ADVANCED_STREAMING | \
    ACCESS_HTSP_STREAMING | ACCESS_WEB_INTERFACE | \
    ACCESS_RECORDER | ACCESS_HTSP_RECORDER | \
-   ACCESS_ALL_RECORDER | ACCESS_ADMIN)
+   ACCESS_ALL_RECORDER | ACCESS_ADMIN | ACCESS_ALL_RW_RECORDER)
 
 /**
  * Create a new ticket for the requested resource and generate a id for it
index dde45fc40aad29bd073486a6faf4490442acc4c6..85b30c72c8eec0b41a0b8cb778d16798621f074b 100644 (file)
@@ -486,6 +486,10 @@ static inline int dvr_entry_verify(dvr_entry_t *de, access_t *a, int readonly)
 {
   if (readonly && !access_verify2(a, ACCESS_ALL_RECORDER))
     return 0;
+
+  if (!access_verify2(a, ACCESS_ALL_RW_RECORDER))
+    return 0;
+
   if (strcmp(de->de_owner ?: "", a->aa_username ?: ""))
     return -1;
   return 0;
index dd826d39708943042ccc784e5efea057527eef5b..d5e35a76a8a50527c0c2680b8221f86b2de5ca0a 100644 (file)
@@ -7,8 +7,8 @@ tvheadend.acleditor = function(panel, index)
     var list = 'enabled,username,password,prefix,' +
                'webui,admin,' +
                'streaming,adv_streaming,htsp_streaming,' +
-               'profile,conn_limit,dvr,htsp_dvr,all_dvr,dvr_config,' +
-               'channel_min,channel_max,channel_tag,comment';
+               'profile,conn_limit,dvr,htsp_dvr,all_dvr,all_rw_dvr,' +
+              'dvr_config,channel_min,channel_max,channel_tag,comment';
 
     tvheadend.idnode_grid(panel, {
         url: 'api/access/entry',
@@ -26,6 +26,7 @@ tvheadend.acleditor = function(panel, index)
             dvr:            { width: 150 },
             htsp_dvr:       { width: 150 },
             all_dvr:        { width: 150 },
+            all_rw_dvr:     { width: 150 },
             webui:          { width: 140 },
             admin:          { width: 100 },
             conn_limit:     { width: 160 },