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


Java Project.getUserPermissions方法代码示例

本文整理汇总了Java中azkaban.project.Project.getUserPermissions方法的典型用法代码示例。如果您正苦于以下问题:Java Project.getUserPermissions方法的具体用法?Java Project.getUserPermissions怎么用?Java Project.getUserPermissions使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在azkaban.project.Project的用法示例。


在下文中一共展示了Project.getUserPermissions方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: toSimplifiedProjects

import azkaban.project.Project; //导入方法依赖的package包/类
/**
 * A simple helper method that converts a List<Project> to List<SimplifiedProject>
 * 
 * @param projects
 * @return
 */
private List<SimplifiedProject> toSimplifiedProjects(List<Project> projects) {
  List<SimplifiedProject> simplifiedProjects = new ArrayList<>();
  for (Project p : projects) {
    SimplifiedProject sp =
        new SimplifiedProject(p.getId(), p.getName(),
            p.getLastModifiedUser(), p.getCreateTimestamp(),
            p.getUserPermissions(), p.getGroupPermissions());
    simplifiedProjects.add(sp);
  }
  return simplifiedProjects;
}
 
开发者ID:JasonBian,项目名称:azkaban,代码行数:18,代码来源:ProjectServlet.java

示例2: ajaxGetPermissions

import azkaban.project.Project; //导入方法依赖的package包/类
private void ajaxGetPermissions(Project project, HashMap<String, Object> ret) {
	ArrayList<HashMap<String, Object>> permissions = new ArrayList<HashMap<String, Object>>();
	for(Pair<String, Permission> perm: project.getUserPermissions()) {
		HashMap<String, Object> permObj = new HashMap<String, Object>();
		String userId = perm.getFirst();
		permObj.put("username", userId);
		permObj.put("permission", perm.getSecond().toStringArray());
		
		permissions.add(permObj);
	}
	
	ret.put("permissions", permissions);
}
 
开发者ID:zhizhounq,项目名称:azkaban-customization,代码行数:14,代码来源:ProjectManagerServlet.java

示例3: handlePermissionPage

import azkaban.project.Project; //导入方法依赖的package包/类
private void handlePermissionPage(HttpServletRequest req, HttpServletResponse resp, Session session) throws ServletException {
	Page page = newPage(req, resp, session, "azkaban/webapp/servlet/velocity/permissionspage.vm");
	String projectName = getParam(req, "project");
	User user = session.getUser();
	
	Project project = null;
	try {
		project = projectManager.getProject(projectName);
		if (project == null) {
			page.add("errorMsg", "Project " + projectName + " not found.");
		}
		else {
			if (!hasPermission(project, user, Type.READ)) {
				throw new AccessControlException( "No permission to view project " + projectName + ".");
			}
			
			page.add("project", project);
			page.add("username", user.getUserId());
			page.add("admins", Utils.flattenToString(project.getUsersWithPermission(Type.ADMIN), ","));
			Permission perm = this.getPermissionObject(project, user, Type.ADMIN);
			page.add("userpermission", perm);

			if (perm.isPermissionSet(Type.ADMIN)) {
				page.add("admin", true);
			}

			List<Pair<String, Permission>> userPermission = project.getUserPermissions();
			if (userPermission != null && !userPermission.isEmpty()) {
				page.add("permissions", userPermission);
			}
			
			List<Pair<String, Permission>> groupPermission = project.getGroupPermissions();
			if (groupPermission != null && !groupPermission.isEmpty()) {
				page.add("groupPermissions", groupPermission);
			}
			
			Set<String> proxyUsers = project.getProxyUsers();
			if (proxyUsers != null && !proxyUsers.isEmpty()) {
				page.add("proxyUsers", proxyUsers);
			}
			
			if(hasPermission(project, user, Type.ADMIN)) {
				page.add("isAdmin", true);
			}
		}
	}
	catch(AccessControlException e) {
		page.add("errorMsg", e.getMessage());
	}
	
	page.render();
}
 
开发者ID:zhizhounq,项目名称:azkaban-customization,代码行数:53,代码来源:ProjectManagerServlet.java


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