-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
115/If current user has role user show only vms associated to user #247
Conversation
app/controllers/vms_controller.rb
Outdated
@@ -31,7 +35,8 @@ def new | |||
|
|||
def show | |||
@vm = VmApi.instance.get_vm_info(params[:id]) | |||
render(template: 'errors/not_found', status: :not_found) if @vm.nil? | |||
return render(template: 'errors/not_found', status: :not_found) if @vm.nil? | |||
return redirect_to vms_path unless !current_user.user? || current_user.vms.include?(@vm) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you refactor this to a before_action?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can also use this for edit...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See Lasses comment.
Fixes #115