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
bdfae5d4
Commit
bdfae5d4
authored
10 years ago
by
Cam Saul
Browse files
Options
Downloads
Patches
Plain Diff
`req`
parent
02fa1c72
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/api/common.clj
+5
-1
5 additions, 1 deletion
src/metabase/api/common.clj
src/metabase/api/common/internal.clj
+0
-7
0 additions, 7 deletions
src/metabase/api/common/internal.clj
src/metabase/api/user.clj
+4
-4
4 additions, 4 deletions
src/metabase/api/user.clj
with
9 additions
and
12 deletions
src/metabase/api/common.clj
+
5
−
1
View file @
bdfae5d4
...
...
@@ -206,12 +206,16 @@
`
(
defmethod
arg-annotation-fn
~
(
keyword
annotation-name
)
[
~
'_
~
binding
]
`
(
do
~~@
body
)))
;; `required` just calls require-params
(
defannotation
required
[
param
]
`
(
require-params
~
param
)
param
)
;; `req` is an alias for `required`
(
defannotation
req
[
param
]
`
(
require-params
~
param
)
param
)
;;; ### defendpoint
...
...
This diff is collapsed.
Click to expand it.
src/metabase/api/common/internal.clj
+
0
−
7
View file @
bdfae5d4
...
...
@@ -205,13 +205,6 @@
(
map
(
fn
[
annotation
]
[(
keyword
annotation
)
(
symbol
arg
)]))))))
(
defn
args-form->arg+annotations-pairs
[
annotated-args-form
]
{
:pre
[(
vector?
annotated-args-form
)]}
(
->>
annotated-args-form
args-form->symbols
(
mapcat
symb->arg+annotations
)))
;;; ### let-annotated-args
...
...
This diff is collapsed.
Click to expand it.
src/metabase/api/user.clj
+
4
−
4
View file @
bdfae5d4
...
...
@@ -21,12 +21,13 @@
(
hydrate
[
:org_perms
:organization
])))
(
defendpoint
GET
"/:id"
[
id
fish.required
]
(
defendpoint
GET
"/:id"
[
id
]
;; user must be getting their own details OR they must be a superuser to proceed
(
check-403
(
or
(
=
id
*current-user-id*
)
(
:is_superuser
@
*current-user*
)))
(
check-404
(
sel
:one
User
:id
id
)))
(
defannotation
email
[
email
]
`
(
require-params
~
email
)
`
(
check
(
is-email?
~
email
)
[
400
(
format
~
(
str
(
name
email
)
" '%s' is not a valid email."
)
~
email
)])
email
)
...
...
@@ -40,11 +41,11 @@
(
mapply
upd
User
id
)))
(
sel
:one
User
:id
id
))
(
defannotation
complex-p
assword
[
password
]
(
defannotation
complex-p
w
[
password
]
`
(
check
(
password/is-complex?
~
password
)
[
400
"Insufficient password strength"
])
password
)
(
defendpoint
PUT
"/:id/password"
[
id
:as
{{
:keys
[
password.req
uired
.complex-p
assword
old_password.req
uired
]}
:body
}]
(
defendpoint
PUT
"/:id/password"
[
id
:as
{{
:keys
[
password.req.complex-p
w
old_password.req
]}
:body
}]
(
require-params
password
old_password
)
(
check-403
(
or
(
=
id
*current-user-id*
)
(
:is_superuser
@
*current-user*
)))
...
...
@@ -53,5 +54,4 @@
(
set-user-password
id
password
)
(
sel
:one
User
:id
id
))
(
define-routes
)
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