Repository navigation
feat(graph): [k6-test][OCISDEV-1671] show school role and home school in sharee search - #13618
gauravsoni119 wants to merge 4 commits into
Conversation
✅ Snyk checks have passed. No issues have been found so far.
💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse. |
7190089 to
dc169bf
Compare
| for _, u := range users { | ||
| ids = append(ids, u.GetId()) | ||
| } | ||
| schoolInfoByID, err := g.identityBackend.GetSchoolInfo(ctx, ids) |
There was a problem hiding this comment.
Have you checked how much this affects search speed?
There was a problem hiding this comment.
Thanks for raising this. I hadn't measured it before, so I did now on the ocis_multi example (OpenLDAP, 206 users). The search returned 200 results, as a non-admin caller, with 10 warm-up + 100 timed requests per run:
| median | p95 | |
|---|---|---|
| settings off (3 runs) | 89.2 / 91.1 / 91.1 ms | 106 / 124 / 117 ms |
schoolRole + homeSchool on (2 runs) |
94.0 / 93.4 ms | 109 / 112 ms |
That's about +3 ms (~3%) on the median for 200 results; p95 is within noise.
Why it stays small:
- The school info is fetched with one batched LDAP query for all result users (OR filter on the user ID, 3 attributes), not one query per user.
- The school number goes through the existing cached instance mapper, so usually there's no extra lookup.
- The caller's locale is resolved once per request.
- Nothing runs unless
schoolRoleorhomeSchoolis listed inOCIS_USER_SEARCH_DISPLAYED_ATTRIBUTES.
There was a problem hiding this comment.
Could you run k6 load test against a branch?
There was a problem hiding this comment.
Could you run k6 load test against a branch?
The k6 pipeline is green: https://github.com/owncloud/ocis/actions/runs/47070783434
dc169bf to
c8d9276
Compare
c8d9276 to
5cf8553
Compare
2403905
left a comment
There was a problem hiding this comment.
Review
I read the diff only. I did not run the tests or the build.
Important
services/graph/pkg/service/v0/users.go(schoolAttributes): A failure of the batched school lookup is hidden.- The code logs the error at Debug level.
- The handler returns 200 without
schoolRoleandhomeSchool. - A large user list creates one very large LDAP filter. The server can reject it.
- Fix: log at Warn level. Split the user IDs into chunks of 100 to 200.
Minor
services/graph/pkg/config/config.go: The description ofGRAPH_USER_SEARCH_SCHOOL_ROLE_MAPPINGnames the attributeuserClass.GRAPH_LDAP_USER_SCHOOL_ROLE_ATTRIBUTEcan change this attribute.- Fix: refer to the configured attribute in the description.
services/graph/pkg/config/config.go: The description ofOCIS_USER_SEARCH_DISPLAYED_ATTRIBUTESdoes not list the prerequisites ofhomeSchool.homeSchoolis empty whenInstanceURLTemplateorCrossInstanceReferenceTemplateis not set.homeSchoolis also empty whenOCIS_LDAP_INSTANCE_MAPPER_ENABLEDis false.- Fix: list these prerequisites in the description.
services/graph/pkg/identity/ldap.go(GetSchoolInfo): The attribute list always containsuserMemberAttribute. This value can be an empty string.- Some LDAP servers reject an empty attribute name.
- Fix: add the attribute only when it is not empty.
services/graph/pkg/identity/ldap.go(resolveMemberInstanceName): The function logs a Warn line for each unresolvable member value.GetSchoolInfocalls it for each user in each search. The log can fill up.- Fix: log at Debug level in this path.
services/graph/pkg/service/v0/users.go:schoolAttributesruns beforefilterOutPrivateUserAttrs.- Users with only the identity-search permission also get
schoolRoleandhomeSchool. - Please confirm that this is intended. Document it in the changelog.
- Users with only the identity-search permission also get
5cf8553 to
83e3c73
Compare
Thanks for the review! All addressed in 83e3c73:
|
…e search The share dialog's user search showed the name twice plus "Member", so sharers couldn't tell students from teachers or see their school. Graph can now add a translated school role and the home-school number to each result, enabled through OCIS_USER_SEARCH_DISPLAYED_ATTRIBUTES. Signed-off-by: Gaurav Soni <sonigaurav119@gmail.com>
Large user searches no longer build one huge LDAP filter: the school lookup now queries in chunks of 200 IDs. A failed lookup is logged as a warning, unresolved schools no longer warn on every search, and the setting descriptions now state the configurable role attribute and what the home school needs. Signed-off-by: Gaurav Soni <sonigaurav119@gmail.com>
83e3c73 to
622c1ed
Compare
|
@gauravsoni119 Please check if the school data can come from the main user search. Then Why this seems possible
What blocks it
What you get
Please check
|
…earch The school role and home school now come from the LDAP entries the user search already fetches, through a request-scoped collector, instead of a second batched lookup. Every search route makes one LDAP query, the role attribute is only requested when the response shows it, and the identity backend interface is unchanged from master. Signed-off-by: Gaurav Soni <sonigaurav119@gmail.com>
thanks! Done in bf17930, with one adjustment: the Safe search uses Instead, GetUsers puts a request-scoped collector into the context (only when schoolRole/homeSchool is displayed), and the LDAP backend fills it from the entries the search already fetches. The role attribute is only requested when a collector is present, GetSchoolInfo and the batching are gone, and the Backend interface is unchanged from master. |
A user who is a member of several schools now always shows the same home school, the smallest resolved school number, instead of whichever value the directory returned first. The school-info collector also no longer lets an empty value replace one that was already recorded for the same user. Signed-off-by: Gaurav Soni <sonigaurav119@gmail.com>
Description
The Graph user search, used by the share dialog in Drive and Safe, can now show a sharee's school role ("Teacher"/"Student", translated) and home-school number as the second line of each result, e.g.
max.muster · Teacher · 1234. Administrators opt in by listing the new valuesschoolRoleandhomeSchoolinOCIS_USER_SEARCH_DISPLAYED_ATTRIBUTES. Two new settings control the role:GRAPH_USER_SEARCH_SCHOOL_ROLE_MAPPINGmaps directory values to teacher/student, andGRAPH_LDAP_USER_SCHOOL_ROLE_ATTRIBUTE(defaultuserClass) names the LDAP attribute to read. Without these settings, the search behaves exactly as before.Related Issue
Motivation and Context
The second line only repeated the name and showed "Member", so with many identical names sharers couldn't tell students from teachers or see which school a person belongs to.
How Has This Been Tested?
ocis_multiexample, setOCIS_USER_SEARCH_DISPLAYED_ATTRIBUTES=onPremisesSamAccountName,schoolRole,homeSchool,GRAPH_USER_SEARCH_SCHOOL_ROLE_MAPPING=ocisSpaceAdmin:teacher,ocisAdmin:teacher,ocisUser:studentandGRAPH_LDAP_USER_SCHOOL_ROLE_ATTRIBUTE=ownCloudRole, then searchkatin the share dialog: the result showskatherine · Teacher · ocis.marie@ocis.ocm.owncloud.test: the result showsmarie · Student · ocis.ocm, with the other instance as her home school.adm: the result showsadmin · Teacherand no school, because the master ID doesn't resolve to an instance."attributes": [], as before.Screenshots (if appropriate):
N.A
Types of changes
Checklist: