本文整理汇总了Java中azkaban.user.Permission.Type方法的典型用法代码示例。如果您正苦于以下问题:Java Permission.Type方法的具体用法?Java Permission.Type怎么用?Java Permission.Type使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类azkaban.user.Permission
的用法示例。
在下文中一共展示了Permission.Type方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: hasPermission
import azkaban.user.Permission; //导入方法依赖的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: getProjectAjaxByPermission
import azkaban.user.Permission; //导入方法依赖的package包/类
protected Project getProjectAjaxByPermission(Map<String, Object> ret,
int projectId, User user, Permission.Type type) {
Project project = projectManager.getProject(projectId);
if (project == null) {
ret.put("error", "Project '" + project + "' not found.");
} else if (!hasPermission(project, user, type)) {
ret.put("error",
"User '" + user.getUserId() + "' doesn't have " + type.name()
+ " permissions on " + project.getName());
} else {
return project;
}
return null;
}
示例3: getProjectPageByPermission
import azkaban.user.Permission; //导入方法依赖的package包/类
protected Project getProjectPageByPermission(Page page, int projectId,
User user, Permission.Type type) {
Project project = projectManager.getProject(projectId);
if (project == null) {
page.add("errorMsg", "Project " + project + " not found.");
} else if (!hasPermission(project, user, type)) {
page.add("errorMsg",
"User " + user.getUserId() + " doesn't have " + type.name()
+ " permissions on " + project.getName());
} else {
return project;
}
return null;
}
示例4: getProjectAjaxByPermission
import azkaban.user.Permission; //导入方法依赖的package包/类
protected Project getProjectAjaxByPermission(Map<String, Object> ret,
String projectName, User user, Permission.Type type) {
Project project = projectManager.getProject(projectName);
if (project == null) {
ret.put("error", "Project '" + project + "' not found.");
} else if (!hasPermission(project, user, type)) {
ret.put("error",
"User '" + user.getUserId() + "' doesn't have " + type.name()
+ " permissions on " + project.getName());
} else {
return project;
}
return null;
}
示例5: hasPermission
import azkaban.user.Permission; //导入方法依赖的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;
}
示例6: getPermissionObject
import azkaban.user.Permission; //导入方法依赖的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;
}
示例7: hasPermission
import azkaban.user.Permission; //导入方法依赖的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: hasPermission
import azkaban.user.Permission; //导入方法依赖的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;
}
示例9: hasPermission
import azkaban.user.Permission; //导入方法依赖的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;
}
示例10: hasPermission
import azkaban.user.Permission; //导入方法依赖的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;
}
示例11: getProjectAjaxByPermission
import azkaban.user.Permission; //导入方法依赖的package包/类
protected Project getProjectAjaxByPermission(Map<String, Object> ret, int projectId, User user, Permission.Type type) {
Project project = projectManager.getProject(projectId);
if (project == null) {
ret.put("error", "Project '" + project + "' not found.");
}
else if (!hasPermission(project, user, type)) {
ret.put("error", "User '" + user.getUserId() + "' doesn't have " + type.name() + " permissions on " + project.getName());
}
else {
return project;
}
return null;
}
示例12: getPermissionObject
import azkaban.user.Permission; //导入方法依赖的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;
}
示例13: hasPermission
import azkaban.user.Permission; //导入方法依赖的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;
}
示例14: getProjectPageByPermission
import azkaban.user.Permission; //导入方法依赖的package包/类
protected Project getProjectPageByPermission(Page page, int projectId, User user, Permission.Type type) {
Project project = projectManager.getProject(projectId);
if (project == null) {
page.add("errorMsg", "Project " + project + " not found.");
}
else if (!hasPermission(project, user, type)) {
page.add("errorMsg", "User " + user.getUserId() + " doesn't have " + type.name() + " permissions on " + project.getName());
}
else {
return project;
}
return null;
}
示例15: getProjectAjaxByPermission
import azkaban.user.Permission; //导入方法依赖的package包/类
protected Project getProjectAjaxByPermission(Map<String, Object> ret, String projectName, User user, Permission.Type type) {
Project project = projectManager.getProject(projectName);
if (project == null) {
ret.put("error", "Project '" + project + "' not found.");
}
else if (!hasPermission(project, user, type)) {
ret.put("error", "User '" + user.getUserId() + "' doesn't have " + type.name() + " permissions on " + project.getName());
}
else {
return project;
}
return null;
}