Commit Graph

163 Commits

Author SHA1 Message Date
Daniël Franke
e1a4ac6b33 Fix tests 2023-01-31 12:52:49 +01:00
Daniël Franke
5ccb218267 Add memberOfSchoolAttribute to class attrr getter. 2023-01-31 12:52:49 +01:00
Daniël Franke
992ef9c5d7 Rename some variables, remove TODO. 2023-01-31 12:52:49 +01:00
Daniël Franke
e5eb1e1a6d Add tests for ldap functions.
Also add interface functions to middleware.
2023-01-31 12:52:49 +01:00
Daniël Franke
610ad7ddd0 Add tests for service handlers. 2023-01-31 12:52:49 +01:00
Daniël Franke
14734f3d16 Fix comments for exported methods. 2023-01-31 12:52:49 +01:00
Daniël Franke
20f6a212f3 Add service endpoints. 2023-01-31 12:52:49 +01:00
Daniël Franke
9b8adb65ed Add LDAP entries for adding classes to schools. 2023-01-31 12:52:49 +01:00
Jörn Friedrich Dreyer
aa12a60d16 fix populating user drive and drives (#5426)
* fix populating user drive and drives

Signed-off-by: Jörn Friedrich Dreyer <jfd@butonic.de>

* update changelog

Signed-off-by: Jörn Friedrich Dreyer <jfd@butonic.de>

* fix test condition

Signed-off-by: Jörn Friedrich Dreyer <jfd@butonic.de>

Signed-off-by: Jörn Friedrich Dreyer <jfd@butonic.de>
2023-01-26 11:54:32 +01:00
Daniël Franke
c48426f641 Emit GroupFeatureChanged event on class patch.
When a class has changed, emit a GroupFeatureChanged event.
2023-01-24 10:21:22 +01:00
Daniel Swärd
c79d4ec241 graph: Allow creating users without email (#5253) 2023-01-23 15:20:32 +01:00
Daniël Franke
b30b0b4a6c Fix test. 2023-01-23 14:38:12 +01:00
Daniël Franke
17bd1704fa Stop expecting class var. 2023-01-23 14:38:12 +01:00
Daniël Franke
e6273140a2 Revert status change. 2023-01-23 14:38:12 +01:00
Daniël Franke
a9fff65209 Remove tests for non-supported properties. 2023-01-23 14:38:12 +01:00
Daniël Franke
bfecff7747 Remove OnPremises code. 2023-01-23 14:38:12 +01:00
Daniël Franke
4389bcdd25 Add documentation comment. 2023-01-23 14:38:12 +01:00
Daniël Franke
d2076941f4 Add tests.
Also update mocks with mockery.
2023-01-23 14:38:12 +01:00
Daniël Franke
3772e8190e Change DN on externalID change. 2023-01-23 14:38:12 +01:00
Daniël Franke
2ca35f0a2b Allow patching of EducationClass properties.
As described in #5410: add support for updating educationClass properties.
This adds the `UpdateEducationClass` to the `EducationBackend` interface,
and implements it on the `ErrEducationBackend` and `LDAP` backends.

It also alters `PatchEducationClass` to call the `UpdateEducationClass` method.

Closes #5410
2023-01-23 14:38:12 +01:00
Jörn Friedrich Dreyer
32cc9beb0b walk and log chi routes, ocs cleanup (#5428)
* walk and log chi routes, ocs cleanup

Signed-off-by: Jörn Friedrich Dreyer <jfd@butonic.de>

* make linter happy

Signed-off-by: Jörn Friedrich Dreyer <jfd@butonic.de>

Signed-off-by: Jörn Friedrich Dreyer <jfd@butonic.de>
2023-01-23 12:30:34 +01:00
Ralf Haferkamp
473c64fe03 graph: fix adding users to educationSchool by schoolNumber (#5422)
GET /education/schools/{school-id}/users
POST /education/schools/{school-id}/users/$ref
and
DELETE /education/schools/{school-id}/users/$ref

are supposed to also work when using the schoolNumber as the
'{school-id}' parameter. This fix that functionality. This also makes the
the mocks for the LDAP Modify operations more specific to avoid using
the generic mock.Anything
2023-01-23 10:37:24 +01:00
Ralf Haferkamp
c2ed4ab526 Bump libregraph-api-go (#5432) 2023-01-23 10:28:10 +01:00
Jörn Friedrich Dreyer
52b7f41624 Populate expanded properties (#5421)
Signed-off-by: Jörn Friedrich Dreyer <jfd@butonic.de>

Signed-off-by: Jörn Friedrich Dreyer <jfd@butonic.de>
2023-01-18 15:51:53 +01:00
Daniel Swärd
96239af982 graph: Allow provisioning users with legacy names (#5255)
Via configuration you can now configure to skip the validation of username and
instead decide to trust the upstream system that is adding users.
2023-01-18 12:25:53 +01:00
Jörn Friedrich Dreyer
3aa864aecc Remove Staticcheck warnings (#5394)
* remove deprecated ioutil imports

Signed-off-by: Jörn Friedrich Dreyer <jfd@butonic.de>

* remove duplicate imports

Signed-off-by: Jörn Friedrich Dreyer <jfd@butonic.de>

* remove unused values

Signed-off-by: Jörn Friedrich Dreyer <jfd@butonic.de>

* remove some unused types

Signed-off-by: Jörn Friedrich Dreyer <jfd@butonic.de>

* remove deprecated ioutil import

Signed-off-by: Jörn Friedrich Dreyer <jfd@butonic.de>

Signed-off-by: Jörn Friedrich Dreyer <jfd@butonic.de>
2023-01-13 15:29:14 +01:00
Jörn Friedrich Dreyer
544189b039 drop superflous /me in test urls (#5396)
Signed-off-by: Jörn Friedrich Dreyer <jfd@butonic.de>

Signed-off-by: Jörn Friedrich Dreyer <jfd@butonic.de>
2023-01-13 15:29:00 +01:00
Ralf Haferkamp
60ac8fcfbe graph education/classes: Add LDAP backend support for Create,Get,Delete 2023-01-12 17:37:10 +01:00
Ralf Haferkamp
6d5637ad79 graph: Move LDAP groups related code to a separate file 2023-01-12 17:37:10 +01:00
Daniël Franke
b0cd8779a7 Consistently add user attributes to AddRequest (#5392)
To make the `CreateUser` flow easier to test, the attributes of the
LDAP add request need to be added consistently. This way we can
expect that argument with the mock.

This PR does the following:

* Add a method `getUserAttrTypes` that returns a static list of attr names.
* Alter `userToAddRequest` to iterate over the static list, and add the attr
  if it exists in the `attrMap`.

Closes #5390
2023-01-12 17:25:43 +01:00
Jörn Friedrich Dreyer
078698fdf4 graph: add appRoleAssignments and minimal application resource (#5318)
* bump libregraph-go lib

Signed-off-by: Jörn Friedrich Dreyer <jfd@butonic.de>

* add appRoleAssignment stubs

Signed-off-by: Jörn Friedrich Dreyer <jfd@butonic.de>

* add get application stub

Signed-off-by: Jörn Friedrich Dreyer <jfd@butonic.de>

* fetch appRoles for application from settings service

Signed-off-by: Jörn Friedrich Dreyer <jfd@butonic.de>

* initial list appRoleAssignments implementation

Signed-off-by: Jörn Friedrich Dreyer <jfd@butonic.de>

* initial create appRoleAssignment implementation, extract assignmentToAppRoleAssignment, configurable app id and displayname

Signed-off-by: Jörn Friedrich Dreyer <jfd@butonic.de>

* initial delete appRoleAssignment implementation, changed error handling and logging

Signed-off-by: Jörn Friedrich Dreyer <jfd@butonic.de>

* initial expand appRoleAssignment on users

Signed-off-by: Jörn Friedrich Dreyer <jfd@butonic.de>

* test user expand appRoleAssignment

Signed-off-by: Jörn Friedrich Dreyer <jfd@butonic.de>

* test appRoleAssignment

Signed-off-by: Jörn Friedrich Dreyer <jfd@butonic.de>

* fix education test by actually using the mocked roleManager

Signed-off-by: Jörn Friedrich Dreyer <jfd@butonic.de>

* test getapplication

Signed-off-by: Jörn Friedrich Dreyer <jfd@butonic.de>

* list assignments

Signed-off-by: Jörn Friedrich Dreyer <jfd@butonic.de>

* use common not exists error handling

Signed-off-by: Jörn Friedrich Dreyer <jfd@butonic.de>

* default to just 'ownCloud Infinite Scale' as application name

Signed-off-by: Jörn Friedrich Dreyer <jfd@butonic.de>

* fix store_test

Signed-off-by: Jörn Friedrich Dreyer <jfd@butonic.de>

* roll application uuid on init

Signed-off-by: Jörn Friedrich Dreyer <jfd@butonic.de>

* fix tests

Signed-off-by: Jörn Friedrich Dreyer <jfd@butonic.de>

* extract method

Signed-off-by: Jörn Friedrich Dreyer <jfd@butonic.de>

* Apply suggestions from code review

Co-authored-by: Michael Barz <mbarz@owncloud.com>

Signed-off-by: Jörn Friedrich Dreyer <jfd@butonic.de>
Co-authored-by: Michael Barz <mbarz@owncloud.com>
2023-01-12 16:09:34 +01:00
Daniël Franke
ddb0933033 Display surname and givenName attributes.
This PR makes it so that givenName and surname attributes are returned for users.

Fixes #5386
2023-01-12 15:01:14 +01:00
Daniël Franke
8055996874 Test CreateUser (#5382)
This tests the CreateUser functions.

Fixes #5375
2023-01-12 09:42:05 +01:00
Ralf Haferkamp
709ef1ffca graph:Add stubs for education/classes endpoints (#5360)
* Renamed files for consistency reasons

err_school.go implements the full education interface not just schools.
ldap_school.go renamed to ldap_education_school.go for making it
consistent with ldap_education_user.go

* graph: Add stubs for education/classes endpoints

The acutal backend implementations are still empty.
2023-01-11 20:38:18 +01:00
Daniël Franke
f7aff26636 Merge pull request #5370 from owncloud/ainmosni/issue/5210
Support givenName graph attribute.
2023-01-11 14:32:13 +01:00
Daniel Swärd
e1ad437d9e Fix problem with non-public error type because of forgotten rebase. 2023-01-11 12:14:54 +01:00
Daniel Swärd
e15b3cd8cc Adding so education PATCH updates school name or number. 2023-01-11 12:14:54 +01:00
Jörn Friedrich Dreyer
b9a4d0c8f7 Update services/graph/pkg/identity/ldap.go 2023-01-11 10:15:26 +01:00
Florian Schade
95023f2adc mute newService err in tests (#5372) 2023-01-10 17:11:30 +01:00
Florian Schade
bb1540fc45 [full-ci] add identitySet displayName property to the group and user sets (#5347)
* add identitySet displayName property to the group and user sets
2023-01-10 15:42:13 +01:00
Daniël Franke
5409a38549 Support givenName graph attribute.
This sets the LDAP `givenname` attribute when the libe-graph `givenName`
attribute exists.

Fixes #5210
2023-01-10 12:48:26 +01:00
Daniël Franke
43a98c0485 Add test for new configurable patch limit.
Also make test for old default match on the actual error message.
2023-01-10 11:45:24 +01:00
Daniël Franke
425ebb8084 Change naming 2023-01-10 11:45:24 +01:00
Daniël Franke
49d71ea111 Make amount of users in patch configurable.
This PR changes the following:

* Create an API config section for API configurables.
* Add a setting `UserPatchLimit` that controls how many users can be changed in a PATCH request.
* Use this setting in the API to limit the amount of users that can be changed.
2023-01-10 11:45:24 +01:00
Ralf Haferkamp
4717248959 Simplify sort code a bit
Switch to sort.Slice() instead of sort.Sort(), which requires less
boilerplate.
2023-01-10 09:31:40 +01:00
Daniël Franke
f3924ca8c2 Disassociate users from schools on school delete. (#5343)
* Disassociate users from schools on school delete.

This PR alters the `DeleteEducationSchool` to also disassociate the
users that were associated with the to-be-deleted school.

* Add changelog.

* Remove punctuation from changelog.

* Remove redundant return statement.

* Skip when user not find.
2023-01-06 12:58:32 +01:00
Daniël Franke
aff568d0b8 Make identity errors public. (#5353)
This makes the identity errors public so other packages can match on them.

It also moves them to the same file as the interface, as that makes them more discoverable.
2023-01-06 12:04:38 +01:00
Daniel Swärd
a0e85386a4 Fixing linting error. 2023-01-05 11:42:39 +01:00
Daniel Swärd
80b8ce42f6 Update GetEducationSchoolUsers, AddUsersToEducationSchool, RemoveUserFromEducationSchool with schoolNumber. 2023-01-05 11:42:39 +01:00
Daniel Swärd
e0c6aa5c34 Modify DeleteEducationSchool for schoolNumber/id and remove old test 2023-01-05 11:42:39 +01:00