本文整理匯總了Java中azkaban.user.Role類的典型用法代碼示例。如果您正苦於以下問題:Java Role類的具體用法?Java Role怎麽用?Java Role使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
Role類屬於azkaban.user包,在下文中一共展示了Role類的14個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: hasPermission
import azkaban.user.Role; //導入依賴的package包/類
public static boolean hasPermission(Project project, User user,
Permission.Type type) {
UserManager userManager = AzkabanWebServer.getInstance().getUserManager();
if (project.hasPermission(user, type)) {
return true;
}
for (String roleName : user.getRoles()) {
Role role = userManager.getRole(roleName);
if (role.getPermission().isPermissionSet(type)
|| role.getPermission().isPermissionSet(Permission.Type.ADMIN)) {
return true;
}
}
return false;
}
示例2: hasPermission
import azkaban.user.Role; //導入依賴的package包/類
protected boolean hasPermission(Project project, User user, Permission.Type type) {
UserManager userManager = getApplication().getUserManager();
if (project.hasPermission(user, type)) {
return true;
}
for (String roleName: user.getRoles()) {
Role role = userManager.getRole(roleName);
if (role.getPermission().isPermissionSet(type) ||
role.getPermission().isPermissionSet(Permission.Type.ADMIN)) {
return true;
}
}
return false;
}
示例3: getPermissionObject
import azkaban.user.Role; //導入依賴的package包/類
private Permission getPermissionObject(Project project, User user,
Permission.Type type) {
Permission perm = project.getCollectivePermission(user);
for (String roleName : user.getRoles()) {
Role role = userManager.getRole(roleName);
perm.addPermissions(role.getPermission());
}
return perm;
}
示例4: hasPermissionToCreateProject
import azkaban.user.Role; //導入依賴的package包/類
private boolean hasPermissionToCreateProject(User user) {
for (String roleName : user.getRoles()) {
Role role = userManager.getRole(roleName);
Permission perm = role.getPermission();
if (perm.isPermissionSet(Permission.Type.ADMIN)
|| perm.isPermissionSet(Permission.Type.CREATEPROJECTS)) {
return true;
}
}
return false;
}
示例5: hasPermission
import azkaban.user.Role; //導入依賴的package包/類
protected boolean hasPermission(User user, Permission.Type type) {
for (String roleName : user.getRoles()) {
Role role = userManager.getRole(roleName);
if (role.getPermission().isPermissionSet(type)
|| role.getPermission().isPermissionSet(Permission.Type.ADMIN)) {
return true;
}
}
return false;
}
示例6: hasPermission
import azkaban.user.Role; //導入依賴的package包/類
protected boolean hasPermission(User user, Permission.Type type) {
for (String roleName : user.getRoles()) {
Role role = userManager.getRole(roleName);
if (role.getPermission().isPermissionSet(type) || role.getPermission().isPermissionSet(Permission.Type.ADMIN)) {
return true;
}
}
return false;
}
示例7: hasPermission
import azkaban.user.Role; //導入依賴的package包/類
protected boolean hasPermission(User user, Permission.Type type) {
for (String roleName : user.getRoles()) {
Role role = userManager.getRole(roleName);
if (role.getPermission().isPermissionSet(type)
|| role.getPermission().isPermissionSet(Permission.Type.ADMIN)) {
return true;
}
}
return false;
}
示例8: hasPermissionToCreateProject
import azkaban.user.Role; //導入依賴的package包/類
private boolean hasPermissionToCreateProject(User user) {
for (String roleName : user.getRoles()) {
Role role = userManager.getRole(roleName);
Permission perm = role.getPermission();
if (perm.isPermissionSet(Permission.Type.ADMIN)
|| perm.isPermissionSet(Permission.Type.CREATEPROJECTS)) {
return true;
}
}
return false;
}
示例9: hasPermission
import azkaban.user.Role; //導入依賴的package包/類
/**
* returns true if user has access of type
*
* @param userManager
* @param user
* @param type
* @return
*/
public static boolean hasPermission(UserManager userManager, User user,
Permission.Type type) {
for (String roleName : user.getRoles()) {
Role role = userManager.getRole(roleName);
if (role.getPermission().isPermissionSet(type)
|| role.getPermission().isPermissionSet(Permission.Type.ADMIN)) {
return true;
}
}
return false;
}
示例10: getPermissionObject
import azkaban.user.Role; //導入依賴的package包/類
private Permission getPermissionObject(Project project, User user, Permission.Type type) {
Permission perm = project.getCollectivePermission(user);
for(String roleName: user.getRoles()) {
Role role = userManager.getRole(roleName);
perm.addPermissions(role.getPermission());
}
return perm;
}
示例11: hasPermissionToCreateProject
import azkaban.user.Role; //導入依賴的package包/類
private boolean hasPermissionToCreateProject(User user) {
for(String roleName: user.getRoles()) {
Role role = userManager.getRole(roleName);
Permission perm = role.getPermission();
if (perm.isPermissionSet(Permission.Type.ADMIN) || perm.isPermissionSet(Permission.Type.CREATEPROJECTS)) {
return true;
}
}
return false;
}
示例12: hasPermission
import azkaban.user.Role; //導入依賴的package包/類
protected boolean hasPermission(User user, Permission.Type type) {
for(String roleName: user.getRoles()) {
Role role = userManager.getRole(roleName);
if (role.getPermission().isPermissionSet(type) || role.getPermission().isPermissionSet(Permission.Type.ADMIN)) {
return true;
}
}
return false;
}
示例13: hasPermissionToCreateProject
import azkaban.user.Role; //導入依賴的package包/類
private boolean hasPermissionToCreateProject(User user) {
for (String roleName: user.getRoles()) {
Role role = userManager.getRole(roleName);
Permission perm = role.getPermission();
if (perm.isPermissionSet(Permission.Type.ADMIN) ||
perm.isPermissionSet(Permission.Type.CREATEPROJECTS)) {
return true;
}
}
return false;
}
示例14: testGetRole
import azkaban.user.Role; //導入依賴的package包/類
@Test
public void testGetRole() throws Exception {
Role role = userManager.getRole("admin");
assertTrue(role.getPermission().isPermissionNameSet("ADMIN"));
}