gvsig-tools / org.gvsig.tools / library / trunk / org.gvsig.tools / org.gvsig.tools.lib / src / main / java / org / gvsig / tools / identitymanagement / SimpleIdentity.java @ 1739
History | View | Annotate | Download (2.31 KB)
1 | 1160 | jjdelcerro | package org.gvsig.tools.identitymanagement; |
---|---|---|---|
2 | |||
3 | import java.util.List; |
||
4 | |||
5 | public interface SimpleIdentity { |
||
6 | |||
7 | public static final String READ_AUTHORIZATION = "access--read"; |
||
8 | public static final String WRITE_AUTHORIZATION = "access--write"; |
||
9 | |||
10 | /**
|
||
11 | * Return the identifier of this user
|
||
12 | *
|
||
13 | * @return the id of the user
|
||
14 | */
|
||
15 | public String getID(); |
||
16 | |||
17 | public String getName(); |
||
18 | |||
19 | public String getFullName(); |
||
20 | |||
21 | public List getAttributeNames(); |
||
22 | |||
23 | public String getAttribute(String name); |
||
24 | |||
25 | /**
|
||
26 | * Checks is the identity is authorized to perform the action.
|
||
27 | * If the identity is authorized to execute the accion return true,
|
||
28 | * otherwise false.
|
||
29 | *
|
||
30 | * "actionName", can be a single name or a list of coma separated names.
|
||
31 | *
|
||
32 | * If actionName is a list of actions, fails when not authorized to one of
|
||
33 | * the actions.
|
||
34 | *
|
||
35 | * @param actionName
|
||
36 | * @return true if the identity is authorized
|
||
37 | */
|
||
38 | public boolean isAuthorized(String actionName); |
||
39 | |||
40 | /**
|
||
41 | * Checks is the identity is authorized to perform the action on the
|
||
42 | * indicated resource.
|
||
43 | * If the identity is authorized to execute the accion return true,
|
||
44 | * otherwise false.
|
||
45 | *
|
||
46 | * "actionName", can be a single name or a list of coma sepaated
|
||
47 | * names.
|
||
48 | *
|
||
49 | * @param actionName
|
||
50 | * @param resource
|
||
51 | * @param resourceName
|
||
52 | * @return true if the identity is authorized
|
||
53 | */
|
||
54 | public boolean isAuthorized(String actionName, Object resource, String resourceName); |
||
55 | |||
56 | /**
|
||
57 | * Checks if the identity has read access on the indicated resource.
|
||
58 | * This method is a utility method for:
|
||
59 | *
|
||
60 | * {@link #isAuthorized(READ_AUTHORIZATION, resource, resourceName)
|
||
61 | *
|
||
62 | * @param resource
|
||
63 | * @param resourceName
|
||
64 | * @return true if the identity has read access
|
||
65 | */
|
||
66 | public boolean canRead(Object resource, String resourceName); |
||
67 | |||
68 | /**
|
||
69 | * Checks if the identity has read access on the indicated resource.
|
||
70 | * This method is a utility method for:
|
||
71 | *
|
||
72 | * {@link #isAuthorized(WRITE_AUTHORIZATION, resource, resourceName)
|
||
73 | *
|
||
74 | * @param resource
|
||
75 | * @param resourceName
|
||
76 | * @return true if the identity has write access
|
||
77 | */
|
||
78 | public boolean canWrite(Object resource, String resourceName); |
||
79 | |||
80 | } |