Commit 0d5731ac authored by Jeff Burke's avatar Jeff Burke
Browse files

s1734: added create user, updated get user

parent 8ce3cc90
Loading
Loading
Loading
Loading
+14 −12
Original line number Diff line number Diff line
@@ -132,17 +132,19 @@
        </copy>
    </target>

    <!--<target name="test" depends="compile,compile-test,resources">-->
        <!--<echo message="Running test suite..." />-->
        <!--<junit printsummary="yes" haltonfailure="yes" fork="yes">-->
            <!--<classpath>-->
                <!--<pathelement path="${build}/class"/>-->
                <!--<pathelement path="${build}/test/class"/>-->
                <!--<pathelement path="${testingJars}"/>-->
            <!--</classpath>-->
            <!--<test name="ca.nrc.cadc.ac.server.ldap.LdapGroupDAOTest" />-->
            <!--<formatter type="plain" usefile="false" />-->
        <!--</junit>-->
    <!--</target>-->
    <target name="test" depends="compile,compile-test,resources">
        <echo message="Running test suite..." />
        <junit printsummary="yes" haltonfailure="yes" fork="yes">
            <classpath>
                <pathelement path="${build}/class"/>
                <pathelement path="${build}/test/class"/>
                <pathelement path="${testingJars}"/>
            </classpath>
            <test name="ca.nrc.cadc.ac.server.ldap.LdapUserDAOTest" />
            <!--<test name="ca.nrc.cadc.ac.server.web.users.UserActionFactoryTest" />-->
            <!--<test name="ca.nrc.cadc.ac.server.web.users.UsersActionTest" />-->
            <formatter type="plain" usefile="false" />
        </junit>
    </target>

</project>
+51 −0
Original line number Diff line number Diff line
@@ -78,6 +78,29 @@ import java.util.Collection;

public abstract interface UserPersistence<T extends Principal>
{
    /**
     * Get all user names.
     * 
     * @return A collection of strings.
     * @throws TransientException If an temporary, unexpected problem occurred.
     * @throws AccessControlException If the operation is not permitted.
     */
    public Collection<String> getUserNames()
            throws TransientException, AccessControlException;
    
    /**
     * Add the new user.
     *
     * @param user
     *
     * @return User instance.
     * 
     * @throws TransientException If an temporary, unexpected problem occurred.
     * @throws AccessControlException If the operation is not permitted.
     */
    public abstract User<T> addUser(User<T> user)
        throws TransientException, AccessControlException;
    
    /**
     * Get the user specified by userID.
     *
@@ -93,6 +116,34 @@ public abstract interface UserPersistence<T extends Principal>
        throws UserNotFoundException, TransientException, 
               AccessControlException;
    
    /**
     * Updated the user specified by User.
     *
     * @param user
     *
     * @return User instance.
     * 
     * @throws UserNotFoundException when the user is not found.
     * @throws TransientException If an temporary, unexpected problem occurred.
     * @throws AccessControlException If the operation is not permitted.
     */
    public abstract User<T> modifyUser(User<T> user)
        throws UserNotFoundException, TransientException, 
               AccessControlException;
    
    /**
     * Delete the user specified by userID.
     *
     * @param userID The userID.
     * 
     * @throws UserNotFoundException when the user is not found.
     * @throws TransientException If an temporary, unexpected problem occurred.
     * @throws AccessControlException If the operation is not permitted.
     */
    public abstract void deleteUser(T userID)
        throws UserNotFoundException, TransientException, 
               AccessControlException;
    
    /**
     * Get all groups the user specified by userID belongs to.
     * 
+15 −9
Original line number Diff line number Diff line
@@ -68,21 +68,27 @@
 */
package ca.nrc.cadc.ac.server.ldap;

import ca.nrc.cadc.auth.HttpPrincipal;
import ca.nrc.cadc.auth.NumericPrincipal;
import ca.nrc.cadc.auth.OpenIdPrincipal;
import ca.nrc.cadc.net.TransientException;
import com.unboundid.ldap.sdk.DN;
import com.unboundid.ldap.sdk.LDAPConnection;
import com.unboundid.ldap.sdk.LDAPException;
import com.unboundid.ldap.sdk.ResultCode;
import com.unboundid.ldap.sdk.SearchResult;
import com.unboundid.ldap.sdk.SearchScope;
import java.security.AccessControlException;
import java.security.AccessController;
import java.security.GeneralSecurityException;
import java.security.Principal;
import java.util.Set;
import javax.net.SocketFactory;
import javax.net.ssl.SSLSocketFactory;
import javax.security.auth.Subject;
import javax.security.auth.x500.X500Principal;

import org.apache.log4j.Logger;

import java.security.*;
import java.util.Set;

import com.unboundid.ldap.sdk.*;

import ca.nrc.cadc.auth.*;
import ca.nrc.cadc.net.TransientException;


public abstract class LdapDAO
{
+273 −77

File changed.

Preview size limit exceeded, changes collapsed.

+107 −0

File changed.

Preview size limit exceeded, changes collapsed.

Loading