01: package ru.emdev.EmForge.security;
02:
03: import java.util.Collection;
04:
05: import ru.emdev.EmForge.security.dao.Role;
06:
07: /**
08: * UserFactory is interface responsible for working with users.<br>
09: * Major his things is return user information by user name and gets the list of users.
10: *
11: * @todo Maybe to move role operation (except hasRole) to separate factory?
12: */
13: public interface UserFactory {
14:
15: /**
16: * Gets the user by specified user name
17: *
18: * @param i_userName - user's login name
19: * @return User object
20: */
21: public EmForgeUserDetails getUser(String i_userName);
22:
23: /**
24: * Gets the current User
25: */
26: public EmForgeUserDetails getCurrentUser();
27:
28: /**
29: * Gets password, used for login for current user
30: */
31: public String getCurrentPassword();
32:
33: /**
34: * Retrieves a list of users, available in the system
35: *
36: * @return list of users
37: */
38: public Collection<EmForgeUserDetails> getUsers();
39:
40: /**
41: * Retrieves a list of users, available in the system, by specified role name
42: *
43: * @param i_role is a role name to get users
44: * @return list of users with specified role
45: * @throws Exception
46: */
47: public Collection<EmForgeUserDetails> getUsers(String i_role);
48:
49: /**
50: * Returns try if current user has role with specified name
51: *
52: * @param i_role
53: * @return
54: */
55: public boolean hasRole(String i_role);
56:
57: /**
58: * @return All existing roles
59: */
60: public Collection<Role> getRoles();
61:
62: /**
63: * @return Role by specified name
64: */
65: public Role getRole(String i_roleName);
66: }
|