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
bdbfb2e2
Unverified
Commit
bdbfb2e2
authored
6 years ago
by
Cam Saul
Browse files
Options
Downloads
Patches
Plain Diff
Fix GSG now that Dashboards require collection_id for read perms check
parent
0d868c28
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/metabase/api/getting_started.clj
+5
-2
5 additions, 2 deletions
src/metabase/api/getting_started.clj
test/metabase/api/getting_started_test.clj
+40
-0
40 additions, 0 deletions
test/metabase/api/getting_started_test.clj
with
45 additions
and
2 deletions
src/metabase/api/getting_started.clj
+
5
−
2
View file @
bdbfb2e2
(
ns
metabase.api.getting-started
"/api/getting_started routes."
(
:require
[
compojure.core
:refer
[
GET
]]
[
medley.core
:as
m
]
[
metabase.api.common
:as
api
]
[
metabase.models
[
interface
:as
mi
]
[
setting
:refer
[
defsetting
]]]
[
metabase.util
:as
u
]
[
puppetlabs.i18n.core
:refer
[
tru
]]
[
toucan.db
:as
db
]))
...
...
@@ -27,9 +29,10 @@
{
:things_to_know
(
getting-started-things-to-know
)
:contact
{
:name
(
getting-started-contact-name
)
:email
(
getting-started-contact-email
)}
:most_important_dashboard
(
when-let
[
dashboard
(
db/select-one
[
'Dashboard
:id
]
:show_in_getting_started
true
)]
:most_important_dashboard
(
when-let
[
dashboard
(
db/select-one
[
'Dashboard
:id
:collection_id
]
:show_in_getting_started
true
)]
(
when
(
mi/can-read?
dashboard
)
(
:
id
dashboard
)))
(
u/get-
id
dashboard
)))
:important_metrics
metric-ids
:important_tables
table-ids
:important_segments
segment-ids
...
...
This diff is collapsed.
Click to expand it.
test/metabase/api/getting_started_test.clj
0 → 100644
+
40
−
0
View file @
bdbfb2e2
(
ns
metabase.api.getting-started-test
(
:require
[
expectations
:refer
[
expect
]]
[
metabase.models
[
collection
:refer
[
Collection
]]
[
dashboard
:refer
[
Dashboard
]]
[
permissions
:as
perms
]
[
permissions-group
:as
group
]]
[
metabase.test.data.users
:as
test-users
]
[
metabase.util
:as
u
]
[
toucan.util.test
:as
tt
]))
;; make sure that we can fetch the GSG stuff with a 'show in getting started' Dashboard
;; ...but you shouldn't know about it if you don't have read perms for it
(
expect
{
:things_to_know
nil
:contact
{
:name
nil,
:email
nil
}
:most_important_dashboard
false
:important_metrics
[]
:important_tables
[]
:important_segments
[]
:metric_important_fields
{}}
(
tt/with-temp
Dashboard
[
_
{
:show_in_getting_started
true
}]
(
->
((
test-users/user->client
:rasta
)
:get
200
"getting_started"
)
(
update
:most_important_dashboard
integer?
))))
;; ...but if you do have read perms, then you should get to see it!
(
expect
{
:things_to_know
nil
:contact
{
:name
nil,
:email
nil
}
:most_important_dashboard
true
:important_metrics
[]
:important_tables
[]
:important_segments
[]
:metric_important_fields
{}}
(
tt/with-temp*
[
Collection
[
collection
]
Dashboard
[
_
{
:collection_id
(
u/get-id
collection
)
:show_in_getting_started
true
}]]
(
perms/grant-collection-read-permissions!
(
group/all-users
)
collection
)
(
->
((
test-users/user->client
:rasta
)
:get
200
"getting_started"
)
(
update
:most_important_dashboard
integer?
))))
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