public void setRead(String roles) throws Exception { readRoles = roles; setReadACLs(parseACLs(readRoles)); }
/** * Applies policy to the entry given the actual principals that will be applied to the policy entry. * * @param entry * the policy entry to which the policy should be applied * @param permissionType * the type of the permission that the policy will be applied to * @param acls * the principals that represent the actual policy * * @throw IllegalArgumentException if {@code permissionType} is unsupported */ protected void applyAcl(AuthorizationEntry entry, PermissionType permissionType, Set<Object> acls) { switch (permissionType) { case READ: entry.setReadACLs(acls); break; case WRITE: entry.setWriteACLs(acls); break; case ADMIN: entry.setAdminACLs(acls); break; default: throw new IllegalArgumentException("Unknown permission " + permissionType + "."); } }
public void setRead(String roles) throws Exception { readRoles = roles; setReadACLs(parseACLs(readRoles)); }
public void setRead(String roles) throws Exception { readRoles = roles; setReadACLs(parseACLs(readRoles)); }
public void setRead(String roles) throws Exception { readRoles = roles; setReadACLs(parseACLs(readRoles)); }
public void setRead(String roles) throws Exception { readRoles = roles; setReadACLs(parseACLs(readRoles)); }
/** * Applies policy to the entry given the actual principals that will be applied to the policy entry. * * @param entry * the policy entry to which the policy should be applied * @param permissionType * the type of the permission that the policy will be applied to * @param acls * the principals that represent the actual policy * * @throw IllegalArgumentException if {@code permissionType} is unsupported */ protected void applyAcl(AuthorizationEntry entry, PermissionType permissionType, Set<Object> acls) { switch (permissionType) { case READ: entry.setReadACLs(acls); break; case WRITE: entry.setWriteACLs(acls); break; case ADMIN: entry.setAdminACLs(acls); break; default: throw new IllegalArgumentException("Unknown permission " + permissionType + "."); } }
/** * Applies policy to the entry given the actual principals that will be applied to the policy entry. * * @param entry * the policy entry to which the policy should be applied * @param permissionType * the type of the permission that the policy will be applied to * @param acls * the principals that represent the actual policy * * @throw IllegalArgumentException if {@code permissionType} is unsupported */ protected void applyAcl(AuthorizationEntry entry, PermissionType permissionType, Set<Object> acls) { switch (permissionType) { case READ: entry.setReadACLs(acls); break; case WRITE: entry.setWriteACLs(acls); break; case ADMIN: entry.setAdminACLs(acls); break; default: throw new IllegalArgumentException("Unknown permission " + permissionType + "."); } }
/** * Applies policy to the entry given the actual principals that will be applied to the policy entry. * * @param entry * the policy entry to which the policy should be applied * @param permissionType * the type of the permission that the policy will be applied to * @param acls * the principals that represent the actual policy * * @throw IllegalArgumentException if {@code permissionType} is unsupported */ protected void applyAcl(AuthorizationEntry entry, PermissionType permissionType, Set<Object> acls) { switch (permissionType) { case READ: entry.setReadACLs(acls); break; case WRITE: entry.setWriteACLs(acls); break; case ADMIN: entry.setAdminACLs(acls); break; default: throw new IllegalArgumentException("Unknown permission " + permissionType + "."); } }
protected AuthorizationEntry createAuthorizationEntry(KapuaConnectionContext kcc, Acl acl, String address) { AuthorizationEntry authorizationEntry = new AuthorizationEntry(); authorizationEntry.setDestination(ActiveMQDestination.createDestination(address, ActiveMQDestination.TOPIC_TYPE)); Set<Object> writeACLs = new HashSet<>(); Set<Object> readACLs = new HashSet<>(); Set<Object> adminACLs = new HashSet<>(); if (acl.isRead()) { readACLs.add(kcc.getPrincipal()); } if (acl.isWrite()) { writeACLs.add(kcc.getPrincipal()); } if (acl.isAdmin()) { adminACLs.add(kcc.getPrincipal()); } authorizationEntry.setWriteACLs(writeACLs); authorizationEntry.setReadACLs(readACLs); authorizationEntry.setAdminACLs(adminACLs); return authorizationEntry; }
public void afterPropertiesSet() throws Exception { super.afterPropertiesSet(); if (adminRoles != null) { setAdminACLs(parseACLs(adminRoles)); } if (writeRoles != null) { setWriteACLs(parseACLs(writeRoles)); } if (readRoles != null) { setReadACLs(parseACLs(readRoles)); } } }