-
Notifications
You must be signed in to change notification settings - Fork 7
[MM-63516] Target LegalHold users by groups #137
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
Merged
davidkrauser
merged 26 commits into
mattermost:main
from
davidkrauser:specify-with-groups
Jul 8, 2025
Merged
Changes from all commits
Commits
Show all changes
26 commits
Select commit
Hold shift + click to select a range
2241c02
Ignore aider files
davidkrauser 511d72e
Add API to search for groups by display name
davidkrauser afa23cd
Don't loop forever on job execution error
davidkrauser 62319cf
Add group IDs to legal hold struct
davidkrauser 07e8c0d
Process group members in legal hold execution
davidkrauser 522a525
Add group input component with name autocomplete
davidkrauser 8975922
Add API call to retrieve relevant group info
davidkrauser 3cff45a
Add group input fields to legalhold forms
davidkrauser eea0ae0
Show group information in legalhold table
davidkrauser 12ca57f
Fix lint issues
davidkrauser a1eed90
Fix failing test
davidkrauser 88b47cd
Move searchGroups to client.ts
davidkrauser a1bcfab
Drop unused import
davidkrauser d8ed3c8
Comment complex map/reduce/filter
davidkrauser 2b53683
Fix lint errors
davidkrauser 437fe94
Search should only return LDAP groups
davidkrauser ba07b45
Specify groups are LDAP in frontend labels
davidkrauser 1aca911
Support searching LDAP groups by @name
davidkrauser 988d43e
Merge branch 'main' into specify-with-groups
davidkrauser 08de4ac
Merge branch 'main' into specify-with-groups
davidkrauser 1ea8ffb
Update license request with new required fields
davidkrauser b627921
Revert "Update license request with new required fields"
davidkrauser 7edc185
Merge branch 'main' into specify-with-groups
davidkrauser 15d9b9e
Merge branch 'main' into specify-with-groups
davidkrauser 38f7e44
Fix broken bits from merge
davidkrauser fae7d23
Fix lint issues
davidkrauser File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -19,4 +19,4 @@ dist/ | |
| .idea/ | ||
|
|
||
| processor/temp | ||
| .aider* | ||
| .aider* | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,54 @@ | ||
| package sqlstore | ||
|
|
||
| import ( | ||
| "strings" | ||
|
|
||
| sq "github.com/Masterminds/squirrel" | ||
| "github.com/pkg/errors" | ||
|
|
||
| "github.com/mattermost/mattermost-server/v6/model" | ||
| ) | ||
|
|
||
| var escapeLikeSearchChar = []string{ | ||
| "%", | ||
| "_", | ||
| } | ||
|
|
||
| func sanitizeSearchTerm(term string) string { | ||
| const escapeChar = "\\" | ||
|
|
||
| term = strings.ReplaceAll(term, escapeChar, "") | ||
|
|
||
| for _, c := range escapeLikeSearchChar { | ||
| term = strings.ReplaceAll(term, c, escapeChar+c) | ||
| } | ||
|
|
||
| return term | ||
| } | ||
|
|
||
| func (ss SQLStore) SearchLDAPGroupsByPrefix(prefix string) ([]*model.Group, error) { | ||
| sanitizedPrefix := strings.ToLower(sanitizeSearchTerm(prefix)) | ||
| query := ss.replicaBuilder. | ||
| Select("Id", "Name", "DisplayName", "DeleteAt"). | ||
| From("UserGroups"). | ||
| Where(sq.Or{ | ||
| sq.Like{"LOWER(DisplayName)": sanitizedPrefix + "%"}, | ||
| sq.Like{"LOWER(Name)": sanitizedPrefix + "%"}, | ||
| }). | ||
| Where(sq.Eq{"DeleteAt": 0}). | ||
|
davidkrauser marked this conversation as resolved.
|
||
| Where(sq.Eq{"Source": "ldap"}). | ||
| OrderBy("DisplayName"). | ||
| Limit(10) | ||
|
|
||
| sql, args, err := query.ToSql() | ||
| if err != nil { | ||
| return nil, errors.Wrap(err, "failed to build SQL query for searching groups") | ||
| } | ||
|
|
||
| var groups []*model.Group | ||
| if err := ss.replica.Select(&groups, sql, args...); err != nil { | ||
| return nil, errors.Wrap(err, "failed to search groups") | ||
| } | ||
|
|
||
| return groups, nil | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.