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
f8ce69b6
Commit
f8ce69b6
authored
9 years ago
by
Cam Saul
Browse files
Options
Downloads
Patches
Plain Diff
fix annoying redirect to setup when developing
parent
d784c224
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
src/metabase/db.clj
+2
-1
2 additions, 1 deletion
src/metabase/db.clj
src/metabase/routes.clj
+3
-3
3 additions, 3 deletions
src/metabase/routes.clj
src/metabase/setup.clj
+8
-5
8 additions, 5 deletions
src/metabase/setup.clj
with
13 additions
and
9 deletions
src/metabase/db.clj
+
2
−
1
View file @
f8ce69b6
...
...
@@ -439,7 +439,8 @@
[
entity
&
{
:as
kwargs
}]
`
(
not
(
empty?
(
select
(
entity->korma
~
entity
)
(
fields
[
:id
])
(
where
~
kwargs
)
~@
(
when
(
seq
kwargs
)
`
[(
where
~
kwargs
)])
(
limit
1
)))))
;; ## CASADE-DELETE
...
...
This diff is collapsed.
Click to expand it.
src/metabase/routes.clj
+
3
−
3
View file @
f8ce69b6
...
...
@@ -5,9 +5,9 @@
[
metabase.api.routes
:as
api
]
[
metabase.setup
:as
setup
]))
(
let
[
redirect-to-setup?
(
fn
[{
:keys
[
uri
]}]
; Redirect naughty users who try to visit a page other than setup
(
and
(
setup/
token-exists?
)
; if setup is not yet
complete
;; Redirect naughty users who try to visit a page other than setup if setup is not yet complete
(
let
[
redirect-to-setup?
(
fn
[{
:keys
[
uri
]}]
(
and
(
setup/
in
complete
?
)
(
not
(
re-matches
#
"^/setup/.*$"
uri
))))
index
(
fn
[
request
]
(
if
(
redirect-to-setup?
request
)
(
resp/redirect
(
format
"/setup/init/%s"
(
setup/token-value
)))
...
...
This diff is collapsed.
Click to expand it.
src/metabase/setup.clj
+
8
−
5
View file @
f8ce69b6
(
ns
metabase.setup
)
(
ns
metabase.setup
(
:require
[
metabase.db
:as
db
]
[
metabase.models.user
:refer
[
User
]]))
(
def
^
:private
setup-token
(
def
once
^
:private
setup-token
(
atom
nil
))
(
defn
token-value
...
...
@@ -8,10 +10,11 @@
[]
@
setup-token
)
(
defn
token-exists
?
"Return `true` if a setup token exists."
(
defn
incomplete
?
"Return `true` if a setup token exists
and no `Users` exist in the DB
."
[]
(
boolean
@
setup-token
))
(
and
@
setup-token
(
not
(
db/exists?
User
))))
(
defn
token-match?
"Function for checking if the supplied string matches our setup token.
...
...
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