From d6cfc7505be13b3b09adf423206cf75d9f806c12 Mon Sep 17 00:00:00 2001 From: Andrew Branson Date: Mon, 18 Feb 2013 15:01:46 +0100 Subject: Initial Interface creation. Some compilation problems remain. --- .../java/com/c2kernel/lookup/LDAPRoleManager.java | 24 ++++++++++++++-------- 1 file changed, 15 insertions(+), 9 deletions(-) (limited to 'src/main/java/com/c2kernel/lookup/LDAPRoleManager.java') 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); -- cgit v1.2.3