![JAR search and dependency download from the Maven repository](/logo.png)
azkaban.user.UserUtils Maven / Gradle / Ivy
package azkaban.user;
public final class UserUtils {
private UserUtils() {
}
/**
* @return - Returns true if the given user is an ADMIN, or if user has the required permission
* for the action requested.
*/
public static boolean hasPermissionforAction(final UserManager userManager, final User user,
final Permission.Type type) {
for (final String roleName : user.getRoles()) {
final Role role = userManager.getRole(roleName);
final Permission perm = role.getPermission();
if (perm.isPermissionSet(Permission.Type.ADMIN) || perm.isPermissionSet(type)) {
return true;
}
}
return false;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy