Commit Graph
71 Commits
Author SHA1 Message Date
Jörn Friedrich DreyerandGitHub 52d31ca8ef log missing name or id attributes (#1914)
Signed-off-by: Jörn Friedrich Dreyer <jfd@butonic.de>
2025-11-26 08:06:05 +01:00
Jörn Friedrich Dreyer 4340cdc9e6 handle objectguid endianess
Signed-off-by: Jörn Friedrich Dreyer <jfd@butonic.de>
2025-11-24 15:53:41 +01:00
Ralf Haferkamp 07b97fa7ac revert(partial): "Filter users by tenant, add tenant ids to demo users"
This reverts parts of commit 926a2c2080.

The LDAP identity backend of the graph service was supposed to stay single-tenant
only. The focus for multi-tenancy should be on the CS3 identity backend.

Also lets keep the internal IDM and demo users clean of any
multi-tenancy stuff for now.
2025-09-04 08:47:19 +02:00
André DuffeckandChristian Richter 926a2c2080 Filter users by tenant, add tenant ids to demo users 2025-08-05 17:10:59 +02:00
Jörn Friedrich DreyerandRalf Haferkamp 981e8fe5a3 do not automatically expand drive root permissions
Signed-off-by: Jörn Friedrich Dreyer <jfd@butonic.de>
2025-06-02 15:17:32 +02:00
Ralf Haferkamp 3dc9c0cb9a Switch to opencloud-eu fork of libre-graph-api-go 2025-05-15 14:11:35 +02:00
Ralf Haferkamp 0716b40fa0 Adjust LDAP Schema for new name 2025-01-29 11:58:57 +01:00
Jörn Friedrich DreyerandFlorian Schade b07b5a1149 use plain pkg module
Signed-off-by: Jörn Friedrich Dreyer <jfd@butonic.de>
2025-01-13 16:42:19 +01:00
Jörn Friedrich Dreyer 8e028f17e9 change module name
Signed-off-by: Jörn Friedrich Dreyer <jfd@butonic.de>
2025-01-13 09:58:18 +01:00
Ralf HaferkampandRalf Haferkamp 82d2193ad6 fix(graph): Allow to combine $search and $filter in users query
This fixes the 'graph/v1.0/users' endpoint to allow a combination of a
memberOf filter in $filter with a search string in $search.

Allowing queries like:

$filter=(memberOf/any(m:m/id eq 509a9dcd-bb37-4f4f-a01a-19dca27d9cfa))&$search="example"
2024-12-02 17:15:21 +01:00
Ralf HaferkampandRalf Haferkamp ce663c3a3a fix(graph): treat LDAP attribute names case-insensitive everywhere
There were a couple of places where we were using the case-sensitive
GetAttributeValue method instead of the case-insensitive variant.

Fixes: #10200
2024-10-02 10:48:33 +02:00
Ralf HaferkampandRalf Haferkamp 34cc7b2e56 feat(graph): Add $filter support for lastSuccessfulSignInDateTime
It is now possible to filter users based on the lastSuccessfulSignInDateTime attribute
using query filter like:
 '$filter=signInActivity/lastSuccessfulSignInDateTime le 2021-09-01T00:00:00Z'

Note: This does only work with LDAP servers actually supporting '<=' filters.
The built-in LDAP server (idm) does not support this feature.
2024-09-23 10:49:49 +02:00
Ralf HaferkampandRalf Haferkamp 231128950f feat(graph): expose 'signinactivity' for users 2024-09-23 10:49:49 +02:00
Ralf HaferkampandRalf Haferkamp 724755426e graph: remove some code duplication 2024-09-23 10:49:49 +02:00
Ralf HaferkampandRalf Haferkamp 8e158d52bb graph(oidc): Consume UserSignedIn events in graph service
Pass them to the identity backend to update the last sign-in date of the user.
2024-09-17 16:02:47 +02:00
Jörn Friedrich Dreyer a3c7bd3182 bump libre graph api
Signed-off-by: Jörn Friedrich Dreyer <jfd@butonic.de>
2024-08-19 14:20:20 +02:00
Ralf HaferkampandRalf Haferkamp 80e8a2ec1a (fix)graph: Always set UserType in /users responses
LDAP users without a UserType attribute get the UserType "Member"
by default. Federated users get the UserType "Federated".

Related #9702
2024-08-12 12:16:16 +02:00
Ralf HaferkampandRalf Haferkamp eace09ca05 graph: Allow to set the identities property on users
Previously we only allowed setting the "identities" property on education users.
This changes move the related code to the main user object.
2024-05-13 17:22:37 +02:00
Thomas Müller 07f0cd5574 fix: typos, naming clashes, error messages and deprecations 2024-04-03 15:34:36 +02:00
Ralf HaferkampandRalf Haferkamp 795989e0aa graph/users: Use a full substring filter of user search
Previously we only did a prefix match.
2023-12-07 10:21:45 +01:00
Florian SchadeandGitHub ad06a192d8 enhancement: add graph beta listPermissions endpoint (#7753)
* enhancement: add graph beta listPermissions endpoint

besides the new api endpoint it includes several utilities to simplify the graph api development.

* resolve drive and item id from the request path
* generic pointer and value utilities
* space root detection

* update GetDriveAndItemIDParam signature to return a error

* move errorcode package

* enhancement: add generic error code handling

* fix: rebase
2023-11-28 17:06:04 +01:00
Florian Schade 170021a38e chore: go version bump to 1.21 2023-11-23 14:52:01 +01:00
Ralf HaferkampandRalf Haferkamp ace1d70ba8 Fix wrong log-level for debug output 2023-09-06 08:32:34 +02:00
Ralf HaferkampandRalf Haferkamp c0181f8144 graph: honor the OCIS_LDAP_GROUP_SCHEMA_MEMBER setting
Fixes: #7032
2023-08-17 11:06:34 +02:00
Michael Barz 58d8c1aa8a fix disable users by group 2023-06-02 17:42:51 +02:00
Roman Perekhod 11e51b9812 Omitempty givenName attribute when creating user #5431 2023-05-09 16:40:23 +02:00
Ralf Haferkamp 046895a831 graph: Allow disabling users via groupmember ship on "read-only" server
When GRAPH_LDAP_SERVER_WRITE_ENABLED is set to false we still allow updates
of the accountEnabled property when OCIS_LDAP_DISABLE_USER_MECHANISM is set
to "group"

Partial-Fix: #6219
2023-05-08 16:17:25 +02:00
Ralf Haferkamp 4b501e93a4 graph/users: Avoid to leak LDAP error messages to the client 2023-05-08 16:17:25 +02:00
Ralf HaferkampandGitHub f1dbe439a1 graph-ldap: Fix possible races when editing group membership in parallel (#6214)
As the standard LDAP groups (groupOfNames) require at least one "member"
value to be present in a group, we have workarounds in place that add an
empty member ("") when creating a new group or when removing the last
member from the group. This can cause a race condition when e.g. multiple
request to remove members from a group an running in parallel, as we need
to read the group before we can construct the modification request. If
some other request modified the group (e.g. deleted the 2nd last member)
after we read it, we create non-working modification request.

These changes try to catch those errors and retry the modification
request once.

Fixes: #6170
2023-05-03 15:30:10 +02:00
Ralf HaferkampandRalf Haferkamp 1ad31218ec graph: Allow using binary LDAP UUIDs as user ids
In Active Directories UUID attributes such as "objectGUID" use a binary
syntax (oposed to the standard UUID syntax defined in RFC4530). This
introduces a flag to enable support for binary UUIDs as the id for users
and groups (similar to what the "users" and "groups" services already
support)

Fixes: #5815
2023-05-03 09:32:05 +02:00
Ralf HaferkampandRalf Haferkamp 120887abcc graph: new config option GRAPH_LDAP_GROUP_CREATE_BASE_DN
By setting GRAPH_LDAP_GROUP_CREATE_BASE_DN a distinct subtree can be
configured where new LDAP groups are created. That subtree needs to be
subordinate to GRAPH_LDAP_GROUP_BASE_DN. All groups outside for
GRAPH_LDAP_GROUP_CREATE_BASE_DN are considered read-only and only groups
below that DN can be updated and deleted.

This is introduced for a pretty specific usecase where most groups are managed
in an external source (e.g. a read-only replica of an LDAP tree). But we still
want to allow the local administrator to create groups in a writeable subtree
attached to that replica.
2023-04-04 15:56:57 +02:00
Daniel Swärd c765e904df Refactor user update methods to be a bit nicer. 2023-03-17 11:03:38 +01:00
Daniel Swärd 525638588d graph: Fix so that accountEnabled updates work for educationUser. 2023-03-17 10:16:39 +01:00
Daniel SwärdandRalf Haferkamp 6f7bd454b2 Fix so that userType is not returned if not available. 2023-03-15 12:05:29 +01:00
Daniel SwärdandRalf Haferkamp 23ba180e8a graph: Use userType property to distinguish between Member and Guest accounts
Fixes 5603

- Calling POST /graph/v1.0/users with userType not set will create a user as "Member"
- Calling POST /graph/v1.0/users with userType set as "Member" or "Guest" will create a user as "Member" or "Guest"
- Calling POST /graph/v1.0/users with userType set as anything but "Member" or "Guest" returns error
- Calling POST /graph/v1.0/education/users with userType not set will create a user as "Member"
- Calling POST /graph/v1.0/education/users with userType set as "Member" will create a user as "Member" and primary role as parameter specifies
- Calling POST /graph/v1.0/education/users with userType set as "Guest" will create a user as "Guest" and primary role as parameter specifies
- Calling POST /graph/v1.0/education/users with userType not set as anything but "Member" or "Guest" returns error
- Calling PATCH on /users or /education/users will update attribute in the same way as for POST
2023-03-15 12:05:29 +01:00
Daniel SwärdandRalf Haferkamp 6b11f0bfe4 graph: Fix problem with unescaped semicolon and such causing problems. 2023-03-14 15:21:58 +01:00
Ralf HaferkampandGitHub d133a8e4b2 graph: Add missing patch support for education/users (#5772)
* graph: Allow updating "surname" and "givenName" of users

Also use attribute getters to lookup the attribute Values instead of fiddling around
with pointers.

* graph: Allow updating education users

Update suppport for education users was still missing.
2023-03-09 07:52:06 +01:00
Daniel Swärd ca746106d8 graph: Allow disabling user by adding to local group
* A new config option for disabling users with the options "none", "attribute" and "group".
* When set to "none", there will be no enabledAttribute returned in user info and trying to change enabledAttribute will return an error
* Disable/enable group name DN as config parameter
* Adding/removing users to specified group on user update
* Changing log level for service initialization failure to error
* Adding helper methods to check if user is enabled/disabled + tests

Fixes #5554
2023-03-06 09:31:23 +01:00
Daniël FrankeandRalf Haferkamp 3f39bb530e Integrate feedback. 2023-02-20 14:40:10 +01:00
Daniël FrankeandRalf Haferkamp bea3ec6207 Add refint support to user rename.
When refint is enabled on an LDAP server, it will rename all references
to an entity if its DN is modified. If this happens, the member
renames will not be needed, and will also return an error.

This PR does the following:

* Detects the attribute error, and don't return an error.
* Log that the server has been misconfigured.
* Add config value that skips renaming if set.
2023-02-20 14:40:10 +01:00
Daniel SwärdandGitHub fcf5783a1b graph: Add accountEnabled flag to ldap backend. (#5588)
* graph: Add accountEnabled flag to ldap backend.

* Add missing accountEnabled attribute to user listing.
2023-02-17 13:48:12 +01:00
Daniël FrankeandRalf Haferkamp 92f4d60a06 Properly generate new DN.
This fixes issue #5581 by properly parsing the old DN and replacing the
first part with the new DN.
2023-02-16 12:41:29 +01:00
Daniël FrankeandRalf Haferkamp 9bd1551c6b Integrate @rhafer's feedback 2023-02-15 10:06:23 +01:00
Daniël FrankeandRalf Haferkamp bed4a82ff0 Finish working code and most of tests. 2023-02-15 10:06:23 +01:00
Daniël FrankeandRalf Haferkamp a51393e5bf Add username changing functionality.
This is an incomplete implementation of username changing code.

The things still needed to be finished:

* The method that changes the member attribute has to be filled in.
* The functionality needs to be tested.
* Unit tests need to be added.
2023-02-15 10:06:23 +01:00
Daniel Swärd 2338515444 Make ldap functions package local and remove a superfluous comment. 2023-02-10 15:12:19 +01:00
Daniel Swärd 4c1325f02a Remove duplication and make method generic. 2023-02-09 11:56:10 +01:00
Daniel Swärd 399e05b256 Remove code duplication for ldap entry membership. 2023-02-09 11:38:50 +01:00
Ralf HaferkampandRalf Haferkamp 26f7523ff8 graph: Pass parsed odata request to the identity backend
In preparation for some more advanced queries pass the parse odata request
tVo the identity backend methods instead of the raw url.Values{}. This also
add some helpers for validating $expand and $search queries to reject
some unsupported queries.

Also remove support for `$select=memberOf` and `$select=drive|drives` queries
and stick to the technically correct `$expand=...`.
2023-02-08 14:25:55 +01:00
Jörn Friedrich DreyerandGitHub 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