import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.argeo.naming.LdapAttrs;
-import org.argeo.naming.LdapObjs;
import org.osgi.framework.Filter;
import org.osgi.framework.FrameworkUtil;
import org.osgi.framework.InvalidSyntaxException;
private void collectRoles(DirectoryUser user, List<Role> allRoles) {
Attributes attrs = user.getAttributes();
// TODO centralize attribute name
- Attribute memberOf = attrs.get("memberOf");
+ Attribute memberOf = attrs.get(LdapAttrs.memberOf.name());
if (memberOf != null) {
try {
NamingEnumeration<?> values = memberOf.getAll();
AbstractUserDirectory scopedUserAdmin = scope(user);
try {
DirectoryUser directoryUser = (DirectoryUser) scopedUserAdmin.getRole(user.getName());
+ if (directoryUser == null)
+ throw new UserDirectoryException("No scoped user found for " + user);
LdifAuthorization authorization = new LdifAuthorization(directoryUser,
scopedUserAdmin.getAllRoles(directoryUser));
return authorization;
return uri;
}
- // protected List<String> getIndexedUserProperties() {
- // return indexedUserProperties;
- // }
- //
- // protected void setIndexedUserProperties(List<String>
- // indexedUserProperties) {
- // this.indexedUserProperties = indexedUserProperties;
- // }
-
private static boolean readOnlyDefault(URI uri) {
if (uri == null)
return true;
return !file.canWrite();
else
return !file.getParentFile().canWrite();
+ } else if (uri.getScheme().equals("ldap")) {
+ if (uri.getAuthority() != null)// assume writable if authenticated
+ return false;
}
- return true;
+ return true;// read only by default
}
public boolean isReadOnly() {