AnsweredAssumed Answered

Hiding node from non-admins by removing permissions

Question asked by jzaruba on Oct 30, 2010
Latest reply on Oct 31, 2010 by jzaruba

I'm trying to hide a node from all but admins.
    private void setAdminAccessOnly(NodeRef nodeRef)
        permissionService.setInheritParentPermissions(nodeRef, false);

/*      previous attempts:
//      permissionService.deletePermission(nodeRef, null, PermissionService.READ_CHILDREN);
//      permissionService.deletePermission(nodeRef, null, PermissionService.ALL_PERMISSIONS);*/

        permissionService.setPermission(nodeRef, PermissionService.ADMINISTRATOR_AUTHORITY, PermissionService.ALL_PERMISSIONS, true);
        System.out.println(getNodeName(nodeRef) + " is now accessible only to admin");
But I end up with error saying that a node does not exist…

I'm trying to delete a node that has just been uploaded, and because the wizard can't handle such situation I'm trying some workarounds to prevent the file from being reached until I can delete it later. Another approach that lead me to the same error was moving the node to a different store. (Even though I don't know whether that would make that node "unseekable".)