forked from fixin.me/fixin.me
Update permission checking
This commit is contained in:
@@ -1,11 +1,30 @@
|
||||
class Default::UnitsController < ApplicationController
|
||||
navigation_tab :units
|
||||
|
||||
before_action :find_unit, only: [:import, :export, :destroy]
|
||||
|
||||
before_action except: :index do
|
||||
raise AccessForbidden unless current_user.at_least(:admin)
|
||||
case action_name.to_sym
|
||||
when :import, :import_all
|
||||
raise AccessForbidden unless current_user.at_least(:active)
|
||||
else
|
||||
raise AccessForbidden unless current_user.at_least(:admin)
|
||||
end
|
||||
end
|
||||
|
||||
def index
|
||||
@units = current_user.units.defaults_diff
|
||||
end
|
||||
|
||||
def import
|
||||
end
|
||||
|
||||
def import_all
|
||||
end
|
||||
|
||||
def export
|
||||
end
|
||||
|
||||
def destroy
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user