當前位置: 首頁>>代碼示例>>Java>>正文


Java Role類代碼示例

本文整理匯總了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;
}
 
開發者ID:JasonBian,項目名稱:azkaban,代碼行數:18,代碼來源:ResourceUtils.java

示例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;
}
 
開發者ID:zhizhounq,項目名稱:azkaban-customization,代碼行數:17,代碼來源:LoginAbstractAzkabanServlet.java

示例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;
}
 
開發者ID:JasonBian,項目名稱:azkaban,代碼行數:12,代碼來源:ProjectManagerServlet.java

示例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;
}
 
開發者ID:JasonBian,項目名稱:azkaban,代碼行數:13,代碼來源:ProjectManagerServlet.java

示例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;
}
 
開發者ID:JasonBian,項目名稱:azkaban,代碼行數:12,代碼來源:ProjectManagerServlet.java

示例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;
}
 
開發者ID:JasonBian,項目名稱:azkaban,代碼行數:10,代碼來源:StatsServlet.java

示例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;
}
 
開發者ID:JasonBian,項目名稱:azkaban,代碼行數:12,代碼來源:JMXHttpServlet.java

示例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;
}
 
開發者ID:JasonBian,項目名稱:azkaban,代碼行數:13,代碼來源:ProjectServlet.java

示例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;
}
 
開發者ID:JasonBian,項目名稱:azkaban,代碼行數:20,代碼來源:HttpRequestUtils.java

示例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;
}
 
開發者ID:zhizhounq,項目名稱:azkaban-customization,代碼行數:11,代碼來源:ProjectManagerServlet.java

示例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;
}
 
開發者ID:zhizhounq,項目名稱:azkaban-customization,代碼行數:12,代碼來源:ProjectManagerServlet.java

示例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;
}
 
開發者ID:zhizhounq,項目名稱:azkaban-customization,代碼行數:11,代碼來源:JMXHttpServlet.java

示例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;
}
 
開發者ID:zhizhounq,項目名稱:azkaban-customization,代碼行數:13,代碼來源:ProjectServlet.java

示例14: testGetRole

import azkaban.user.Role; //導入依賴的package包/類
@Test
public void testGetRole() throws Exception {
    Role role = userManager.getRole("admin");

    assertTrue(role.getPermission().isPermissionNameSet("ADMIN"));
}
 
開發者ID:Codefor,項目名稱:azkaban-ldap-usermanager,代碼行數:7,代碼來源:LdapUserManagerTest.java


注:本文中的azkaban.user.Role類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。