/** * Begin granting a set of permissions. * Note that grants cannot be subsequently revoked, but you could reset the strategy to a newly configured one. * @param permissions which permissions to grant ({@link Permission#impliedBy} is honored) */ public Grant grant(Permission... permissions) { Set<Permission> effective = new HashSet<Permission>(Arrays.asList(permissions)); boolean added = true; while (added) { added = false; for (Permission p : Permission.getAll()) { added |= effective.contains(p.impliedBy) && effective.add(p); } } return new Grant(effective); }