当前位置: 首页>>代码示例>>Java>>正文


Java Permission.Type方法代码示例

本文整理汇总了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;
}
 
开发者ID:JasonBian,项目名称:azkaban,代码行数:18,代码来源:ResourceUtils.java

示例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;
}
 
开发者ID:JasonBian,项目名称:azkaban,代码行数:17,代码来源:ScheduleServlet.java

示例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;
}
 
开发者ID:JasonBian,项目名称:azkaban,代码行数:17,代码来源:ExecutorServlet.java

示例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;
}
 
开发者ID:JasonBian,项目名称:azkaban,代码行数:17,代码来源:ExecutorServlet.java

示例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;
}
 
开发者ID:zhizhounq,项目名称:azkaban-customization,代码行数:17,代码来源:LoginAbstractAzkabanServlet.java

示例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;
}
 
开发者ID:JasonBian,项目名称:azkaban,代码行数:12,代码来源:ProjectManagerServlet.java

示例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;
}
 
开发者ID:JasonBian,项目名称:azkaban,代码行数:12,代码来源:ProjectManagerServlet.java

示例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;
}
 
开发者ID:JasonBian,项目名称:azkaban,代码行数:10,代码来源:StatsServlet.java

示例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;
}
 
开发者ID:JasonBian,项目名称:azkaban,代码行数:12,代码来源:JMXHttpServlet.java

示例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;
}
 
开发者ID:JasonBian,项目名称:azkaban,代码行数:20,代码来源:HttpRequestUtils.java

示例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;
}
 
开发者ID:zhizhounq,项目名称:azkaban-customization,代码行数:16,代码来源:ScheduleServlet.java

示例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;
}
 
开发者ID:zhizhounq,项目名称:azkaban-customization,代码行数:11,代码来源:ProjectManagerServlet.java

示例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;
}
 
开发者ID:zhizhounq,项目名称:azkaban-customization,代码行数:11,代码来源:JMXHttpServlet.java

示例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;
}
 
开发者ID:zhizhounq,项目名称:azkaban-customization,代码行数:16,代码来源:ExecutorServlet.java

示例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;
}
 
开发者ID:zhizhounq,项目名称:azkaban-customization,代码行数:16,代码来源:ExecutorServlet.java


注:本文中的azkaban.user.Permission.Type方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。