Project

General

Profile

Feature #2650 ยป 0001-ACL-add-All-DVR-rw-to-delete-a-DVR-entry.patch

Ben Kibbey, 2015-01-29 03:14

View differences:

docs/html/config_access.html
97 97
  <dd>
98 98
  Enable to access to DVR entries created by other users (read-only).
99 99

  
100
  <dt><b>All DVR (rw)</b>
101
  <dd>
102
  Enable to access to DVR entries created by other users with the ability to
103
  remove the DVR entries.
104

  
100 105
  <dt><b>DVR Config Profile</b>
101 106
  <dd>
102 107
  If set, the user will only be able to use the DVR config profile
src/access.c
357 357
  int first;
358 358

  
359 359
  snprintf(buf, sizeof(buf),
360
    "%s:%s [%c%c%c%c%c%c%c%c], conn=%u, chmin=%llu, chmax=%llu%s",
360
    "%s:%s [%c%c%c%c%c%c%c%c%c], conn=%u, chmin=%llu, chmax=%llu%s",
361 361
    a->aa_representative ?: "<no-id>",
362 362
    a->aa_username ?: "<no-user>",
363 363
    a->aa_rights & ACCESS_STREAMING          ? 'S' : ' ',
......
367 367
    a->aa_rights & ACCESS_RECORDER           ? 'R' : ' ',
368 368
    a->aa_rights & ACCESS_HTSP_RECORDER      ? 'E' : ' ',
369 369
    a->aa_rights & ACCESS_ALL_RECORDER       ? 'L' : ' ',
370
    a->aa_rights & ACCESS_ALL_RW_RECORDER    ? 'D' : ' ',
370 371
    a->aa_rights & ACCESS_ADMIN              ? '*' : ' ',
371 372
    a->aa_conn_limit,
372 373
    (long long)a->aa_chmin, (long long)a->aa_chmax,
......
819 820
    r |= ACCESS_WEB_INTERFACE;
820 821
  if (ae->ae_admin)
821 822
    r |= ACCESS_ADMIN;
823
  if (ae->ae_all_rw_dvr)
824
    r |= ACCESS_ALL_RW_RECORDER;
822 825
  ae->ae_rights = r;
823 826
}
824 827

  
......
1309 1312
      .off      = offsetof(access_entry_t, ae_all_dvr),
1310 1313
    },
1311 1314
    {
1315
      .type     = PT_BOOL,
1316
      .id       = "all_rw_dvr",
1317
      .name     = "All DVR (rw)",
1318
      .off      = offsetof(access_entry_t, ae_all_rw_dvr),
1319
    },
1320
    {
1312 1321
      .type     = PT_STR,
1313 1322
      .id       = "dvr_config",
1314 1323
      .name     = "DVR Config Profile",
......
1417 1426
    ae->ae_dvr            = 1;
1418 1427
    ae->ae_htsp_dvr       = 1;
1419 1428
    ae->ae_all_dvr        = 1;
1429
    ae->ae_all_rw_dvr     = 1;
1420 1430
    ae->ae_webui          = 1;
1421 1431
    ae->ae_admin          = 1;
1422 1432
    access_entry_update_rights(ae);
src/access.h
67 67
  int ae_dvr;
68 68
  int ae_htsp_dvr;
69 69
  int ae_all_dvr;
70
  int ae_all_rw_dvr;
70 71
  struct dvr_config *ae_dvr_config;
71 72
  LIST_ENTRY(access_entry) ae_dvr_config_link;
72 73

  
......
122 123
#define ACCESS_HTSP_RECORDER      (1<<5)
123 124
#define ACCESS_ALL_RECORDER       (1<<6)
124 125
#define ACCESS_ADMIN              (1<<7)
126
#define ACCESS_ALL_RW_RECORDER    (1<<8)
125 127
#define ACCESS_OR                 (1<<30)
126 128

  
127 129
#define ACCESS_FULL \
128 130
  (ACCESS_STREAMING | ACCESS_ADVANCED_STREAMING | \
129 131
   ACCESS_HTSP_STREAMING | ACCESS_WEB_INTERFACE | \
130 132
   ACCESS_RECORDER | ACCESS_HTSP_RECORDER | \
131
   ACCESS_ALL_RECORDER | ACCESS_ADMIN)
133
   ACCESS_ALL_RECORDER | ACCESS_ADMIN | ACCESS_ALL_RW_RECORDER)
132 134

  
133 135
/**
134 136
 * Create a new ticket for the requested resource and generate a id for it
src/dvr/dvr.h
476 476
{
477 477
  if (readonly && !access_verify2(a, ACCESS_ALL_RECORDER))
478 478
    return 0;
479

  
480
  if (!access_verify2(a, ACCESS_ALL_RW_RECORDER))
481
    return 0;
482

  
479 483
  if (strcmp(de->de_owner ?: "", a->aa_username ?: ""))
480 484
    return -1;
481 485
  return 0;
src/webui/static/app/acleditor.js
7 7
    var list = 'enabled,username,password,prefix,' +
8 8
               'webui,admin,' +
9 9
               'streaming,adv_streaming,htsp_streaming,' +
10
               'profile,conn_limit,dvr,htsp_dvr,all_dvr,dvr_config,' +
11
               'channel_min,channel_max,channel_tag,comment';
10
               'profile,conn_limit,dvr,htsp_dvr,all_dvr,all_rw_dvr,' +
11
	       'dvr_config,channel_min,channel_max,channel_tag,comment';
12 12

  
13 13
    tvheadend.idnode_grid(panel, {
14 14
        url: 'api/access/entry',
......
26 26
            dvr:            { width: 150 },
27 27
            htsp_dvr:       { width: 150 },
28 28
            all_dvr:        { width: 150 },
29
            all_rw_dvr:     { width: 150 },
29 30
            webui:          { width: 140 },
30 31
            admin:          { width: 100 },
31 32
            conn_limit:     { width: 160 },
32
- 
    (1-1/1)