Changeset 7216


Ignore:
Timestamp:
Oct 19, 2016, 10:17:37 PM (5 years ago)
Author:
Nicklas Nordborg
Message:

References #2034: New permission for annotating items

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

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

Legend:

Unmodified
Added
Removed
  • trunk/www/admin/roles/edit_role.jsp

    r6684 r7216  
    6969private static final int READ_CODE = PermissionUtil.getPermissionCode(EnumSet.of(Permission.READ));
    7070private static final int USE_CODE = PermissionUtil.getPermissionCode(EnumSet.of(Permission.USE));
     71private static final int RESTRICTED_WRITE_CODE = PermissionUtil.getPermissionCode(EnumSet.of(Permission.RESTRICTED_WRITE));
    7172private static final int WRITE_CODE = PermissionUtil.getPermissionCode(EnumSet.of(Permission.WRITE));
    7273private static final int DELETE_CODE = PermissionUtil.getPermissionCode(EnumSet.of(Permission.DELETE));
     
    9899      if (defined.contains(Permission.READ)) sb.append(permissions.contains(Permission.READ) ? "R" : "-");
    99100      if (defined.contains(Permission.USE)) sb.append(permissions.contains(Permission.USE) ? "U" : "-");
     101      if (defined.contains(Permission.RESTRICTED_WRITE)) sb.append(permissions.contains(Permission.RESTRICTED_WRITE) ? "A" : "-");
    100102      if (defined.contains(Permission.WRITE)) sb.append(permissions.contains(Permission.WRITE) ? "W" : "-");
    101103      if (defined.contains(Permission.DELETE)) sb.append(permissions.contains(Permission.DELETE) ? "D" : "-");
     
    266268          <input type="checkbox" name="read" id="read" value="<%=READ_CODE%>"><label for="read">Read</label><br>
    267269          <input type="checkbox" name="use" id="use" value="<%=USE_CODE%>"><label for="use">Use</label><br>
     270          <input type="checkbox" name="restricted_write" id="restricted_write" value="<%=RESTRICTED_WRITE_CODE%>"><label for="restricted_write">Annotate</label><br>
    268271          <input type="checkbox" name="write" id="write" value="<%=WRITE_CODE%>"><label for="write">Write</label><br>
    269272          <input type="checkbox" name="delete" id="delete" value="<%=DELETE_CODE%>"><label for="delete">Delete</label><br>
  • trunk/www/admin/roles/roles.js

    r6389 r7216  
    4646      Events.addEventHandler('read', 'click', roles.permissionsOnClick);
    4747      Events.addEventHandler('use', 'click', roles.permissionsOnClick);
     48      Events.addEventHandler('restricted_write', 'click', roles.permissionsOnClick);
    4849      Events.addEventHandler('write', 'click', roles.permissionsOnClick);
    4950      Events.addEventHandler('delete', 'click', roles.permissionsOnClick);
     
    127128      frm['use'].checked = (permissionCode & frm['use'].value);
    128129      frm['use'].disabled = !(definedPermissions & frm['use'].value);
     130      frm['restricted_write'].disabled = !(definedPermissions & frm['restricted_write'].value);
     131      frm['restricted_write'].checked = (permissionCode & frm['restricted_write'].value);
    129132      frm['write'].checked = (permissionCode & frm['write'].value);
    130133      frm['write'].disabled = !(definedPermissions & frm['write'].value);
     
    162165          if (definedPermissions & frm['read'].value) status += frm['read'].checked ? "R" : "-";
    163166          if (definedPermissions & frm['use'].value) status += frm['use'].checked ? "U" : "-";
     167          if (definedPermissions & frm['restricted_write'].value) status += frm['restricted_write'].checked ? "A" : "-";
    164168          if (definedPermissions & frm['write'].value) status += frm['write'].checked ? "W" : "-";
    165169          if (definedPermissions & frm['delete'].value) status += frm['delete'].checked ? "D" : "-";
     
    183187      frm['delete'].checked = frm['delete'].checked && !frm['deny'].checked;
    184188      frm['write'].checked = (frm['write'].checked || frm['delete'].checked || frm['set_owner'].checked || frm['set_permission'].checked) && !frm['deny'].checked;
     189      frm['restricted_write'].checked = (frm['restricted_write'].checked || frm['write'].checked) && !frm['deny'].checked;
    185190      frm['use'].checked = (frm['use'].checked || frm['write'].checked) && !frm['deny'].checked;
    186       frm['read'].checked = (frm['read'].checked || frm['use'].checked) && !frm['deny'].checked;
     191      frm['read'].checked = (frm['read'].checked || frm['use'].checked || frm['restricted_write'].checked) && !frm['deny'].checked;
    187192      frm['create'].checked = frm['create'].checked && !frm['deny'].checked;
    188193    }
    189194    else
    190195    {
    191       frm['deny'].checked = frm['deny'].checked && !frm['create'].checked && !frm['read'].checked && !frm['use'].checked && !frm['write'].checked && !frm['delete'].checked && !frm['set_owner'].checked && !frm['set_permission'].checked;
     196      frm['deny'].checked = frm['deny'].checked && !frm['create'].checked && !frm['read'].checked && !frm['use'].checked && !frm['restricted_write'].checked && !frm['write'].checked && !frm['delete'].checked && !frm['set_owner'].checked && !frm['set_permission'].checked;
    192197      frm['create'].checked = frm['create'].checked && !frm['deny'].checked;
    193198      frm['read'].checked = frm['read'].checked && !frm['deny'].checked;
    194199      frm['use'].checked = (frm['use'].checked && frm['read'].checked) && !frm['deny'].checked;
    195       frm['write'].checked = (frm['write'].checked && frm['use'].checked) && !frm['deny'].checked;
     200      frm['restricted_write'].checked = (frm['restricted_write'].checked && frm['read'].checked) && !frm['deny'].checked;
     201      frm['write'].checked = (frm['write'].checked && frm['use'].checked) && frm['restricted_write'].checked && !frm['deny'].checked;
    196202      frm['delete'].checked = (frm['delete'].checked && frm['write'].checked) && !frm['deny'].checked;
    197203      frm['set_owner'].checked = (frm['set_owner'].checked && frm['write'].checked) && !frm['deny'].checked;
     
    208214    permissionCode += frm['read'].checked ? parseInt(frm['read'].value) : 0;
    209215    permissionCode += frm['use'].checked ? parseInt(frm['use'].value) : 0;
     216    permissionCode += frm['restricted_write'].checked ? parseInt(frm['restricted_write'].value) : 0;
    210217    permissionCode += frm['write'].checked ? parseInt(frm['write'].value) : 0;
    211218    permissionCode += frm['delete'].checked ? parseInt(frm['delete'].value) : 0;
  • trunk/www/admin/roles/view_role.jsp

    r6605 r7216  
    7575    if (defined.contains(Permission.READ)) sb.append(permissions.contains(Permission.READ) ? "R" : "-");
    7676    if (defined.contains(Permission.USE)) sb.append(permissions.contains(Permission.USE) ? "U" : "-");
     77    if (defined.contains(Permission.RESTRICTED_WRITE)) sb.append(permissions.contains(Permission.RESTRICTED_WRITE) ? "A" : "-");
    7778    if (defined.contains(Permission.WRITE)) sb.append(permissions.contains(Permission.WRITE) ? "W" : "-");
    7879    if (defined.contains(Permission.DELETE)) sb.append(permissions.contains(Permission.DELETE) ? "D" : "-");
     
    322323        %>
    323324        </table>
    324         <b>C</b> = Create, <b>R</b> = Read, <b>U</b> = Use,
     325        <b>C</b> = Create, <b>R</b> = Read, <b>U</b> = Use, <b>A</b> = Annotate,
    325326        <b>W</b> = Write, <b>D</b> = Delete, <b>O</b> = Change owner, <b>P</b> = Change permissions
    326327      </base:section>
Note: See TracChangeset for help on using the changeset viewer.