Skip to content

Commit 71b41d7

Browse files
authored
Merge pull request #495 from owncloud/user-create-ldap
Migrate ldap connection and configurations from user_ldap tests to core tests
2 parents 5b09f2e + 7cda60a commit 71b41d7

20 files changed

+181
-352
lines changed

Diff for: composer.json

+1-2
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,7 @@
55
}
66
},
77
"require-dev": {
8-
"bamarni/composer-bin-plugin": "^1.2",
9-
"zendframework/zend-ldap": "^2.8"
8+
"bamarni/composer-bin-plugin": "^1.2"
109
},
1110
"require": {
1211
"php": ">=7.0.8",

Diff for: tests/acceptance/config/behat.yml

+3-1
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,8 @@ default:
3232
ldapAdminPassword: admin
3333
ldapUsersOU: TestUsers
3434
ldapGroupsOU: TestGroups
35-
ldapInitialUserFilePath: /../../config/ldap-users.ldif
35+
ldapInitialUserFilePath: /../../../../tests/acceptance/config/ldap-users.ldif
36+
3637
contexts: &common_webui_core_contexts
3738
- UserLdapGeneralContext:
3839
- FeatureContext: &common_feature_context_params
@@ -43,6 +44,7 @@ default:
4344
regularUserPassword: 123456
4445
- EmailContext:
4546
- FederationContext:
47+
- OccContext:
4648
- WebUIAdminSharingSettingsContext:
4749
- WebUIFilesContext:
4850
- WebUIGeneralContext:

Diff for: tests/acceptance/features/apiProvisioningLDAP/groups.feature

+23
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@ Feature: manage groups
6363

6464
Scenario Outline: Administrator tries to delete a ldap group
6565
Given using OCS API version "<ocs-api-version>"
66+
And group "grp1" has been created
6667
When the LDAP users are resynced
6768
And the administrator deletes group "grp1" using the provisioning API
6869
Then the OCS status code should be "<ocs-status-code>"
@@ -76,6 +77,7 @@ Feature: manage groups
7677
@issue-core-25224
7778
Scenario Outline: Add database user to ldap group
7879
Given using OCS API version "<ocs-api-version>"
80+
And group "grp1" has been created
7981
And user "db-user" has been created with default attributes in the database user backend
8082
When the administrator adds user "db-user" to group "grp1" using the provisioning API
8183
Then the OCS status code should be "<ocs-status-code>"
@@ -91,6 +93,7 @@ Feature: manage groups
9193
Scenario Outline: Add ldap user to database group
9294
Given using OCS API version "<ocs-api-version>"
9395
And group "db-group" has been created in the database user backend
96+
And user "user1" has been created with default attributes and without skeleton files
9497
When the administrator adds user "user1" to group "db-group" using the provisioning API
9598
Then the OCS status code should be "<ocs-status-code>"
9699
And the HTTP status code should be "<http-status-code>"
@@ -103,6 +106,8 @@ Feature: manage groups
103106
@issue-core-25224
104107
Scenario Outline: Add ldap user to ldap group
105108
Given using OCS API version "<ocs-api-version>"
109+
And user "user1" has been created with default attributes and without skeleton files
110+
And group "grp2" has been created
106111
When the administrator adds user "user1" to group "grp2" using the provisioning API
107112
Then the OCS status code should be "<ocs-status-code>"
108113
And the HTTP status code should be "<http-status-code>"
@@ -116,6 +121,10 @@ Feature: manage groups
116121

117122
Scenario: Add ldap group with same name as existing database group
118123
Given group "db-group" has been created in the database user backend
124+
And these users have been created with default attributes and without skeleton files:
125+
| username |
126+
| user1 |
127+
| user2 |
119128
And user "user1" has been added to database backend group "db-group"
120129
When the administrator imports this ldif data:
121130
"""
@@ -133,12 +142,21 @@ Feature: manage groups
133142
But user "user1" should belong to group "db-group"
134143

135144
Scenario: creating a group in an OU that is different to the other groups
145+
Given user "user3" has been created with default attributes and without skeleton files
136146
When the administrator creates group "new-group-in-other-ou" in ldap OU "TestUsers"
137147
And the administrator adds user "user3" to group "new-group-in-other-ou" in ldap OU "TestUsers"
138148
And the administrator invokes occ command "group:list"
139149
Then user "user3" should belong to group "new-group-in-other-ou"
140150

141151
Scenario: creating a group with a name that already exists in LDAP but in a other OU
152+
Given these users have been created with default attributes and without skeleton files:
153+
| username |
154+
| user2 |
155+
| user3 |
156+
And these groups have been created:
157+
| groupname |
158+
| grp1 |
159+
And user "user2" has been added to group "grp1"
142160
When the administrator creates group "grp1" in ldap OU "TestUsers"
143161
And the administrator adds user "user3" to group "grp1" in ldap OU "TestUsers"
144162
And the administrator invokes occ command "group:list"
@@ -147,6 +165,10 @@ Feature: manage groups
147165
And group "grp1_2" should not exist
148166

149167
Scenario: creating two groups with the same name in different LDAP OUs at the same time
168+
Given these users have been created with default attributes and without skeleton files:
169+
| username |
170+
| user1 |
171+
| user2 |
150172
When the administrator imports this ldif data:
151173
"""
152174
dn: cn=so-far-unused-group-name,ou=TestUsers,dc=owncloud,dc=com
@@ -170,6 +192,7 @@ Feature: manage groups
170192

171193
Scenario Outline: Add database group with same name as existing ldap group
172194
Given using OCS API version "<ocs-api-version>"
195+
And group "grp1" has been created
173196
When the administrator sends a group creation request for group "grp1" using the provisioning API
174197
Then the OCS status code should be "<ocs-status-code>"
175198
And the HTTP status code should be "<http-status-code>"

Diff for: tests/acceptance/features/apiProvisioningLDAP/users.feature

+10
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,7 @@ Feature: Manage users using the Provisioning API
8080
@issue-core-33186
8181
Scenario Outline: admin tries to modify displayname of user for which an LDAP attribute is specified
8282
Given using OCS API version "<ocs-api-version>"
83+
And user "user1" has been created with default attributes and without skeleton files
8384
When the administrator sets the ldap attribute "displayname" of the entry "uid=user1,ou=TestUsers" to "ldap user"
8485
And the LDAP users are resynced
8586
When the administrator changes the display of user "user1" to "A New User" using the provisioning API
@@ -96,6 +97,7 @@ Feature: Manage users using the Provisioning API
9697
@issue-core-33186
9798
Scenario Outline: admin tries to modify password of user for which an LDAP attribute is specified
9899
Given using OCS API version "<ocs-api-version>"
100+
And user "user1" has been created with default attributes and skeleton files
99101
When the administrator sets the ldap attribute "userpassword" of the entry "uid=user1,ou=TestUsers" to "ldap_password"
100102
And the LDAP users are resynced
101103
And the administrator resets the password of user "user1" to "api_password" using the provisioning API
@@ -113,6 +115,7 @@ Feature: Manage users using the Provisioning API
113115
@issue-core-33186
114116
Scenario Outline: admin tries to modify mail of user for which an LDAP attribute is specified
115117
Given using OCS API version "<ocs-api-version>"
118+
And user "user1" has been created with default attributes and without skeleton files
116119
When the administrator sets the ldap attribute "mail" of the entry "uid=user1,ou=TestUsers" to "[email protected]"
117120
And the LDAP users are resynced
118121
And the administrator changes the email of user "user1" to "[email protected]" using the provisioning API
@@ -132,6 +135,7 @@ Feature: Manage users using the Provisioning API
132135
@issue-core-33186
133136
Scenario Outline: admin tries to modify quota of user for which an LDAP attribute is specified
134137
Given using OCS API version "<ocs-api-version>"
138+
And user "user1" has been created with default attributes and without skeleton files
135139
#to set Quota we can just misuse any LDAP text field
136140
And LDAP config "LDAPTestId" has key "ldapQuotaAttribute" set to "employeeNumber"
137141
When the administrator sets the ldap attribute "employeeNumber" of the entry "uid=user1,ou=TestUsers" to "10 MB"
@@ -152,6 +156,7 @@ Feature: Manage users using the Provisioning API
152156

153157
Scenario Outline: admin sets quota of user for which no LDAP quota attribute is specified
154158
Given using OCS API version "<ocs-api-version>"
159+
And user "user1" has been created with default attributes and without skeleton files
155160
#to set Quota we can just misuse any LDAP text field
156161
And LDAP config "LDAPTestId" has key "ldapQuotaAttribute" set to "employeeNumber"
157162
And the LDAP users have been resynced
@@ -169,6 +174,7 @@ Feature: Manage users using the Provisioning API
169174
@issue-core-33186
170175
Scenario Outline: admin sets quota of user for which no LDAP quota attribute is specified but a default quota is set in the LDAP settings
171176
Given using OCS API version "<ocs-api-version>"
177+
And user "user1" has been created with default attributes and without skeleton files
172178
#to set Quota we can just misuse any LDAP text field
173179
And LDAP config "LDAPTestId" has key "ldapQuotaAttribute" set to "employeeNumber"
174180
And LDAP config "LDAPTestId" has key "ldapQuotaDefault" set to "10MB"
@@ -189,6 +195,7 @@ Feature: Manage users using the Provisioning API
189195

190196
Scenario Outline: admin sets quota of user in LDAP when a default quota is set in the LDAP settings
191197
Given using OCS API version "<ocs-api-version>"
198+
And user "user1" has been created with default attributes and without skeleton files
192199
#to set Quota we can just misuse any LDAP text field
193200
And LDAP config "LDAPTestId" has key "ldapQuotaAttribute" set to "employeeNumber"
194201
And LDAP config "LDAPTestId" has key "ldapQuotaDefault" set to "10MB"
@@ -205,6 +212,7 @@ Feature: Manage users using the Provisioning API
205212
@issue-core-33186
206213
Scenario Outline: admin sets quota of user when the quota LDAP attribute is specified and a default quota is set in the LDAP settings
207214
Given using OCS API version "<ocs-api-version>"
215+
And user "user1" has been created with default attributes and without skeleton files
208216
#to set Quota we can just misuse any LDAP text field
209217
And LDAP config "LDAPTestId" has key "ldapQuotaAttribute" set to "employeeNumber"
210218
And LDAP config "LDAPTestId" has key "ldapQuotaDefault" set to "10MB"
@@ -226,6 +234,7 @@ Feature: Manage users using the Provisioning API
226234

227235
Scenario Outline: Administrator deletes a ldap user and resyncs again
228236
Given using OCS API version "<ocs-api-version>"
237+
And user "user0" has been created with default attributes and without skeleton files
229238
And user "user0" has uploaded file with content "new file that should be overwritten after user deletion" to "textfile0.txt"
230239
When the administrator deletes user "user0" using the provisioning API
231240
Then the OCS status code should be "<ocs-status-code>"
@@ -241,6 +250,7 @@ Feature: Manage users using the Provisioning API
241250

242251
Scenario Outline: Administrator tries to create a user with same name as existing ldap user
243252
Given using OCS API version "<ocs-api-version>"
253+
And user "user0" has been created with default attributes and skeleton files
244254
When the administrator sends a user creation request for user "user0" password "%alt1%" using the provisioning API
245255
Then the OCS status code should be "<ocs-status-code>"
246256
And the HTTP status code should be "<http-status-code>"

Diff for: tests/acceptance/features/apiUserLDAP/moveUser.feature

+1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ Feature: move users between OUs
55
Given the owncloud log level has been set to "info"
66
And the owncloud log backend has been set to "owncloud"
77
And the owncloud log has been cleared
8+
And user "user0" has been created with default attributes and without skeleton files
89
And user "user0" has uploaded file with content "new file that should still exist" to "textfile_new.txt"
910
When the administrator deletes the ldap entry "uid=user0,ou=TestUsers"
1011
And the administrator imports this ldif data:

Diff for: tests/acceptance/features/apiUserLDAPConnection/backupServerConnection.feature

+1
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ So that user authentication still works when the main LDAP server is not reachab
88
Background:
99
Given the owncloud log level has been set to "warning"
1010
And the owncloud log has been cleared
11+
And user "user0" has been created with default attributes and skeleton files
1112

1213
Scenario: authentication works when the main server is not reachable but the backup server is
1314
Given LDAP config "LDAPTestId" has key "ldapHost" set to "not-existent"

Diff for: tests/acceptance/features/apiUserLDAPConnection/groupFilter.feature

+14-4
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,18 @@ Feature: filter groups
44
I want to be able to filter LDAP groups
55
So that only groups meeting specific criteria are available in ownCloud
66

7-
Scenario: single group filter
7+
Background:
8+
Given these groups have been created:
9+
| groupname |
10+
| grp1 |
11+
| grp2 |
12+
| group1 |
13+
| group2 |
14+
| ShareeGroup |
15+
| ShareeGroup2 |
16+
17+
18+
Scenario: single group filter
819
When the administrator sets these settings of LDAP config "LDAPTestId" using the occ command
920
| key | value |
1021
| ldapGroupFilter | (&(\|(objectclass=posixGroup))(\|(cn=grp2))) |
@@ -15,7 +26,7 @@ Feature: filter groups
1526
| admin |
1627
| grp2 |
1728

18-
Scenario: filter with asterisk
29+
Scenario: filter with asterisk
1930
When the administrator sets these settings of LDAP config "LDAPTestId" using the occ command
2031
| key | value |
2132
| ldapGroupFilter | (&(\|(objectclass=posixGroup))(\|(cn=Sharee*))) |
@@ -27,7 +38,7 @@ Feature: filter groups
2738
| ShareeGroup |
2839
| ShareeGroup2 |
2940

30-
Scenario: filter for multiple groups
41+
Scenario: filter for multiple groups
3142
When the administrator sets these settings of LDAP config "LDAPTestId" using the occ command
3243
| key | value |
3344
| ldapGroupFilter | (&(\|(objectclass=posixGroup))(\|(cn=group1)(cn=group2))) |
@@ -57,4 +68,3 @@ Feature: filter groups
5768
| group |
5869
| admin |
5970
| grp1 |
60-

Diff for: tests/acceptance/features/apiUserLDAPConnection/serverConnection.feature

+1
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ Feature: connect to LDAP serer
44
Background:
55
Given the owncloud log level has been set to "warning"
66
And the owncloud log has been cleared
7+
And user "user0" has been created with default attributes and skeleton files
78

89
Scenario: authentication fails when the configuration does not contain an ldap port
910
Given LDAP config "LDAPTestId" has key "ldapPort" set to ""

Diff for: tests/acceptance/features/apiUserLDAPSharing/sharingLocalUserLdapUser.feature

+4-2
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,14 @@ Feature: Sharing between local and LDAP users
55

66
Background:
77
Given user "local-user" has been created with default attributes in the database user backend
8-
And these users have been initialized:
9-
#these are LDAP users and are not initialized yet
8+
And these users have been created with default attributes and skeleton files:
109
| username |
1110
| user0 |
1211
| user1 |
1312
| user2 |
13+
And group "grp1" has been created
14+
And user "user1" has been added to group "grp1"
15+
And user "user2" has been added to group "grp1"
1416

1517
Scenario: Share a folder from an LDAP user to a local user
1618
When user "user0" shares folder "/PARENT" with user "local-user" using the sharing API

0 commit comments

Comments
 (0)