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
7b2d94d0
Commit
7b2d94d0
authored
9 years ago
by
Brian Major
Browse files
Options
Downloads
Patches
Plain Diff
s1890 - moved refliction field setting method to cadcUtil
parent
18fe2524
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
cadcAccessControl-Server/src/ca/nrc/cadc/ac/server/ldap/LdapUserDAO.java
+4
-27
4 additions, 27 deletions
...ol-Server/src/ca/nrc/cadc/ac/server/ldap/LdapUserDAO.java
with
4 additions
and
27 deletions
cadcAccessControl-Server/src/ca/nrc/cadc/ac/server/ldap/LdapUserDAO.java
+
4
−
27
View file @
7b2d94d0
...
...
@@ -68,7 +68,6 @@
*/
package
ca.nrc.cadc.ac.server.ldap
;
import
java.lang.reflect.Field
;
import
java.net.URI
;
import
java.net.URISyntaxException
;
import
java.security.AccessControlException
;
...
...
@@ -102,6 +101,7 @@ import ca.nrc.cadc.auth.HttpPrincipal;
import
ca.nrc.cadc.auth.NumericPrincipal
;
import
ca.nrc.cadc.net.TransientException
;
import
ca.nrc.cadc.profiler.Profiler
;
import
ca.nrc.cadc.util.ObjectUtil
;
import
ca.nrc.cadc.util.StringUtil
;
import
com.unboundid.ldap.sdk.AddRequest
;
...
...
@@ -576,7 +576,7 @@ public class LdapUserDAO extends LdapDAO
}
InternalID
internalID
=
getInternalID
(
uid
);
setField
(
user
,
internalID
,
USER_ID
);
ObjectUtil
.
setField
(
user
,
internalID
,
USER_ID
);
user
.
getIdentities
().
add
(
new
NumericPrincipal
(
internalID
.
getUUID
()));
String
x500str
=
searchResult
.
getAttributeValue
(
userLdapAttrib
.
get
(
X500Principal
.
class
));
...
...
@@ -699,7 +699,7 @@ public class LdapUserDAO extends LdapDAO
// Set the User's private InternalID field
InternalID
internalID
=
getInternalID
(
numericID
);
setField
(
user
,
internalID
,
USER_ID
);
ObjectUtil
.
setField
(
user
,
internalID
,
USER_ID
);
user
.
getIdentities
().
add
(
new
NumericPrincipal
(
internalID
.
getUUID
()));
String
x500str
=
searchResult
.
getAttributeValue
(
userLdapAttrib
.
get
(
X500Principal
.
class
));
...
...
@@ -761,7 +761,7 @@ public class LdapUserDAO extends LdapDAO
logger
.
debug
(
"numericID is "
+
numericID
);
InternalID
internalID
=
getInternalID
(
numericID
);
setField
(
user
,
internalID
,
USER_ID
);
ObjectUtil
.
setField
(
user
,
internalID
,
USER_ID
);
user
.
getIdentities
().
add
(
new
NumericPrincipal
(
internalID
.
getUUID
()));
String
dn
=
searchResult
.
getAttributeValue
(
LDAP_DISTINGUISHED_NAME
);
...
...
@@ -1400,27 +1400,4 @@ public class LdapUserDAO extends LdapDAO
return
new
InternalID
(
uri
);
}
// set private field using reflection
private
void
setField
(
Object
object
,
Object
value
,
String
name
)
{
try
{
Field
field
=
object
.
getClass
().
getDeclaredField
(
name
);
field
.
setAccessible
(
true
);
field
.
set
(
object
,
value
);
}
catch
(
NoSuchFieldException
e
)
{
final
String
error
=
object
.
getClass
().
getSimpleName
()
+
" field "
+
name
+
"not found"
;
throw
new
RuntimeException
(
error
,
e
);
}
catch
(
IllegalAccessException
e
)
{
final
String
error
=
"unable to update "
+
name
+
" in "
+
object
.
getClass
().
getSimpleName
();
throw
new
RuntimeException
(
error
,
e
);
}
}
}
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