Package org.apache.james.user.api

Examples of org.apache.james.user.api.User


    protected List<String> listUserNames() {
        Iterator<User> users = m_users.values().iterator();
        List<String> userNames = new LinkedList<String>();
        while ( users.hasNext() ) {
            User user = users.next();
            userNames.add(user.getUserName());
        }

        return userNames;
    }
View Full Code Here


     * @param name the name of the user to retrieve
     * @return the user being retrieved, null if the user doesn't exist
     *
     */
    public User getUserByName(String username) {
        User user;
        try {
            final Session session = login();
            try {
                final String name = toSafeName(username);
                final String path = USERS_PATH + "/" + name;
View Full Code Here

        super(UserManagementMBean.class);
    }


    private JamesUser getJamesUser(String userName, String repositoryName) {
        User baseuser = getUserRepository(repositoryName).getUserByName(userName);
        if (baseuser == null) throw new IllegalArgumentException("user not found: " + userName);
        if (! (baseuser instanceof JamesUser ) ) throw new IllegalArgumentException("user is not of type JamesUser: " + userName);

        return (JamesUser) baseuser;
    }
View Full Code Here

    /**
     * @see org.apache.james.user.api.UserManagementMBean#setPassword(java.lang.String, java.lang.String, java.lang.String)
     */
    public boolean setPassword(String userName, String password, String repositoryName) {
        UsersRepository users = getUserRepository(repositoryName);
        User user = users.getUserByName(userName);
        if (user == null) throw new IllegalArgumentException("user not found: " + userName);
        return user.setPassword(password);
    }
View Full Code Here

     * @param attributes
     *            the password value as a String
     */
    public void addUser(String name, Object attributes) {
        if (attributes instanceof String) {
            User newbie = new DefaultUser(name, "SHA");
            newbie.setPassword((String) attributes);
            addUser(newbie);
        } else {
            throw new RuntimeException("Improper use of deprecated method"
                    + " - use addUser(User user)");
        }
View Full Code Here

     *      java.lang.String)
     */
    public Collection<String> getMappings(String username, String domain)
            throws ErrorMappingException {
        Collection<String> mappings = new ArrayList<String>();
        User user = getUserByName(username);

        if (user instanceof JamesUser) {
            JamesUser jUser = (JamesUser) user;

            if (enableAliases && jUser.getAliasing()) {
View Full Code Here

    /**
     * @see org.apache.james.user.api.UsersRepository#addUser(java.lang.String, java.lang.String)
     */
    public boolean addUser(String username, String password)  {
        User newbie = new DefaultUser(username, "SHA");
        newbie.setPassword(password);
        return addUser(newbie);
    }
View Full Code Here

   
    /**
     * @see org.apache.james.user.api.UsersRepository#addUser(java.lang.String, java.lang.String)
     */
    public boolean addUser(String username, String password)  {
        User newbie = new DefaultUser(username, "SHA");
        newbie.setPassword(password);
        return addUser(newbie);
    }
View Full Code Here

     *
     * @param userName
     *            the user to be removed
     */
    public void removeUser(String userName) {
        User user = getUserByName(userName);
        if (user != null) {
            doRemoveUser(user);
        }
    }
View Full Code Here

     *
     * @return the correct case sensitive name of the user
     */
    public String getRealName(String name) {
        // Get the user by name, ignoring case, and return the correct name.
        User user = getUserByName(name, ignoreCase);
        if (user == null) {
            return null;
        } else {
            return user.getUserName();
        }
    }
View Full Code Here

TOP

Related Classes of org.apache.james.user.api.User

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.