public static RestGrant map(String objectName, Grant grant) { return new RestGrant(grant.getGrantedUsername(), objectName, grant.getAccessMode()); } }
@Override public void revoke(RemotingContext context, String object, String user) throws RemoteException { try { byte[] serializedGrant = toBytes(new RestGrant(user, object, AccessMode.NONE)); doInternalRequest(context, "Grants", new HashMap<>(), serializedGrant, REQUEST_MODE.DELETE); } catch(RestException e) { throw new RemoteException("Unable to grant", e); } } }
@Override public void grant(RemotingContext context, String object, String user, AccessMode mode) throws RemoteException { try { byte[] serializedGrant = toBytes(new RestGrant(user, object, mode)); doInternalRequest(context, "Grants", new HashMap<>(), serializedGrant, REQUEST_MODE.POST); } catch(RestException e) { throw new RemoteException("Unable to grant", e); } }