Project

General

Profile

1
package eu.dnetlib.repo.manager.service.security;
2

    
3
import org.springframework.security.core.GrantedAuthority;
4
import org.springframework.security.core.authority.SimpleGrantedAuthority;
5

    
6
import java.util.Collection;
7

    
8
public interface RoleMappingService {
9

    
10
    /**
11
     * @param fullName
12
     * @param prefix
13
     * @return
14
     */
15
    String getRepoNameWithoutType(String fullName, String prefix);
16

    
17
    /**
18
     * @param roleId Role Id
19
     * @return Converts {@param roleId} to a repo Id.
20
     */
21
    String getRepoIdByRoleId(String roleId);
22

    
23
    /**
24
     *
25
     * @param roleIds Collection of roles
26
     * @return Converts {@param roleIds} to a repo Ids.
27
     */
28
    Collection<String> getRepoIdsByRoleIds(Collection<String> roleIds);
29

    
30
    /**
31
     * @param repoId Repository Id
32
     * @return Converts {@param repoId} to a role Id.
33
     */
34
    String getRoleIdByRepoId(String repoId);
35

    
36
    /**
37
     * @param repoIds Collection of Repository Ids
38
     * @return Converts {@param repoIds} to role Ids.
39
     */
40
    Collection<String> getRoleIdsByRepoIds(Collection<String> repoIds);
41

    
42
    /**
43
     * @param authorityId Authority Id
44
     * @return Converts {@param authorityId} to repo Id.
45
     */
46
    String convertAuthorityIdToRepoId(String authorityId);
47

    
48
    /**
49
     * @param authority Granted authority
50
     * @return Converts {@param authority} to repo Id.
51
     */
52
    String convertAuthorityToRepoId(GrantedAuthority authority);
53

    
54
    /**
55
     * @param repoId Repository Id
56
     * @return
57
     */
58
    String convertRepoIdToAuthorityId(String repoId);
59

    
60
    /**
61
     * @param repoId Repository Id
62
     * @return Converts {@param repoId} to {@link String} role id url encoded ($ -> %24)
63
     * // TODO: remove role encoding and perform url decoding when mapping authorities. (Must be performed in all OpenAIRE projects because of Redis)
64
     */
65
    String convertRepoIdToEncodedAuthorityId(String repoId);
66

    
67
    /**
68
     * @param repoId Repository Id
69
     * @return Converts {@param repoId} to {@link SimpleGrantedAuthority} with the role url encoded ($ -> %24)
70
     * // TODO: remove role encoding and perform url decoding when mapping authorities. (Must be performed in all OpenAIRE projects because of Redis)
71
     */
72
    SimpleGrantedAuthority convertRepoIdToAuthority(String repoId);
73

    
74
}
(6-6/6)