Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
mirror
chef
Commits
7a095973
Commit
7a095973
authored
Oct 29, 2011
by
Bryan McLellan
Browse files
CHEF-2649: Only allow admin clients to create admins (not validators)
parent
faad1a96
Changes
1
Hide whitespace changes
Inline
Side-by-side
chef-server-api/app/controllers/clients.rb
View file @
7a095973
...
...
@@ -49,13 +49,13 @@ class Clients < Application
exists
=
true
if
params
.
has_key?
(
:inflated_object
)
params
[
:name
]
||=
params
[
:inflated_object
].
name
# We can only get here if we're admin or the validator. Only
# allow creating admin clients if we're already an admin.
if
@auth_user
.
admin
params
[
:admin
]
||=
params
[
:inflated_object
].
admin
else
params
[
:admin
]
=
fals
e
end
params
[
:admin
]
||=
params
[
:inflated_object
].
admin
end
# We can only create clients if we're the admin or the validator.
# But only allow creating admin clients if we're already an admin.
if
params
[
:admin
]
=
=
true
&&
@auth_user
.
admin
!=
tru
e
raise
Forbidden
,
"You are not allowed to take this action."
end
begin
...
...
Write
Preview
Supports
Markdown
0%
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!
Cancel
Please
register
or
sign in
to comment