19 package org.turro.security;
22 import java.io.FileReader;
23 import java.io.FileWriter;
24 import java.io.IOException;
25 import java.io.Reader;
26 import java.io.Writer;
27 import java.util.HashSet;
28 import java.util.Objects;
30 import java.util.logging.Level;
31 import java.util.logging.Logger;
32 import org.turro.string.Strings;
33 import org.turro.configuration.JsonConfiguration;
34 import org.turro.util.Comparison;
42 private String id, name;
43 private boolean inherits;
45 private final Set<String> syndicate =
new HashSet<>();
46 private final Set<AllowedGroup> allowed =
new HashSet<>();
47 private final Set<String> roles =
new HashSet<>();
48 private final Set<String> tags =
new HashSet<>();
71 this.inherits = inherits;
100 private void prepareSaving() {
102 getAllowed().removeIf(a -> Strings.isBlank(a.getId()));
106 try(Reader reader =
new FileReader(file)) {
108 }
catch (IOException ex) {
115 try(Writer writer =
new FileWriter(file)) {
116 socialGroup.prepareSaving();
117 JsonConfiguration.write(writer, socialGroup);
118 }
catch (IOException ex) {
125 public static final String
127 ADMIN_AUXILIAR=
"admin_auxiliar",
128 ADMINISTRATION=
"administration",
129 ATTACH_ADMIN=
"attach_admin",
130 BRIGHTSIDE_ADMIN=
"brightside_admin",
132 COLLABORATOR=
"collaborator",
133 COLLABORATOR_PRIVILEGED=
"collaborator_privileged",
134 COMERCIAL=
"comercial",
135 COMERCIAL_DIR_ASSISTANT=
"comercial_dir_assistant",
136 COMERCIAL_DIRECTION=
"comercial_direction",
137 COMPUTER_MANAGER=
"computer_manager",
138 CONTACTS_ADMIN=
"contacts_admin",
139 CONTENT_ADMIN=
"content_admin",
140 CONSULTANT=
"consultant",
141 COUNSELOR=
"counselor",
143 CUSTOMER_PRIVILEGED=
"customer_privileged",
144 DIRECTION=
"direction",
145 DIRECTION_ASSISTANT=
"direction_assistant",
146 DIRECTORY=
"directory",
147 DOSSIER_ADMIN=
"dossier_admin",
149 EVENT_ASSISTANT=
"event_assistant",
150 FINANCIALS_ADMIN=
"financials_admin",
151 GROUPCOMPANY=
"groupcompany",
155 HUB_SUPPORT=
"hub-support",
157 MARKETING=
"marketing",
158 MARKETPLACE=
"marketplace",
163 PROVIDER_PRIVILEGED=
"provider_privileged",
164 RESEARCHER=
"researcher",
165 STUDENT_ADMIN=
"student_admin",
166 TECHPARTNER=
"techpartner",
167 TESTIMONIAL=
"testimonial",
168 WEB_ADMIN=
"web_admin";
174 return Comparison.ascendant().compare(
id, o.id).get();
182 hash = 37 * hash + Objects.hashCode(this.
id);
194 if (getClass() != obj.getClass()) {
198 return Objects.
equals(this.
id, other.id);
void setType(SecurityGroupType type)
int compareTo(SecurityGroup o)
static void saveTo(File file, SecurityGroup socialGroup)
static final String ACCOUNT_AUXILIAR
Set< String > getSyndicate()
void setInherits(boolean inherits)
Set< AllowedGroup > getAllowed()
void setName(String name)
static SecurityGroup loadFrom(File file)
SecurityGroupType getType()
boolean equals(Object obj)