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
dd854970
Unverified
Commit
dd854970
authored
3 years ago
by
Noah Moss
Committed by
GitHub
3 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Remove permission path validation from specific functions to preserve downgradability (#21040)
parent
2f822f05
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
src/metabase/models/collection.clj
+1
-1
1 addition, 1 deletion
src/metabase/models/collection.clj
src/metabase/models/permissions.clj
+3
-3
3 additions, 3 deletions
src/metabase/models/permissions.clj
test/metabase/models/permissions_test.clj
+1
-12
1 addition, 12 deletions
test/metabase/models/permissions_test.clj
with
5 additions
and
16 deletions
src/metabase/models/collection.clj
+
1
−
1
View file @
dd854970
...
...
@@ -245,7 +245,7 @@
Because the result may include `nil` for the Root Collection, or may be `:all`, MAKE SURE YOU HANDLE THOSE
SITUATIONS CORRECTLY before using these IDs to make a DB call. Better yet, use
[[visible-collection-ids->honeysql-filter-clause]] to generate appropriate HoneySQL."
[
permissions-set
:-
#
{
perms/Path
}
]
[
permissions-set
]
(
if
(
contains?
permissions-set
"/"
)
:all
(
set
...
...
This diff is collapsed.
Click to expand it.
src/metabase/models/permissions.clj
+
3
−
3
View file @
dd854970
...
...
@@ -477,18 +477,18 @@
(
s/defn
set-has-full-permissions-for-set?
:-
s/Bool
"Do the permissions paths in `permissions-set` grant *full* access to all the object paths in `paths-set`?"
[
permissions-set
:-
#
{
Path
}
paths-set
:-
#
{
Path
}
]
[
permissions-set
paths-set
]
(
every?
(
partial
set-has-full-permissions?
permissions-set
)
paths-set
))
(
s/defn
set-has-partial-permissions-for-set?
:-
s/Bool
"Do the permissions paths in `permissions-set` grant *partial* access to all the object paths in `paths-set`?
(`permissions-set` must grant partial access to *every* object in `paths-set` set)."
[
permissions-set
:-
#
{
Path
}
,
paths-set
:-
#
{
Path
}
]
[
permissions-set
paths-set
]
(
every?
(
partial
set-has-partial-permissions?
permissions-set
)
paths-set
))
(
s/defn
perms-objects-set-for-parent-collection
:-
#
{
Path
}
(
s/defn
perms-objects-set-for-parent-collection
"Implementation of `IModel` `perms-objects-set` for models with a `collection_id`, such as Card, Dashboard, or Pulse.
This simply returns the `perms-objects-set` of the parent Collection (based on `collection_id`) or for the Root
Collection if `collection_id` is `nil`."
...
...
This diff is collapsed.
Click to expand it.
test/metabase/models/permissions_test.clj
+
1
−
12
View file @
dd854970
...
...
@@ -463,18 +463,7 @@
[
perms
paths
]
inputs
]
(
testing
(
pr-str
(
list
'set-has-full-permissions-for-set?
perms
paths
))
(
is
(
=
expected
(
perms/set-has-full-permissions-for-set?
perms
paths
)))))
(
testing
"If either set is invalid, it should throw an exception"
(
doseq
[[
perms
paths
]
[[
#
{
"/"
"/toucans/"
}
#
{
"/db/1/"
}]
[
#
{
"/db/1/"
"//"
}
#
{
"/db/1/"
}]
[
#
{
"/db/1/table/2/"
"/db/1/"
}
#
{
"/db/1/"
}]
[
#
{
"/db/1/"
}
#
{
"/db/1/native/schema/"
}]
[
#
{
"/db/1/"
}
#
{
"/db/1/schema/public/"
"/kanye/"
}]
[
#
{
"/db/1/"
}
#
{
"/ocean/"
"/db/1/schema/public/table/1/"
}]]]
(
is
(
thrown?
clojure.lang.ExceptionInfo
(
perms/set-has-full-permissions-for-set?
perms
paths
))))))
(
perms/set-has-full-permissions-for-set?
perms
paths
))))))
;;; -------------------------------------- set-has-partial-permissions-for-set? --------------------------------------
...
...
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