Changeset 7220


Ignore:
Timestamp:
Nov 4, 2016, 9:56:43 AM (5 years ago)
Author:
Nicklas Nordborg
Message:

References #2034: New permission for annotating items

The "Annotate" permission can now be assigned to plugins.

Location:
trunk/www/admin/plugindefinitions
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/www/admin/plugindefinitions/edit_plugin.jsp

    r6621 r7220  
    7373private static final int READ_CODE = PermissionUtil.getPermissionCode(EnumSet.of(Permission.READ));
    7474private static final int USE_CODE = PermissionUtil.getPermissionCode(EnumSet.of(Permission.USE));
     75private static final int RESTRICTED_WRITE_CODE = PermissionUtil.getPermissionCode(EnumSet.of(Permission.RESTRICTED_WRITE));
    7576private static final int WRITE_CODE = PermissionUtil.getPermissionCode(EnumSet.of(Permission.WRITE));
    7677private static final int DELETE_CODE = PermissionUtil.getPermissionCode(EnumSet.of(Permission.DELETE));
     
    257258      data-read="<%=READ_CODE%>"
    258259      data-use="<%=USE_CODE%>"
     260      data-restricted-write="<%=RESTRICTED_WRITE_CODE%>"
    259261      data-write="<%=WRITE_CODE%>"
    260262      data-delete="<%=DELETE_CODE%>"
     
    406408                  <input type="checkbox" name="grant_read" id="grant_read"><label for="grant_read">Read</label><br>
    407409                  <input type="checkbox" name="grant_use" id="grant_use"><label for="grant_use">Use</label><br>
     410                  <input type="checkbox" name="grant_restricted_write" id="grant_restricted_write"><label for="grant_restricted_write">Annotate</label><br>
    408411                  <input type="checkbox" name="grant_write" id="grant_write"><label for="grant_write">Write</label><br>
    409412                  <input type="checkbox" name="grant_delete" id="grant_delete"><label for="grant_delete">Delete</label><br>
     
    416419                  <input type="checkbox" name="deny_read" id="deny_read"><label for="deny_read">Read</label><br>
    417420                  <input type="checkbox" name="deny_use" id="deny_use"><label for="deny_use">Use</label><br>
     421                  <input type="checkbox" name="deny_restricted_write" id="deny_restricted_write"><label for="deny_restricted_write">Annotate</label><br>
    418422                  <input type="checkbox" name="deny_write" id="deny_write"><label for="deny_write">Write</label><br>
    419423                  <input type="checkbox" name="deny_delete" id="deny_delete"><label for="deny_delete">Delete</label><br>
     
    445449                          appendPermissionLetter(sb, Permission.READ, "R", defined, always, maybe);
    446450                          appendPermissionLetter(sb, Permission.USE, "U", defined, always, maybe);
     451                          appendPermissionLetter(sb, Permission.RESTRICTED_WRITE, "A", defined, always, maybe);
    447452                          appendPermissionLetter(sb, Permission.WRITE, "W", defined, always, maybe);
    448453                          appendPermissionLetter(sb, Permission.DELETE, "D", defined, always, maybe);
  • trunk/www/admin/plugindefinitions/plugins.js

    r6944 r7220  
    7676      Events.addEventHandler('grant_read', 'click', plugins.permissionOnClick);
    7777      Events.addEventHandler('grant_use', 'click', plugins.permissionOnClick);
     78      Events.addEventHandler('grant_restricted_write', 'click', plugins.permissionOnClick);
    7879      Events.addEventHandler('grant_write', 'click', plugins.permissionOnClick);
    7980      Events.addEventHandler('grant_delete', 'click', plugins.permissionOnClick);
     
    8384      Events.addEventHandler('deny_read', 'click', plugins.permissionOnClick);
    8485      Events.addEventHandler('deny_use', 'click', plugins.permissionOnClick);
     86      Events.addEventHandler('deny_restricted_write', 'click', plugins.permissionOnClick);
    8587      Events.addEventHandler('deny_write', 'click', plugins.permissionOnClick);
    8688      Events.addEventHandler('deny_delete', 'click', plugins.permissionOnClick);
     
    9193      Permission.READ = Data.int('page-data', 'read');
    9294      Permission.USE = Data.int('page-data', 'use');
     95      Permission.RESTRICTED_WRITE = Data.int('page-data', 'restricted-write');
    9396      Permission.WRITE = Data.int('page-data', 'write');
    9497      Permission.DELETE = Data.int('page-data', 'delete');
     
    385388    var frm = document.forms['plugin'];
    386389    var use = Forms.getCheckedRadio(frm.use_permissions).value == '1';
    387     frm.items.disabled = !use;
     390    frm.itemTypes.disabled = !use;
    388391    frm.grant_create.disabled = !use;
    389392    frm.grant_read.disabled = !use;
    390393    frm.grant_use.disabled = !use;
     394    frm.grant_restricted_write.disabled = !use;
    391395    frm.grant_write.disabled = !use;
    392396    frm.grant_delete.disabled = !use;
     
    396400    frm.deny_read.disabled = !use;
    397401    frm.deny_use.disabled = !use;
     402    frm.deny_restricted_write.disabled = !use;
    398403    frm.deny_write.disabled = !use;
    399404    frm.deny_delete.disabled = !use;
     
    426431      plugins.updatePermissionCheckBoxes('read', Permission.READ, granted, denied, defined);
    427432      plugins.updatePermissionCheckBoxes('use', Permission.USE, granted, denied, defined);
     433      plugins.updatePermissionCheckBoxes('restricted_write', Permission.RESTRICTED_WRITE, granted, denied, defined);
    428434      plugins.updatePermissionCheckBoxes('write', Permission.WRITE, granted, denied, defined);
    429435      plugins.updatePermissionCheckBoxes('delete', Permission.DELETE, granted, denied, defined);
     
    468474      s += plugins.getPermissionLetter('R', Permission.READ, granted, denied, defined);
    469475      s += plugins.getPermissionLetter('U', Permission.USE, granted, denied, defined);
     476      s += plugins.getPermissionLetter('A', Permission.RESTRICTED_WRITE, granted, denied, defined);
    470477      s += plugins.getPermissionLetter('W', Permission.WRITE, granted, denied, defined);
    471478      s += plugins.getPermissionLetter('D', Permission.DELETE, granted, denied, defined);
     
    535542    permissionCode += frm[prefix+'read'].checked ? Permission.READ : 0;
    536543    permissionCode += frm[prefix+'use'].checked ? Permission.USE : 0;
     544    permissionCode += frm[prefix+'restricted_write'].checked ? Permission.RESTRICTED_WRITE : 0;
    537545    permissionCode += frm[prefix+'write'].checked ? Permission.WRITE : 0;
    538546    permissionCode += frm[prefix+'delete'].checked ? Permission.DELETE : 0;
     
    554562    {
    555563      frm['grant_write'].checked = (frm['grant_write'].checked || frm['grant_delete'].checked || frm['grant_set_owner'].checked || frm['grant_set_permission'].checked);
     564      frm['grant_restricted_write'].checked = (frm['grant_restricted_write'].checked || frm['grant_write'].checked);
    556565      frm['grant_use'].checked = (frm['grant_use'].checked || frm['grant_write'].checked);
    557       frm['grant_read'].checked = (frm['grant_read'].checked || frm['grant_use'].checked);
     566      frm['grant_read'].checked = (frm['grant_read'].checked || frm['grant_use'].checked || frm['grant_restricted_write'].checked);
    558567    }
    559568    else
    560569    {
    561570      frm['grant_use'].checked = (frm['grant_use'].checked && frm['grant_read'].checked);
    562       frm['grant_write'].checked = (frm['grant_write'].checked && frm['grant_use'].checked);
     571      frm['grant_restricted_write'].checked = (frm['grant_restricted_write'].checked && frm['grant_read'].checked);
     572      frm['grant_write'].checked = (frm['grant_write'].checked && frm['grant_use'].checked && frm['grant_restricted_write'].checked);
    563573      frm['grant_delete'].checked = (frm['grant_delete'].checked && frm['grant_write'].checked);
    564574      frm['grant_set_owner'].checked = (frm['grant_set_owner'].checked && frm['grant_write'].checked);
     
    570580    frm['deny_read'].disabled =frm['grant_read'].disabled || frm['grant_read'].checked;
    571581    frm['deny_use'].disabled = frm['grant_use'].disabled || frm['grant_use'].checked;
     582    frm['deny_restricted_write'].disabled = frm['grant_restricted_write'].disabled || frm['grant_restricted_write'].checked;
    572583    frm['deny_write'].disabled = frm['grant_write'].disabled || frm['grant_write'].checked;
    573584    frm['deny_delete'].disabled = frm['grant_delete'].disabled || frm['grant_delete'].checked;
     
    577588    {
    578589      if (!frm['deny_use'].disabled) frm['deny_use'].checked = frm['deny_use'].checked || frm['deny_read'].checked;
    579       if (!frm['deny_write'].disabled) frm['deny_write'].checked = frm['deny_write'].checked || frm['deny_use'].checked;
     590      if (!frm['deny_restricted_write'].disabled) frm['deny_restricted_write'].checked = frm['deny_restricted_write'].checked || frm['deny_read'].checked;
     591      if (!frm['deny_write'].disabled) frm['deny_write'].checked = frm['deny_write'].checked || frm['deny_use'].checked || frm['deny_restricted_write'].checked;
    580592      if (!frm['deny_delete'].disabled) frm['deny_delete'].checked = frm['deny_delete'].checked || frm['deny_write'].checked;
    581593      if (!frm['deny_set_owner'].disabled) frm['deny_set_owner'].checked = frm['deny_set_owner'].checked || frm['deny_write'].checked;
     
    585597    {
    586598      if (!frm['deny_write'].disabled) frm['deny_write'].checked = frm['deny_write'].checked && !((!frm['deny_delete'].checked && !frm['deny_delete'].disabled) || (!frm['deny_set_owner'].checked && !frm['deny_set_owner'].disabled) || (!frm['deny_set_permission'].checked && !frm['deny_set_permission'].disabled));
     599      if (!frm['deny_restricted_write'].disabled) frm['deny_restricted_write'].checked = frm['deny_restricted_write'].checked && frm['deny_write'].checked;
    587600      if (!frm['deny_use'].disabled) frm['deny_use'].checked = frm['deny_use'].checked && frm['deny_write'].checked;
    588       if (!frm['deny_read'].disabled) frm['deny_read'].checked = frm['deny_read'].checked && frm['deny_use'].checked;
     601      if (!frm['deny_read'].disabled) frm['deny_read'].checked = frm['deny_read'].checked && frm['deny_use'].checked && frm['deny_restricted_write'].checked;
    589602    }
    590603  }
  • trunk/www/admin/plugindefinitions/view_plugin.jsp

    r6640 r7220  
    8787    if (defined.contains(Permission.READ)) sb.append(granted.contains(Permission.READ) ? "R" :  denied.contains(Permission.READ) ? "-" : "r");
    8888    if (defined.contains(Permission.USE)) sb.append(granted.contains(Permission.USE) ? "U" :  denied.contains(Permission.USE) ? "-" : "u");
     89    if (defined.contains(Permission.RESTRICTED_WRITE)) sb.append(granted.contains(Permission.RESTRICTED_WRITE) ? "A" :  denied.contains(Permission.RESTRICTED_WRITE) ? "-" : "a");
    8990    if (defined.contains(Permission.WRITE)) sb.append(granted.contains(Permission.WRITE) ? "W" :  denied.contains(Permission.WRITE) ? "-" : "w");
    9091    if (defined.contains(Permission.DELETE)) sb.append(granted.contains(Permission.DELETE) ? "D" :  denied.contains(Permission.DELETE) ? "-" : "d");
     
    649650        Capital letters = Permission is always granted, Small letters = Permission is only granted if logged in user
    650651        has that permission<br>
    651         <b>C/c</b> = Create, <b>R/r</b> = Read, <b>U/u</b> = Use,
     652        <b>C/c</b> = Create, <b>R/r</b> = Read, <b>U/u</b> = Use, <b>A/a</b> = Annotate,
    652653        <b>W/w</b> = Write, <b>D/d</b> = Delete, <b>O/o</b> = Change owner,
    653654        <b>P/p</b> = Change permissions
Note: See TracChangeset for help on using the changeset viewer.