dnet45/modules/uoa-repository-manager-service/branches/aai_roles_new/src/main/java/eu/dnetlib/repo/manager/service/aai/registry/AaiRegistryService.java @ 61319
1 |
package eu.dnetlib.repo.manager.service.aai.registry; |
---|---|
2 |
|
3 |
import com.google.gson.JsonArray; |
4 |
import com.google.gson.JsonObject; |
5 |
import eu.dnetlib.repo.manager.domain.dto.Role; |
6 |
|
7 |
import java.util.List; |
8 |
import java.util.Map; |
9 |
|
10 |
public interface AaiRegistryService { |
11 |
|
12 |
/**
|
13 |
* 1.1 Get CoPersonId by authenticated user's Email
|
14 |
*
|
15 |
* @return
|
16 |
*/
|
17 |
Integer getCoPersonIdByEmail(); |
18 |
|
19 |
/**
|
20 |
* 1.2 Get CoPersonId by Email
|
21 |
*
|
22 |
* @param email
|
23 |
* @return
|
24 |
*/
|
25 |
Integer getCoPersonIdByEmail(String email); |
26 |
|
27 |
/**
|
28 |
* 1. Get CoPersonId List by Email
|
29 |
*
|
30 |
* @param email
|
31 |
* @return
|
32 |
*/
|
33 |
List<Integer> getCoPersonIdsByEmail(String email); |
34 |
|
35 |
/**
|
36 |
* 2. Get CoPersonId by AAI identifier
|
37 |
*
|
38 |
* @return
|
39 |
*/
|
40 |
Integer getCoPersonIdByIdentifier(); |
41 |
|
42 |
/**
|
43 |
* 3.1 Get OpenAIRE cous with a specific name(or substring)
|
44 |
*
|
45 |
* @param name
|
46 |
* @return
|
47 |
*/
|
48 |
JsonArray getCous(String name); |
49 |
|
50 |
/**
|
51 |
* 3.2 Get all OpenAIRE cous
|
52 |
*
|
53 |
* @return
|
54 |
*/
|
55 |
JsonArray getCous(); |
56 |
|
57 |
/**
|
58 |
* 4.1 Get a couId by name
|
59 |
*
|
60 |
* @param name
|
61 |
* @return
|
62 |
*/
|
63 |
Integer getCouId(String name); |
64 |
|
65 |
/**
|
66 |
* 4.2 Get a couId by type.id with/without mapping type
|
67 |
*
|
68 |
* @param type
|
69 |
* @param id
|
70 |
* @return
|
71 |
*/
|
72 |
Integer getCouId(String type, String id, boolean communityMap); |
73 |
|
74 |
/**
|
75 |
* 4.3 Get a couId by type.id with mapping type
|
76 |
*
|
77 |
* @param type
|
78 |
* @param id
|
79 |
* @return
|
80 |
*/
|
81 |
Integer getCouId(String type, String id); |
82 |
|
83 |
/**
|
84 |
* 5. Get User non admin roles
|
85 |
*
|
86 |
* @param coPersonId
|
87 |
* @return
|
88 |
*/
|
89 |
JsonArray getRoles(Integer coPersonId); |
90 |
|
91 |
/**
|
92 |
* 6. Get Role id of User base on couId.
|
93 |
*
|
94 |
* @param coPersonId
|
95 |
* @param couId
|
96 |
* @return
|
97 |
*/
|
98 |
Integer getRoleId(Integer coPersonId, Integer couId); |
99 |
|
100 |
/**
|
101 |
* 7. Get User Groups
|
102 |
*
|
103 |
* @param coPersonId
|
104 |
* @return
|
105 |
*/
|
106 |
JsonArray getUserGroups(Integer coPersonId); |
107 |
|
108 |
/**
|
109 |
* 8. Get User Admin Group of a Cou
|
110 |
*
|
111 |
* @param coPersonId
|
112 |
* @param couId
|
113 |
* @return
|
114 |
*/
|
115 |
JsonObject getUserAdminGroup(Integer coPersonId, Integer couId); |
116 |
|
117 |
/**
|
118 |
* 9. Get Groups of a Cou
|
119 |
*
|
120 |
* @param couId
|
121 |
* @return
|
122 |
*/
|
123 |
JsonArray getCouGroups(Integer couId); |
124 |
|
125 |
/**
|
126 |
* 10. Get Admin Group of a Cou
|
127 |
*
|
128 |
* @param couId
|
129 |
* @return
|
130 |
*/
|
131 |
JsonObject getCouAdminGroup(Integer couId); |
132 |
|
133 |
/**
|
134 |
* 11. Get users of a group
|
135 |
*
|
136 |
* @param coGroupId
|
137 |
* @return
|
138 |
*/
|
139 |
JsonArray getGroupMembers(Integer coGroupId); |
140 |
|
141 |
|
142 |
/**
|
143 |
* 12. Get Users' email of a Cou
|
144 |
*
|
145 |
* @param couId
|
146 |
* @param admin
|
147 |
* @return
|
148 |
*/
|
149 |
JsonArray getUserEmailByCouId(Integer couId, boolean admin); |
150 |
|
151 |
/**
|
152 |
* 12.2 Get All Users that have a specific role // TODO: Keep or delete
|
153 |
*
|
154 |
* @param couId
|
155 |
* @return
|
156 |
*/
|
157 |
JsonArray getUsersByCouId(Integer couId); |
158 |
|
159 |
/**
|
160 |
* 13. Get Users' names of a Cou
|
161 |
*
|
162 |
* @param couId
|
163 |
* @param admin
|
164 |
* @return
|
165 |
*/
|
166 |
JsonArray getUserNamesByCouId(Integer couId, boolean admin); |
167 |
|
168 |
/**
|
169 |
* 14. Get Users' identifiers of a Cou
|
170 |
*
|
171 |
* @param couId
|
172 |
* @param admin
|
173 |
* @return
|
174 |
*/
|
175 |
JsonArray getUserIdByCouId(Integer couId, boolean admin); |
176 |
|
177 |
/**
|
178 |
* 15. Assign a member role to a User
|
179 |
*
|
180 |
* @param coPersonId
|
181 |
* @param couId
|
182 |
* @param id
|
183 |
*/
|
184 |
void assignMemberRole(Integer coPersonId, Integer couId, Integer id); |
185 |
|
186 |
/**
|
187 |
* 16. Remove a member role from a User
|
188 |
*
|
189 |
* @param coPersonId
|
190 |
* @param couId
|
191 |
* @param id
|
192 |
*/
|
193 |
void removeMemberRole(Integer coPersonId, Integer couId, Integer id); |
194 |
|
195 |
/**
|
196 |
* 17. Create a new role
|
197 |
*
|
198 |
* @param role
|
199 |
* @return
|
200 |
*/
|
201 |
Integer createRole(Role role); |
202 |
|
203 |
/**
|
204 |
* 18. Get User's email
|
205 |
*
|
206 |
* @param coPersonId
|
207 |
* @return
|
208 |
*/
|
209 |
String getUserEmail(Integer coPersonId); |
210 |
|
211 |
/**
|
212 |
* 19. Get User's names
|
213 |
*
|
214 |
* @param coPersonId
|
215 |
* @return
|
216 |
*/
|
217 |
String getUserNames(Integer coPersonId); |
218 |
|
219 |
/**
|
220 |
* 20. Get User's identifier
|
221 |
*
|
222 |
* @param coPersonId
|
223 |
* @return
|
224 |
*/
|
225 |
String getUserId(Integer coPersonId); |
226 |
|
227 |
/**
|
228 |
* 21. Assign an admin role to a User
|
229 |
*
|
230 |
* @param coPersonId
|
231 |
* @param couId
|
232 |
*/
|
233 |
void assignAdminRole(Integer coPersonId, Integer couId); |
234 |
|
235 |
/**
|
236 |
* 22. Remove an admin role from a User
|
237 |
*
|
238 |
* @param coPersonId
|
239 |
* @param couId
|
240 |
*/
|
241 |
void removeAdminRole(Integer coPersonId, Integer couId); |
242 |
|
243 |
/**
|
244 |
* 23. Get a cou Names from couIds.
|
245 |
*
|
246 |
* @param couIds
|
247 |
* @return
|
248 |
*/
|
249 |
Map<Integer, String> getCouNames(List<Integer> couIds); |
250 |
}
|