@Test public void testGetPrincipalsToCheck() { NuxeoPrincipal principal = new UserPrincipal("bob", Arrays.asList("vps", "males"), false, false); String[] principals = SecurityService.getPrincipalsToCheck(principal); assertEquals(4, principals.length); assertTrue(Arrays.asList(principals).contains("bob")); assertTrue(Arrays.asList(principals).contains("vps")); assertTrue(Arrays.asList(principals).contains("males")); assertTrue(Arrays.asList(principals).contains(SecurityConstants.EVERYONE)); }
public static String[] getPrincipalsToCheck(NuxeoPrincipal principal) { List<String> userGroups = principal.getAllGroups(); if (userGroups == null) { return new String[] { principal.getName(), SecurityConstants.EVERYONE }; } else { int size = userGroups.size(); String[] groups = new String[size + 2]; userGroups.toArray(groups); groups[size] = principal.getName(); groups[size + 1] = SecurityConstants.EVERYONE; return groups; } }
SecurityService extends DefaultComponent { public static String[] getPrincipalsToCheck(NuxeoPrincipal principal) { List<String> userGroups = principal.getAllGroups(); if (userGroups == null) { return new String[] { principal.getName(), SecurityConstants.EVERYONE }; } else { int size = userGroups.size(); String[] groups = new String[size + 2]; userGroups.toArray(groups); groups[size] = principal.getName(); groups[size + 1] = SecurityConstants.EVERYONE; return groups; } } }
SecurityService extends DefaultComponent { public static String[] getPrincipalsToCheck(NuxeoPrincipal principal) { List<String> userGroups = principal.getAllGroups(); if (userGroups == null) { return new String[] { principal.getName(), SecurityConstants.EVERYONE }; } else { int size = userGroups.size(); String[] groups = new String[size + 2]; userGroups.toArray(groups); groups[size] = principal.getName(); groups[size + 1] = SecurityConstants.EVERYONE; return groups; } }  }
SecurityService extends DefaultComponent { public static String[] getPrincipalsToCheck(NuxeoPrincipal principal) { List<String> userGroups = principal.getAllGroups(); if (userGroups == null) { return new String[] { principal.getName(), SecurityConstants.EVERYONE }; } else { int size = userGroups.size(); String[] groups = new String[size + 2]; userGroups.toArray(groups); groups[size] = principal.getName(); groups[size + 1] = SecurityConstants.EVERYONE; return groups; } }  @Override void activate(ComponentContext context); @Override void deactivate(ComponentContext context); @Override void registerContribution(Object contribution, String extensionPoint, ComponentInstance contributor); @Override void unregisterContribution(Object contribution, String extensionPoint, ComponentInstance contributor); PermissionProvider getPermissionProvider(); boolean arePoliciesRestrictingPermission(String permission); boolean arePoliciesExpressibleInQuery(String repositoryName); Collection<SQLQuery.Transformer> getPoliciesQueryTransformers(String repositoryName); boolean checkPermission(Document doc, NuxeoPrincipal principal, String permission); Collection<String> filterGrantedPermissions(Document doc, NuxeoPrincipal principal,
            Collection<String> permissions); String[] getPermissionsToCheck(String permission); static String[] getPrincipalsToCheck(NuxeoPrincipal principal); @SuppressWarnings("unchecked") @Override T getAdapter(Class<T> adapter); }
SecurityService extends DefaultComponent { public static String[] getPrincipalsToCheck(NuxeoPrincipal principal) { List<String> userGroups = principal.getAllGroups(); if (userGroups == null) { return new String[] { principal.getName(), SecurityConstants.EVERYONE }; } else { int size = userGroups.size(); String[] groups = new String[size + 2]; userGroups.toArray(groups); groups[size] = principal.getName(); groups[size + 1] = SecurityConstants.EVERYONE; return groups; } }  @Override void activate(ComponentContext context); @Override void deactivate(ComponentContext context); @Override void registerContribution(Object contribution, String extensionPoint, ComponentInstance contributor); @Override void unregisterContribution(Object contribution, String extensionPoint, ComponentInstance contributor); PermissionProvider getPermissionProvider(); boolean arePoliciesRestrictingPermission(String permission); boolean arePoliciesExpressibleInQuery(String repositoryName); Collection<SQLQuery.Transformer> getPoliciesQueryTransformers(String repositoryName); boolean checkPermission(Document doc, NuxeoPrincipal principal, String permission); Collection<String> filterGrantedPermissions(Document doc, NuxeoPrincipal principal,
            Collection<String> permissions); String[] getPermissionsToCheck(String permission); static String[] getPrincipalsToCheck(NuxeoPrincipal principal); @SuppressWarnings("unchecked") @Override T getAdapter(Class<T> adapter); static final ComponentName NAME; static final String PERMISSIONS_EXTENSION_POINT; }