Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add integration test for groupprovider #2595

Merged
merged 2 commits into from
Mar 1, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions changelog/unreleased/group-integration-tests.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Enhancement: Add integration test for the groupprovider

Some new integration tests were added to cover the groupprovider.

https://github.com/cs3org/reva/pull/2595
2 changes: 1 addition & 1 deletion pkg/group/manager/json/json.go
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ func New(m map[string]interface{}) (group.Manager, error) {

func (m *manager) GetGroup(ctx context.Context, gid *grouppb.GroupId) (*grouppb.Group, error) {
for _, g := range m.groups {
if g.Id.GetOpaqueId() == gid.OpaqueId || g.GroupName == gid.OpaqueId {
if (g.Id.GetOpaqueId() == gid.OpaqueId || g.GroupName == gid.OpaqueId) && (gid.Idp == "" || gid.Idp == g.Id.GetIdp()) {
return g, nil
}
}
Expand Down
11 changes: 11 additions & 0 deletions tests/integration/grpc/fixtures/groupprovider-json.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
[log]
level = "debug"

[grpc]
address = "{{grpc_address}}"

[grpc.services.groupprovider]
driver = "json"

[grpc.services.groupprovider.drivers.json]
groups = "fixtures/groups.demo.json"
27 changes: 27 additions & 0 deletions tests/integration/grpc/fixtures/groupprovider-ldap.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
[log]
level = "debug"

[grpc]
address = "{{grpc_address}}"

[grpc.services.groupprovider]
driver = "ldap"

[grpc.services.groupprovider.drivers.ldap]
hostname="ocisldap"
port=636
insecure=true
base_dn="dc=owncloud,dc=com"
groupfilter="(&(objectclass=posixGroup)(ownclouduuid={{.OpaqueId}}))"
memberfilter="(&(objectclass=posixGroup)(ownclouduuid={{.OpaqueId}}))"
findfilter="(&(objectclass=posixGroup)(|(cn={{query}}*)(displayname={{query}}*)(mail={{query}}*)(ownclouduuid={{query}})))"
attributefilter="(&(objectclass=posixGroup)({{attr}}={{value}}))"
bind_username="cn=admin,dc=owncloud,dc=com"
bind_password="admin"
idp="http://localhost:20080"

[grpc.services.groupprovider.drivers.ldap.schema]
gid="ownclouduuid"
displayName="description"
dn="dn"
cn="cn"
113 changes: 113 additions & 0 deletions tests/integration/grpc/fixtures/groups.demo.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,113 @@
[
{
"id": {
"opaque_id": "6040aa17-9c64-4fef-9bd0-77234d71bad0",
"idp": "http://localhost:20080"
},
"group_name": "sailing-lovers",
"gidNumber" : "30001",
"display_name": "Sailing Lovers",
"members": [
{
"opaque_id": "4c510ada-c86b-4815-8820-42cdf82c3d51",
"idp": "http://localhost:20080"
}
]
},
{
"id": {
"opaque_id": "dd58e5ec-842e-498b-8800-61f2ec6f911f",
"idp": "http://localhost:20080"
},
"group_name": "violin-haters",
"gidNumber" : "30002",
"display_name": "Violin Haters",
"members": [
{
"opaque_id": "4c510ada-c86b-4815-8820-42cdf82c3d51",
"idp": "http://localhost:20080"
}
]
},
{
"id": {
"opaque_id": "7b87fd49-286e-4a5f-bafd-c535d5dd997a",
"idp": "http://localhost:20080"
},
"group_name": "radium-lovers",
"gidNumber" : "30003",
"display_name": "Radium Lovers",
"members": [
{
"opaque_id": "f7fbf8c8-139b-4376-b307-cf0a8c2d0d9c",
"idp": "http://localhost:20080"
}
]
},
{
"id": {
"opaque_id": "cedc21aa-4072-4614-8676-fa9165f598ff",
"idp": "http://localhost:20080"
},
"group_name": "polonium-lovers",
"gidNumber" : "30004",
"display_name": "Polonium Lovers",
"members": [
{
"opaque_id": "f7fbf8c8-139b-4376-b307-cf0a8c2d0d9c",
"idp": "http://localhost:20080"
}
]
},
{
"id": {
"opaque_id": "a1726108-01f8-4c30-88df-2b1a9d1cba1a",
"idp": "http://localhost:20080"
},
"group_name": "quantum-lovers",
"gidNumber" : "30005",
"display_name": "Quantum Lovers",
"members": [
{
"opaque_id": "932b4540-8d16-481e-8ef4-588e4b6b151c",
"idp": "http://localhost:20080"
}
]
},
{
"id": {
"opaque_id": "167cbee2-0518-455a-bfb2-031fe0621e5d",
"idp": "http://localhost:20080"
},
"group_name": "philosophy-haters",
"gidNumber" : "30006",
"display_name": "Philosophy Haters",
"members": [
{
"opaque_id": "932b4540-8d16-481e-8ef4-588e4b6b151c",
"idp": "http://localhost:20080"
}
]
},
{
"id": {
"opaque_id": "262982c1-2362-4afa-bfdf-8cbfef64a06e",
"idp": "http://localhost:20080"
},
"group_name": "physics-lovers",
"gidNumber" : "30005",
"display_name": "Physics Lovers",
"members": [
{
"opaque_id": "4c510ada-c86b-4815-8820-42cdf82c3d51",
"idp": "http://localhost:20080"
},{
"opaque_id": "f7fbf8c8-139b-4376-b307-cf0a8c2d0d9c",
"idp": "http://localhost:20080"
},{
"opaque_id": "932b4540-8d16-481e-8ef4-588e4b6b151c",
"idp": "http://localhost:20080"
}
]
}
]
16 changes: 8 additions & 8 deletions tests/integration/grpc/fixtures/ldap/30_groups_rfc2307.ldif
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@ dn: ou=groups,dc=owncloud,dc=com
objectClass: organizationalUnit
ou: groups

dn: cn=sailing-lovers,ou=groups,dc=owncloud,dc=com
dn: cn=Sailing Lovers,ou=groups,dc=owncloud,dc=com
objectClass: posixGroup
objectClass: ownCloud
objectClass: top
cn: sailing-lovers
description: Sailing lovers
description: Sailing Lovers
gidNumber: 30001
ownCloudUUID:: NjA0MGFhMTctOWM2NC00ZmVmLTliZDAtNzcyMzRkNzFiYWQw
memberUid: einstein
Expand All @@ -17,7 +17,7 @@ objectClass: posixGroup
objectClass: ownCloud
objectClass: top
cn: violin-haters
description: Violin haters
description: Violin Haters
gidNumber: 30002
ownCloudUUID:: ZGQ1OGU1ZWMtODQyZS00OThiLTg4MDAtNjFmMmVjNmY5MTFm
memberUid: einstein
Expand All @@ -27,7 +27,7 @@ objectClass: posixGroup
objectClass: ownCloud
objectClass: top
cn: radium-lovers
description: Radium lovers
description: Radium Lovers
gidNumber: 30003
ownCloudUUID:: N2I4N2ZkNDktMjg2ZS00YTVmLWJhZmQtYzUzNWQ1ZGQ5OTdh
memberUid: marie
Expand All @@ -37,7 +37,7 @@ objectClass: posixGroup
objectClass: ownCloud
objectClass: top
cn: polonium-lovers
description: Polonium lovers
description: Polonium Lovers
gidNumber: 30004
ownCloudUUID:: Y2VkYzIxYWEtNDA3Mi00NjE0LTg2NzYtZmE5MTY1ZjU5OGZm
memberUid: marie
Expand All @@ -47,7 +47,7 @@ objectClass: posixGroup
objectClass: ownCloud
objectClass: top
cn: quantum-lovers
description: Quantum lovers
description: Quantum Lovers
gidNumber: 30005
ownCloudUUID:: YTE3MjYxMDgtMDFmOC00YzMwLTg4ZGYtMmIxYTlkMWNiYTFh
memberUid: richard
Expand All @@ -57,7 +57,7 @@ objectClass: posixGroup
objectClass: ownCloud
objectClass: top
cn: philosophy-haters
description: Philosophy haters
description: Philosophy Haters
gidNumber: 30006
ownCloudUUID:: MTY3Y2JlZTItMDUxOC00NTVhLWJmYjItMDMxZmUwNjIxZTVk
memberUid: richard
Expand All @@ -67,7 +67,7 @@ objectClass: posixGroup
objectClass: ownCloud
objectClass: top
cn: physics-lovers
description: Physics lovers
description: Physics Lovers
gidNumber: 30007
ownCloudUUID:: MjYyOTgyYzEtMjM2Mi00YWZhLWJmZGYtOGNiZmVmNjRhMDZl
memberUid: einstein
Expand Down
Loading