Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
M
Metabase
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Engineering Digital Service
Metabase
Commits
7837070b
Unverified
Commit
7837070b
authored
2 years ago
by
Noah Moss
Committed by
GitHub
2 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Fix semantics of group mapping query (#29738)
* test case * fix query and split out test case
parent
f401d1cc
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/metabase/integrations/common.clj
+5
-3
5 additions, 3 deletions
src/metabase/integrations/common.clj
test/metabase/integrations/common_test.clj
+7
-0
7 additions, 0 deletions
test/metabase/integrations/common_test.clj
with
12 additions
and
3 deletions
src/metabase/integrations/common.clj
+
5
−
3
View file @
7837070b
...
...
@@ -25,9 +25,11 @@
user-id
(
u/the-id
user-or-id
)
current-group-ids
(
when
(
seq
mapped-group-ids
)
(
t2/select-fn-set
:group_id
PermissionsGroupMembership
:user_id
user-id
:group_id
[
:in
mapped-group-ids
]
:group_id
[
:not-in
excluded-group-ids
]))
{
:where
[
:and
[
:=
:user_id
user-id
]
[
:in
:group_id
mapped-group-ids
]
[
:not-in
:group_id
excluded-group-ids
]]}))
new-group-ids
(
set/intersection
(
set
(
map
u/the-id
new-groups-or-ids
))
mapped-group-ids
)
;; determine what's different between current mapped groups and new mapped groups
...
...
This diff is collapsed.
Click to expand it.
test/metabase/integrations/common_test.clj
+
7
−
0
View file @
7837070b
...
...
@@ -107,6 +107,13 @@
(
with-user-in-groups
[
user
[]]
(
integrations.common/sync-group-memberships!
user
#
{(
perms-group/admin
)}
#
{(
perms-group/admin
)})
(
is
(
=
#
{
"All Users"
"Administrators"
}
(
group-memberships
user
)))))
(
testing
"unmapped admin group is ignored even if other groups are added (#29718)"
(
with-user-in-groups
[
group
{
:name
(
str
::group
)}
user
[(
perms-group/admin
)]]
(
integrations.common/sync-group-memberships!
user
#
{
group
}
#
{
group
})
(
is
(
=
#
{
"All Users"
"Administrators"
":metabase.integrations.common-test/group"
}
(
group-memberships
user
)))))))
(
testing
"Make sure the delete last admin exception is catched"
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment