19 package org.turro.security;
22 import java.nio.file.Path;
23 import java.util.Collection;
24 import java.util.HashMap;
27 import org.turro.elephant.context.ElephantContext;
28 import org.turro.lock.Initializer;
42 public static Collection<SecurityGroup>
getAll() {
54 flatSocials.add(sg.
getId());
62 return socialGroups.values().stream().anyMatch(social -> social.getTags().contains(tag));
67 private static final Initializer<SecurityGroups> INIT =
new Initializer<>();
82 private static final String
83 SOCIAL_GROUP_FOLDER =
"/WEB-INF/elephant/socials";
85 private void loadMap() {
88 for(File f : root.listFiles()) {
95 private void saveSet() {
97 File file = Path.of(ElephantContext.getRealPath(SOCIAL_GROUP_FOLDER), entry.getKey() +
".el").toFile();
98 SecurityGroup.saveTo(file, entry.getValue());
static String getRealPath(String path)
Set< String > getSyndicate()
static SecurityGroup loadFrom(File file)
static SecurityGroups instance()
final Map< String, SecurityGroup > socialGroups
SecurityGroup getSocialGroup(String id)
static Collection< SecurityGroup > getAll()
boolean possibleTag(String tag)
void recurseSocialGroups(Set< String > flatSocials, SecurityGroup sg)