a800fde0
jcartign
First version, in...
|
1
2
3
4
|
package fr.plil.sio.persistence.api;
public interface UserService {
|
5418cb05
jcartign
Javadoc of API is...
|
5
6
7
8
9
10
11
12
13
14
|
/**
* Create an user with a specific name in the database and affected to an existing group.
* There is no two users with the same name in the database.
*
* @param name the name of the user
* @return an instance of the user
* @throws IllegalArgumentException if name or groupName is null, or if group does not exist.
* @throws IllegalStateException if an user with the same name is already present
*/
User create(String name, String groupName);
|
a800fde0
jcartign
First version, in...
|
15
|
|
5418cb05
jcartign
Javadoc of API is...
|
16
17
18
19
20
21
22
23
|
/**
* Delete an user in the database.
*
* @param name the name of the user to remove
* @return true if user has been deleted, false if user is not found in the database.
* @throws IllegalArgumentException if name is null
*/
boolean delete(String name);
|
a800fde0
jcartign
First version, in...
|
24
|
|
5418cb05
jcartign
Javadoc of API is...
|
25
26
27
28
29
30
31
|
/**
* Find an user in the database based on its name.
*
* @param name the name of the user to search for.
* @return an instance of the user if found, else null.
* @throws IllegalArgumentException if name is null
*/
|
a800fde0
jcartign
First version, in...
|
32
33
|
User findByName(String name);
|
5418cb05
jcartign
Javadoc of API is...
|
34
35
36
37
38
39
40
41
42
43
|
/**
* Check method to control if an user has a specific right. The following rule is used: an user has a specific
* right if the group where the user is contains the specific right or one of its parents.
*
* @param userName the name of the user
* @param right the specific right
* @return true if the group where the user is contains the specific right or one of its parents, false else.
* @throws IllegalArgumentException if userName or right is null, or if the user or right does not exist in the db.
*/
boolean isUserHasRight(String userName, Right right);
|
a800fde0
jcartign
First version, in...
|
44
|
}
|