Ejemplo n.º 1
0
 public void checkReadWritePermission(IRI GraphUri) {
   SecurityManager security = System.getSecurityManager();
   if (security != null) {
     // will AllPermissions the rest is obsolete
     try {
       AccessController.checkPermission(new AllPermission());
     } catch (AccessControlException e) {
       if (GraphUri.equals(permissionGraphName)) {
         AccessController.checkPermission(
             new TcPermission(GraphUri.getUnicodeString(), TcPermission.READWRITE));
       } else {
         Collection<Permission> perms = getRequiredReadWritePermissions(GraphUri);
         if (perms.size() > 0) {
           for (Permission permission : perms) {
             AccessController.checkPermission(permission);
           }
         } else {
           AccessController.checkPermission(
               new TcPermission(GraphUri.getUnicodeString(), TcPermission.READWRITE));
         }
       }
     }
   }
 }
Ejemplo n.º 2
0
 public void checkReadPermission(IRI GraphUri) {
   if (GraphUri.equals(permissionGraphName)) {
     // This is world readable, as this prevents as from doingf things as
     // priviledged during verfification
     return;
   }
   SecurityManager security = System.getSecurityManager();
   if (security != null) {
     // will AllPermissions the rest is obsolete
     try {
       AccessController.checkPermission(new AllPermission());
     } catch (AccessControlException e) {
       Collection<Permission> perms = getRequiredReadPermissions(GraphUri);
       if (perms.size() > 0) {
         for (Permission permission : perms) {
           AccessController.checkPermission(permission);
         }
       } else {
         AccessController.checkPermission(
             new TcPermission(GraphUri.getUnicodeString(), TcPermission.READ));
       }
     }
   }
 }