@@ -6,9 +6,10 @@ sealed class Role private constructor(val roleName: String) {
6
6
companion object {
7
7
const val TEAM_ADMIN = " team-admin"
8
8
const val SERVICE_ACCOUNT = " service-account"
9
- const val PROJECT_OWNER = " project-owner"
10
- const val HEAD_RESEARCHER = " head-researcher"
11
- const val RESEARCHER = " researcher"
9
+ const val STUDY_CREATOR = " study-creator"
10
+ const val PRINCIPAL_INVESTIGATOR = " principal-investigator"
11
+ const val RESEARCH_ASSISTANT = " research-assistant"
12
+ const val DATA_SCIENTIST = " data-scientist"
12
13
}
13
14
14
15
abstract val authorities: Collection <GrantedAuthority >
@@ -39,33 +40,65 @@ sealed class Role private constructor(val roleName: String) {
39
40
40
41
fun canAccessProject (pid : String ): Boolean = projectId == pid
41
42
42
- class ProjectOwner (projectId : String ) : ProjectRole(projectId, PROJECT_OWNER ) {
43
+ class StudyCreator (projectId : String ) : ProjectRole(projectId, STUDY_CREATOR ) {
43
44
override val authorities: Collection <GrantedAuthority > = listOf (
44
45
AssignRoleAuthority (projectId),
45
- AccessProjectAuthority (projectId)
46
+ ReadStudyOverviewAuthority (projectId),
47
+ ReadParticipantDataAuthority (projectId),
48
+ ReadDeIdentifiedParticipantDataAuthority (projectId),
49
+ AccessInLabVisitAuthority (projectId),
50
+ AccessTaskAuthority (projectId),
51
+ AccessDocumentAuthority (projectId),
52
+ ReadAggSensorDataAuthority (projectId),
53
+ QueryRawDataAuthority (projectId),
54
+ QueryDeIdentifiedDataAuthority (projectId),
55
+ ReadProjectMemberAuthority (projectId),
56
+ AccessProjectMemberAuthority (projectId),
46
57
)
47
58
}
48
59
49
- class HeadResearcher (projectId : String ) : ProjectRole(projectId, HEAD_RESEARCHER ) {
60
+ class PrincipalInvestigator (projectId : String ) : ProjectRole(projectId, PRINCIPAL_INVESTIGATOR ) {
50
61
override val authorities: Collection <GrantedAuthority > = listOf (
51
62
AssignRoleAuthority (projectId),
52
- AccessProjectAuthority (projectId)
63
+ ReadStudyOverviewAuthority (projectId),
64
+ ReadParticipantDataAuthority (projectId),
65
+ ReadDeIdentifiedParticipantDataAuthority (projectId),
66
+ AccessInLabVisitAuthority (projectId),
67
+ AccessTaskAuthority (projectId),
68
+ AccessDocumentAuthority (projectId),
69
+ ReadAggSensorDataAuthority (projectId),
70
+ QueryRawDataAuthority (projectId),
71
+ QueryDeIdentifiedDataAuthority (projectId),
72
+ ReadProjectMemberAuthority (projectId),
73
+ AccessProjectMemberAuthority (projectId),
53
74
)
54
75
}
55
76
56
- class Researcher (projectId : String ) : ProjectRole(projectId, RESEARCHER ) {
77
+ class ResearchAssistant (projectId : String ) : ProjectRole(projectId, RESEARCH_ASSISTANT ) {
57
78
override val authorities: Collection <GrantedAuthority > = listOf (
58
- AccessProjectAuthority (projectId)
79
+ ReadStudyOverviewAuthority (projectId),
80
+ ReadParticipantDataAuthority (projectId),
81
+ ReadDeIdentifiedParticipantDataAuthority (projectId),
82
+ AccessInLabVisitAuthority (projectId),
83
+ AccessTaskAuthority (projectId),
84
+ AccessDocumentAuthority (projectId),
85
+ ReadAggSensorDataAuthority (projectId),
86
+ QueryRawDataAuthority (projectId),
87
+ QueryDeIdentifiedDataAuthority (projectId),
88
+ ReadProjectMemberAuthority (projectId),
89
+ AccessProjectMemberAuthority (projectId),
59
90
)
60
91
}
61
92
62
- class CustomRole (projectId : String , projectRoleName : String ) : ProjectRole(projectId, projectRoleName) {
63
- init {
64
- require(projectRoleName.isNotBlank())
65
- }
66
-
93
+ class DataScientist (projectId : String ) : ProjectRole(projectId, DATA_SCIENTIST ) {
67
94
override val authorities: Collection <GrantedAuthority > = listOf (
68
- AccessProjectAuthority (projectId)
95
+ ReadStudyOverviewAuthority (projectId),
96
+ ReadDeIdentifiedParticipantDataAuthority (projectId),
97
+ AccessTaskAuthority (projectId),
98
+ AccessDocumentAuthority (projectId),
99
+ ReadAggSensorDataAuthority (projectId),
100
+ QueryDeIdentifiedDataAuthority (projectId),
101
+ ReadProjectMemberAuthority (projectId),
69
102
)
70
103
}
71
104
}
0 commit comments