@Test public void hasAnyProjectPermission() { Authentication authentication = mockAuthentication(new PermissionGrantedAuthority( new GrantedAuthorityTarget("project", Type.PROJECT), Permission.EDIT_PAGE)); assertTrue(permissionEvaluator.hasAnyProjectPermission( authentication, Permission.EDIT_PAGE)); }
public boolean hasAnyProjectPermission(Authentication authentication, Permission permission) { for (GrantedAuthority authority : authentication.getAuthorities()) { if (authority instanceof PermissionGrantedAuthority) { PermissionGrantedAuthority pga = (PermissionGrantedAuthority) authority; GrantedAuthorityTarget target = pga.getTarget(); Type type = target.getType(); if ((type == Type.PROJECT) && hasPermission(pga, permission)) { return true; } } } return hasApplicationPermission(authentication, permission); }
DocumentrPermissionEvaluator implements PermissionEvaluator { public boolean hasAnyProjectPermission(Authentication authentication, Permission permission) { for (GrantedAuthority authority : authentication.getAuthorities()) { if (authority instanceof PermissionGrantedAuthority) { PermissionGrantedAuthority pga = (PermissionGrantedAuthority) authority; GrantedAuthorityTarget target = pga.getTarget(); Type type = target.getType(); if ((type == Type.PROJECT) && hasPermission(pga, permission)) { return true; } } } return hasApplicationPermission(authentication, permission); } }
DocumentrPermissionEvaluator implements PermissionEvaluator { public boolean hasAnyProjectPermission(Authentication authentication, Permission permission) { for (GrantedAuthority authority : authentication.getAuthorities()) { if (authority instanceof PermissionGrantedAuthority) { PermissionGrantedAuthority pga = (PermissionGrantedAuthority) authority; GrantedAuthorityTarget target = pga.getTarget(); Type type = target.getType(); if ((type == Type.PROJECT) && hasPermission(pga, permission)) { return true; } } } return hasApplicationPermission(authentication, permission); }  }
DocumentrPermissionEvaluator implements PermissionEvaluator { public boolean hasAnyProjectPermission(Authentication authentication, Permission permission) { for (GrantedAuthority authority : authentication.getAuthorities()) { if (authority instanceof PermissionGrantedAuthority) { PermissionGrantedAuthority pga = (PermissionGrantedAuthority) authority; GrantedAuthorityTarget target = pga.getTarget(); Type type = target.getType(); if ((type == Type.PROJECT) && hasPermission(pga, permission)) { return true; } } } return hasApplicationPermission(authentication, permission); }  @Override boolean hasPermission(Authentication authentication, Object targetDomainObject, Object permission); @Override boolean hasPermission(Authentication authentication, Serializable targetId, String targetType,
			Object permission); boolean hasApplicationPermission(Authentication authentication, Permission permission); boolean hasProjectPermission(Authentication authentication, String projectName, Permission permission); boolean hasAnyProjectPermission(Authentication authentication, Permission permission); boolean hasBranchPermission(Authentication authentication, String projectName, String branchName,
			Permission permission); boolean hasAnyBranchPermission(Authentication authentication, String projectName, Permission permission); boolean hasPagePermission(Authentication authentication, String projectName, String branchName,
			String path, Permission permission); boolean hasPagePermissionInOtherBranches(Authentication authentication, String projectName,
			String branchName, String path, Permission permission); Set<String> getBranchesForPermission(Authentication authentication, Permission permission); boolean isAdmin(String loginName); boolean isLastAdminRole(String roleName); }
DocumentrPermissionEvaluator implements PermissionEvaluator { public boolean hasAnyProjectPermission(Authentication authentication, Permission permission) { for (GrantedAuthority authority : authentication.getAuthorities()) { if (authority instanceof PermissionGrantedAuthority) { PermissionGrantedAuthority pga = (PermissionGrantedAuthority) authority; GrantedAuthorityTarget target = pga.getTarget(); Type type = target.getType(); if ((type == Type.PROJECT) && hasPermission(pga, permission)) { return true; } } } return hasApplicationPermission(authentication, permission); }  @Override boolean hasPermission(Authentication authentication, Object targetDomainObject, Object permission); @Override boolean hasPermission(Authentication authentication, Serializable targetId, String targetType,
			Object permission); boolean hasApplicationPermission(Authentication authentication, Permission permission); boolean hasProjectPermission(Authentication authentication, String projectName, Permission permission); boolean hasAnyProjectPermission(Authentication authentication, Permission permission); boolean hasBranchPermission(Authentication authentication, String projectName, String branchName,
			Permission permission); boolean hasAnyBranchPermission(Authentication authentication, String projectName, Permission permission); boolean hasPagePermission(Authentication authentication, String projectName, String branchName,
			String path, Permission permission); boolean hasPagePermissionInOtherBranches(Authentication authentication, String projectName,
			String branchName, String path, Permission permission); Set<String> getBranchesForPermission(Authentication authentication, Permission permission); boolean isAdmin(String loginName); boolean isLastAdminRole(String roleName);  }