Skip to content
This repository was archived by the owner on Mar 19, 2024. It is now read-only.

Commit 45f5365

Browse files
abelgardepJuancaG05
authored andcommitted
Update permissions parsing to latest api changes
Supports api renaming from grantedTo to grantedToIdentities on v1.0.1 https://github.com/owncloud/libre-graph-api/releases/tag/v1.0.1
1 parent 8a4fcb6 commit 45f5365

File tree

1 file changed

+21
-5
lines changed
  • owncloudComLibrary/src/main/java/com/owncloud/android/lib/resources/spaces/responses

1 file changed

+21
-5
lines changed

owncloudComLibrary/src/main/java/com/owncloud/android/lib/resources/spaces/responses/SpacesResponse.kt

Lines changed: 21 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -89,8 +89,15 @@ data class FileResponse(
8989
)
9090

9191
@JsonClass(generateAdapter = true)
92-
data class GrantedToResponse(
93-
val user: UserResponse
92+
data class IdentityPermissionResponse(
93+
val id: String,
94+
val displayName: String?,
95+
)
96+
97+
@JsonClass(generateAdapter = true)
98+
data class GrantedToIdentitiesResponse(
99+
val user: IdentityPermissionResponse?,
100+
val group: IdentityPermissionResponse?,
94101
)
95102

96103
@JsonClass(generateAdapter = true)
@@ -100,9 +107,18 @@ data class DeleteResponse(
100107

101108
@JsonClass(generateAdapter = true)
102109
data class PermissionResponse(
103-
val grantedTo: List<GrantedToResponse>,
104-
val roles: List<String>
105-
)
110+
val grantedTo: List<GrantedToIdentitiesResponse>?,
111+
val grantedToIdentities: List<GrantedToIdentitiesResponse>?,
112+
val roles: List<String>,
113+
) {
114+
/**
115+
* Supports api renaming from grantedTo to grantedToIdentities on v1.0.1
116+
* https://github.com/owncloud/libre-graph-api/releases/tag/v1.0.1
117+
*/
118+
fun getGrantedToIdentitiesResponse(): List<GrantedToIdentitiesResponse> {
119+
return grantedToIdentities ?: grantedTo ?: throw IllegalArgumentException("Permissions not granted to anyone")
120+
}
121+
}
106122

107123
@JsonClass(generateAdapter = true)
108124
data class SpecialFolderResponse(

0 commit comments

Comments
 (0)