Package org.apache.james.services

Examples of org.apache.james.services.JamesUser


        if ((argument == null) || (argument.equals(""))) {
            writeLoggedFlushedResponse("Usage: unsetalias [username]");
            return true;
        }
        String username = argument;
        JamesUser user = (JamesUser) users.getUserByName(username);
        if (user == null) {
            writeLoggedResponse("No such user " + username);
        } else if (user.getAliasing()){
            user.setAliasing(false);
            users.updateUser(user);
            StringBuffer responseBuffer =
                new StringBuffer(64)
                        .append("Alias for ")
                        .append(username)
View Full Code Here


        if ((argument == null) || (argument.equals(""))) {
            writeLoggedFlushedResponse("Usage: unsetforwarding [username]");
            return true;
        }
        String username = argument;
        JamesUser user = (JamesUser) users.getUserByName(username);
        if (user == null) {
            writeLoggedFlushedResponse("No such user " + username);
        } else if (user.getForwarding()){
            user.setForwarding(false);
            users.updateUser(user);
            StringBuffer responseBuffer =
                new StringBuffer(64)
                        .append("Forward for ")
                        .append(username)
View Full Code Here

     */
    protected String getPrimaryName(String originalUsername) {
        String username;
        try {
            username = localusers.getRealName(originalUsername);
            JamesUser user = (JamesUser) localusers.getUserByName(username);
            if (user.getAliasing()) {
                username = user.getAlias();
            }
        }
        catch (Exception e) {
            username = originalUsername;
        }
View Full Code Here

     */
    protected String getPrimaryName(String originalUsername) {
        String username;
        try {
            username = localusers.getRealName(originalUsername);
            JamesUser user = (JamesUser) localusers.getUserByName(username);
            if (user.getAliasing()) {
                username = user.getAlias();
            }
        }
        catch (Exception e) {
            username = originalUsername;
        }
View Full Code Here

    }

    public boolean setPassword(String username,
                               String password)
            throws RemoteException {
        JamesUser user = (JamesUser)users.getUserByName(username);
        if (user == null) {
            getLogger().error("No such user " + username + " found!");
            throw new RemoteException("No such user " + username + " found!");
        }
        if (user.setPassword(password)) {
            users.updateUser(user);
            getLogger().info("Password for user " + username + " reset.");
            return true;
        }
        getLogger().error("Error resetting password for user " + username);
View Full Code Here


    public boolean setAlias(String username,
                            String alias)
            throws RemoteException {
        JamesUser user = (JamesUser)users.getUserByName(username);
        if (user == null) {
            getLogger().error("No such user " + username + " found!");
            throw new RemoteException("No such user " + username + " found!");
        }
        JamesUser aliasUser = (JamesUser)users.getUserByName(alias);
        if (aliasUser == null) {
            getLogger().error("Alias unknown to server - create that user " + alias + " first!");
            throw new RemoteException("Alias unknown to server - create that user " + alias + " first!");
        }
        if (user.setAlias(alias)) {
View Full Code Here

    }


    public boolean unsetAlias(String username)
            throws RemoteException {
        JamesUser user = (JamesUser)users.getUserByName(username);
        if (user == null) {
            getLogger().error("No such user " + username + " found!");
            throw new RemoteException("No such user " + username + " found!");
        }
        if (user.getAliasing()) {
            user.setAliasing(false);
            users.updateUser(user);
            getLogger().info("Alias for user " + username + " unset.");
            return true;
        }
        getLogger().info("Aliasing not active for user " + username);
View Full Code Here

        return false;
    }

    public String checkAlias(String username)
            throws RemoteException {
        JamesUser user = (JamesUser)users.getUserByName(username);
        if (user == null) {
            getLogger().error("No such user " + username + " found!");
            throw new RemoteException("No such user " + username + " found!");
        }
        if (user.getAliasing()) {
            String alias = user.getAlias();
            getLogger().info("Alias is set to " + alias + " for user " + username);
            return alias;
        }
        getLogger().info("No alias is set for this user " + username);
        return null;
View Full Code Here


    public boolean setForward(String username,
                              String forward)
            throws RemoteException {
        JamesUser user = (JamesUser)users.getUserByName(username);
        if (user == null) {
            getLogger().error("No such user " + username + " found!");
            throw new RemoteException("No such user " + username + " found!");
        }
        MailAddress forwardAddress;
        try {
            forwardAddress = new MailAddress(forward);
        } catch (ParseException pe) {
            getLogger().error("Parse exception with that email address: " + pe.getMessage());
            throw new RemoteException("Parse exception with that email address: " + pe.getMessage());
        }
        if (user.setForwardingDestination(forwardAddress)) {
            user.setForwarding(true);
            users.updateUser(user);
            getLogger().info("Forwarding destination for " + username + " set to: " + forwardAddress.toString());
            return true;
        }
        getLogger().error("Error setting forward for user " + username);
View Full Code Here

        return false;
    }

    public boolean unsetForward(String username)
            throws RemoteException {
        JamesUser user = (JamesUser)users.getUserByName(username);
        if (user == null) {
            getLogger().error("No such user " + username + " found!");
            throw new RemoteException("No such user " + username + " found!");
        }
        if (user.getForwarding()) {
            user.setForwarding(false);
            users.updateUser(user);
            getLogger().info("Forward for user " + username + " unset.");
            return true;
        }
        getLogger().info("Forwarding not active for user " + username);
View Full Code Here

TOP

Related Classes of org.apache.james.services.JamesUser

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.