use of com.hortonworks.registries.storage.StorableKey in project streamline by hortonworks.
the class CatalogService method getFile.
public File getFile(Long jarId) {
File file = new File();
file.setId(jarId);
return dao.get(new StorableKey(FILE_NAMESPACE, file.getPrimaryKey()));
}
use of com.hortonworks.registries.storage.StorableKey in project streamline by hortonworks.
the class SecurityCatalogService method removeChildRole.
public RoleHierarchy removeChildRole(Long parentRoleId, Long childRoleId) {
validateRoleIds(parentRoleId);
RoleHierarchy roleHierarchy = new RoleHierarchy();
roleHierarchy.setParentId(parentRoleId);
roleHierarchy.setChildId(childRoleId);
return this.dao.remove(new StorableKey(RoleHierarchy.NAMESPACE, roleHierarchy.getPrimaryKey()));
}
use of com.hortonworks.registries.storage.StorableKey in project streamline by hortonworks.
the class SecurityCatalogService method getRole.
public Role getRole(Long roleId) {
Role role = new Role();
role.setId(roleId);
return this.dao.get(new StorableKey(Role.NAMESPACE, role.getPrimaryKey()));
}
use of com.hortonworks.registries.storage.StorableKey in project streamline by hortonworks.
the class SecurityCatalogService method getUser.
public User getUser(Long userId) {
User user = new User();
user.setId(userId);
return fillRoles(this.dao.<User>get(new StorableKey(User.NAMESPACE, user.getPrimaryKey())));
}
use of com.hortonworks.registries.storage.StorableKey in project streamline by hortonworks.
the class SecurityCatalogService method removeUser.
public User removeUser(Long userId) {
User userToRemove = getUser(userId);
if (userToRemove != null) {
if (userToRemove.getRoles() != null) {
userToRemove.getRoles().forEach(roleName -> {
Optional<Role> r = getRole(roleName);
if (r.isPresent()) {
removeUserRole(userId, r.get().getId());
}
});
}
// remove permissions assigned to user
LOG.debug("Removing ACL entries for user {}", userToRemove);
List<QueryParam> qps = QueryParam.params(AclEntry.SID_ID, String.valueOf(userId), AclEntry.SID_TYPE, AclEntry.SidType.USER.toString());
listAcls(qps).forEach(aclEntry -> removeAcl(aclEntry.getId()));
return dao.remove(new StorableKey(User.NAMESPACE, userToRemove.getPrimaryKey()));
}
throw new IllegalArgumentException("No user with id: " + userId);
}
Aggregations