import org.osgi.service.useradmin.Role;
-public class LdifGroup extends LdifUser implements DirectoryGroup {
+/** Directory group implementation */
+class LdifGroup extends LdifUser implements DirectoryGroup {
private final String memberAttributeId;
- public LdifGroup(AbstractUserDirectory userAdmin, LdapName dn,
+ LdifGroup(AbstractUserDirectory userAdmin, LdapName dn,
Attributes attributes) {
super(userAdmin, dn, attributes);
memberAttributeId = userAdmin.getMemberAttributeId();
@Override
public boolean addMember(Role role) {
+ getUserAdmin().checkEdit();
+ if (!isEditing())
+ startEditing();
+
Attribute member = getAttributes().get(memberAttributeId);
if (member != null) {
if (member.contains(role.getName()))
return false;
+ else
+ member.add(role.getName());
} else
getAttributes().put(memberAttributeId, role.getName());
return true;
@Override
public boolean removeMember(Role role) {
+ getUserAdmin().checkEdit();
+ if (!isEditing())
+ startEditing();
+
Attribute member = getAttributes().get(memberAttributeId);
if (member != null) {
if (!member.contains(role.getName()))