Class: BsmOa::AuthorizationsController

Inherits:
AdminController show all
Defined in:
app/controllers/bsm_oa/authorizations_controller.rb

Instance Method Summary collapse

Instance Method Details

#createObject



29
30
31
32
# File 'app/controllers/bsm_oa/authorizations_controller.rb', line 29

def create
  @authorization = resource_scope.create permitted_params
  respond_with @authorization
end

#destroyObject



46
47
48
49
50
# File 'app/controllers/bsm_oa/authorizations_controller.rb', line 46

def destroy
  @authorization = resource_scope.find params[:id]
  @authorization.destroy
  respond_with @authorization, location: @authorization.role
end

#editObject



24
25
26
27
# File 'app/controllers/bsm_oa/authorizations_controller.rb', line 24

def edit
  @authorization = resource_scope.find params[:id]
  respond_with @authorization
end

#indexObject



9
10
11
12
# File 'app/controllers/bsm_oa/authorizations_controller.rb', line 9

def index
  @authorizations = apply_scopes(resource_scope)
  respond_with @authorizations
end

#newObject



19
20
21
22
# File 'app/controllers/bsm_oa/authorizations_controller.rb', line 19

def new
  @authorization = resource_scope.new
  respond_with @authorization
end

#showObject



14
15
16
17
# File 'app/controllers/bsm_oa/authorizations_controller.rb', line 14

def show
  @authorization = resource_scope.find params[:id]
  respond_with @authorization
end

#toggleObject



40
41
42
43
44
# File 'app/controllers/bsm_oa/authorizations_controller.rb', line 40

def toggle
  @authorization = resource_scope.find params[:id]
  @authorization.toggle_permission!(params[:permission])
  respond_with @authorization
end

#updateObject



34
35
36
37
38
# File 'app/controllers/bsm_oa/authorizations_controller.rb', line 34

def update
  @authorization = resource_scope.find params[:id]
  @authorization.update(permitted_params)
  respond_with @authorization
end