/**
* Copyright 1999-2009 The Pegadi Team
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.pegadi.server.user;
import no.dusken.common.model.Person;
import java.util.List;
public interface UserServer {
/**
* Return true if the user can publish an article. All users can publish,
* so this will allways return <code>true</code>.
*
* @return Always <code>true</code>.
*/
public boolean canPublish(Long userID);
/**
* Returns all active journalists.
*
* @return an array of <code>User</code>s
*/
public List<Person> getJournalists();
/**
* Returns all active photographers
*
* @return an array of <code>User</code>s
*/
public List<Person> getPhotographers();
/**
* Find a user by username.
*
* @param username The user name of the wanted user.
*/
public Person getUserByUsername(String username);
/**
* Persons used to be connected to an article by ID, not username.
* Fetch the person that used to have the given Id.
*/
public Person getUserByLegacyId(Integer legacyId);
/**
* Returns an array of users.
*
* @param inactive <code>true</code> if inactive users should be included.
* @return an array of <code>User</code>s.
*/
public List<Person> getAllUsers(boolean inactive);
/**
* Returns whether a user is active
* @param userID the user id
*/
public boolean isActive(String userID);
/**
* Returns an array of users having a given role. Either active or
* inactive users are returned.
*
* @param roleID the role of the users.
* @param active specifying whether we want the active or inactive users.
* @return an array of <code>User</code>s.
*/
public List<Person> getUsersByRole(int roleID, int active);
// this is what we want:
//public User[] getUsersByRole(Role role, boolean active);
/**
* @param roleID the ID of a role
* @param userID the ID of a user
* @return <code>true</code> if the user has that role.
*/
public boolean hasRole(Integer roleID, Long userID);
/**
* Returns <code>true</code> if the user is a superuser.
*
* @return superuser status.
*/
public boolean isGod(Person userID);
/**
* Authenticates the given user name and password.
*
* @param user User name.
* @return User ID if successful, <code>-1</code> if failure.
*/
public String login(String user);
}