summaryrefslogtreecommitdiff
path: root/src/main/java/com/c2kernel/lookup/LDAPRoleManager.java
diff options
context:
space:
mode:
authorAndrew Branson <andrew.branson@cern.ch>2013-02-18 15:01:46 +0100
committerAndrew Branson <andrew.branson@cern.ch>2013-03-18 14:03:53 +0100
commitd6cfc7505be13b3b09adf423206cf75d9f806c12 (patch)
tree8689ba2c6fdb7fba16ca7db9f9b11e90c010970b /src/main/java/com/c2kernel/lookup/LDAPRoleManager.java
parent843f2d127ca11a93de706bda4025dd27eeaed97c (diff)
Initial Interface creation. Some compilation problems remain.
Diffstat (limited to 'src/main/java/com/c2kernel/lookup/LDAPRoleManager.java')
-rw-r--r--src/main/java/com/c2kernel/lookup/LDAPRoleManager.java24
1 files changed, 15 insertions, 9 deletions
diff --git a/src/main/java/com/c2kernel/lookup/LDAPRoleManager.java b/src/main/java/com/c2kernel/lookup/LDAPRoleManager.java
index 0536d6c..e046550 100644
--- a/src/main/java/com/c2kernel/lookup/LDAPRoleManager.java
+++ b/src/main/java/com/c2kernel/lookup/LDAPRoleManager.java
@@ -22,7 +22,7 @@ import com.novell.ldap.LDAPSearchConstraints;
**************************************************************************/
// public static final String codeRevision = "$Revision: 1.1 $ $Date: 2005/04/26 06:48:12 $ $Author: abranson $";
-public class LDAPRoleManager {
+public class LDAPRoleManager implements RoleManager {
/**
*
@@ -41,7 +41,8 @@ public class LDAPRoleManager {
//NOTE: A role must have at LEAST 1 userDN, cannot be empty...
//Creates a cristalRole
//CristalRole is-a specialized CristalContext which contains multi-valued uniqueMember attribute pointing to cristalagents
- public RolePath createRole(String roleName, boolean jobList)
+ @Override
+ public RolePath createRole(String roleName, boolean jobList)
throws ObjectAlreadyExistsException, ObjectCannotBeUpdated
{
@@ -74,7 +75,8 @@ public class LDAPRoleManager {
}
}
- protected void addRole(AgentPath agent, RolePath role)
+ @Override
+ public void addRole(AgentPath agent, RolePath role)
throws ObjectCannotBeUpdated, ObjectNotFoundException
{
LDAPEntry roleEntry = LDAPLookupUtils.getEntry(mLdap.getConnection(), role.getFullDN());
@@ -85,7 +87,7 @@ public class LDAPRoleManager {
throw new ObjectCannotBeUpdated("Agent " + agent.getAgentName() + " already has role " + role.getName());
}
- protected void removeRole(AgentPath agent, RolePath role)
+ public void removeRole(AgentPath agent, RolePath role)
throws ObjectCannotBeUpdated, ObjectNotFoundException
{
LDAPEntry roleEntry = LDAPLookupUtils.getEntry(mLdap.getConnection(), role.getFullDN());
@@ -95,7 +97,7 @@ public class LDAPRoleManager {
throw new ObjectCannotBeUpdated("Agent did not have that role");
}
- protected boolean hasRole(AgentPath agent, RolePath role) {
+ public boolean hasRole(AgentPath agent, RolePath role) {
String filter = "(&(objectclass=cristalrole)(uniqueMember="+agent.getFullDN()+")(cn="+role.getName()+"))";
LDAPSearchConstraints searchCons = new LDAPSearchConstraints();
searchCons.setBatchSize(0);
@@ -103,7 +105,8 @@ public class LDAPRoleManager {
return mLdap.search(mRolePath,LDAPConnection.SCOPE_SUB,filter,searchCons).hasMoreElements();
}
- protected AgentPath[] getAgents(RolePath role)
+ @Override
+ public AgentPath[] getAgents(RolePath role)
throws ObjectNotFoundException
{
//get the roleDN entry, and its uniqueMember entry pointing to
@@ -133,7 +136,8 @@ public class LDAPRoleManager {
}
//returns the role/s of a user
- protected RolePath[] getRoles(AgentPath agentPath)
+ @Override
+ public RolePath[] getRoles(AgentPath agentPath)
{
//search the mDomainPath tree uniqueMember=userDN
//filter = objectclass=cristalrole AND uniqueMember=userDN
@@ -163,7 +167,8 @@ public class LDAPRoleManager {
* @return
* @throws ObjectNotFoundException
*/
- public AgentPath getAgentPath(String agentName) throws ObjectNotFoundException
+ @Override
+ public AgentPath getAgentPath(String agentName) throws ObjectNotFoundException
{
//search to get the userDN equivalent of the userID
LDAPSearchConstraints searchCons = new LDAPSearchConstraints();
@@ -180,7 +185,8 @@ public class LDAPRoleManager {
throw new ObjectNotFoundException("Entry was not an Agent");
}
- public RolePath getRolePath(String roleName) throws ObjectNotFoundException
+ @Override
+ public RolePath getRolePath(String roleName) throws ObjectNotFoundException
{
LDAPSearchConstraints searchCons = new LDAPSearchConstraints();
searchCons.setBatchSize(0);