Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
A
ac
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Container Registry
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
OATS-CADC
ac
Commits
fcd9bc98
Commit
fcd9bc98
authored
10 years ago
by
Adrian Damian
Browse files
Options
Downloads
Patches
Plain Diff
Fixed a problem with member groups
parent
4c72ca86
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
projects/cadcAccessControl-Server/src/ca/nrc/cadc/ac/server/ldap/LdapGroupDAO.java
+52
-9
52 additions, 9 deletions
...l-Server/src/ca/nrc/cadc/ac/server/ldap/LdapGroupDAO.java
with
52 additions
and
9 deletions
projects/cadcAccessControl-Server/src/ca/nrc/cadc/ac/server/ldap/LdapGroupDAO.java
+
52
−
9
View file @
fcd9bc98
...
...
@@ -538,18 +538,13 @@ public class LdapGroupDAO<T extends Principal> extends LdapDAO
try
{
ldapGroup
.
getGroupMembers
().
add
(
getGroup
(
memberDN
));
add
(
new
Group
(
getGroup
ID
(
memberDN
))
)
;
}
catch
(
GroupNotFoundException
e
)
{
// ignore as we are not cleaning up
// deleted groups from the group members
}
catch
(
UserNotFoundException
e
)
{
throw
new
RuntimeException
(
"BUG: group owner not found"
);
}
}
else
{
...
...
@@ -922,13 +917,14 @@ public class LdapGroupDAO<T extends Principal> extends LdapDAO
}
/**
* Returns a group based on its LDAP DN. The returned group
is bare
*
(contains only group ID, description, modifytimestamp).
* Returns a group based on its LDAP DN. The returned group
does not contain
*
members or admins
*
* @param groupDN
* @return
* @throws com.unboundid.ldap.sdk.LDAPException
* @throws ca.nrc.cadc.ac.GroupNotFoundException
* @throws ca.nrc.cadc.ac.GroupNotFoundException - if group does not exist,
* it's deleted or caller has no access to it.
*/
protected
Group
getGroup
(
final
DN
groupDN
)
throws
LDAPException
,
GroupNotFoundException
,
UserNotFoundException
...
...
@@ -970,6 +966,53 @@ public class LdapGroupDAO<T extends Principal> extends LdapDAO
return
group
;
}
/**
* Returns a group ID corresponding to a DN. Although the groupID can be
* deduced from the group DN, this method checks if the group exists and
* it's active and throws an exception if any of those conditions are not
* met.
*
* @param groupDN
* @return
* @throws com.unboundid.ldap.sdk.LDAPException
* @throws ca.nrc.cadc.ac.GroupNotFoundException - Group not found or not
* active
*/
protected
String
getGroupID
(
final
DN
groupDN
)
throws
LDAPException
,
GroupNotFoundException
{
Filter
filter
=
Filter
.
createEqualityFilter
(
"entrydn"
,
groupDN
.
toNormalizedString
());
SearchRequest
searchRequest
=
new
SearchRequest
(
config
.
getGroupsDN
(),
SearchScope
.
SUB
,
filter
,
"cn"
,
"nsaccountlock"
);
searchRequest
.
addControl
(
new
ProxiedAuthorizationV2RequestControl
(
"dn:"
+
getSubjectDN
().
toNormalizedString
()));
SearchResultEntry
searchResult
=
getConnection
().
searchForEntry
(
searchRequest
);
if
(
searchResult
==
null
)
{
String
msg
=
"Group not found "
+
groupDN
;
logger
.
debug
(
msg
);
throw
new
GroupNotFoundException
(
groupDN
.
toNormalizedString
());
}
if
(
searchResult
.
getAttribute
(
"nsaccountlock"
)
!=
null
)
{
// deleted group
String
msg
=
"Group not found "
+
groupDN
;
logger
.
debug
(
msg
);
throw
new
GroupNotFoundException
(
groupDN
.
toNormalizedString
());
}
return
searchResult
.
getAttributeValue
(
"cn"
);
}
/**
*
* @param groupID
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment