Skip to content

Commit

Permalink
Add group roles to @groups serializer
Browse files Browse the repository at this point in the history
  • Loading branch information
sneridagh committed Mar 4, 2019
1 parent 6758f1d commit a430318
Show file tree
Hide file tree
Showing 8 changed files with 34 additions and 0 deletions.
2 changes: 2 additions & 0 deletions news/682.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
- Add group roles to @groups serializer
[sneridagh]
1 change: 1 addition & 0 deletions src/plone/restapi/serializer/group.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ def __call__(self):
'email': group.getProperty('email'),
'title': group.getProperty('title'),
'description': group.getProperty('description'),
'roles': group.getRoles(),
}


Expand Down
16 changes: 16 additions & 0 deletions src/plone/restapi/tests/http-examples/groups.resp
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@ Content-Type: application/json
"email": "",
"groupname": "Administrators",
"id": "Administrators",
"roles": [
"Manager",
"Authenticated"
],
"title": "Administrators"
},
{
Expand All @@ -16,6 +20,10 @@ Content-Type: application/json
"email": "",
"groupname": "Reviewers",
"id": "Reviewers",
"roles": [
"Reviewer",
"Authenticated"
],
"title": "Reviewers"
},
{
Expand All @@ -24,6 +32,10 @@ Content-Type: application/json
"email": "",
"groupname": "Site Administrators",
"id": "Site Administrators",
"roles": [
"Site Administrator",
"Authenticated"
],
"title": "Site Administrators"
},
{
Expand All @@ -32,6 +44,9 @@ Content-Type: application/json
"email": "ploneteam@plone.org",
"groupname": "ploneteam",
"id": "ploneteam",
"roles": [
"Authenticated"
],
"title": "Plone Team"
},
{
Expand All @@ -40,6 +55,7 @@ Content-Type: application/json
"email": "",
"groupname": "AuthenticatedUsers",
"id": "AuthenticatedUsers",
"roles": [],
"title": "Authenticated Users (Virtual Group)"
}
]
4 changes: 4 additions & 0 deletions src/plone/restapi/tests/http-examples/groups_created.resp
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@ Location: http://localhost:55001/plone/@groups/fwt
"email": "fwt@plone.org",
"groupname": "fwt",
"id": "fwt",
"roles": [
"Manager",
"Authenticated"
],
"title": "Framework Team",
"users": {
"@id": "http://localhost:55001/plone/@groups",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ Content-Type: application/json
"email": "ploneteam@plone.org",
"groupname": "ploneteam",
"id": "ploneteam",
"roles": [
"Authenticated"
],
"title": "Plone Team"
}
]
3 changes: 3 additions & 0 deletions src/plone/restapi/tests/http-examples/groups_get.resp
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ Content-Type: application/json
"email": "ploneteam@plone.org",
"groupname": "ploneteam",
"id": "ploneteam",
"roles": [
"Authenticated"
],
"title": "Plone Team",
"users": {
"@id": "http://localhost:55001/plone/@groups/ploneteam",
Expand Down
3 changes: 3 additions & 0 deletions src/plone/restapi/tests/http-examples/principals.resp
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@ Content-Type: application/json
"email": "ploneteam@plone.org",
"groupname": "ploneteam",
"id": "ploneteam",
"roles": [
"Authenticated"
],
"title": "Plone Team"
}
],
Expand Down
2 changes: 2 additions & 0 deletions src/plone/restapi/tests/test_services_groups.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,8 @@ def test_list_groups(self):
self.assertEqual('Plone Team', ptgroup.get('title'))
self.assertEqual('We are Plone', ptgroup.get('description'))

self.assertEqual(ptgroup.get('roles'), ['Authenticated'])

# We don't want the group members listed in the overview as there
# might be loads.
self.assertTrue(
Expand Down

0 comments on commit a430318

Please sign in to comment.