Class: Cats::Core::RolesController
Instance Method Summary
collapse
Methods included from Common
#create, #show, #update
#authenticate, #current_user, #skip_bullet
Instance Method Details
#index ⇒ Object
8
9
10
11
12
13
|
# File 'app/controllers/cats/core/roles_controller.rb', line 8
def index
super do
Role.joins(:application_module)
.where(cats_core_application_modules: {prefix: params[:prefix]})
end
end
|
#unassigned_roles ⇒ Object
15
16
17
18
19
20
|
# File 'app/controllers/cats/core/roles_controller.rb', line 15
def unassigned_roles
user = User.find(params[:id])
roles = Role.where(application_module_id: user.application_module_id)
unassigned = roles - user.roles
render json: {success: true, data: serialize(unassigned)}
end
|
#users ⇒ Object
22
23
24
|
# File 'app/controllers/cats/core/roles_controller.rb', line 22
def users
render json: {success: true, data: serialize(@role.users)}
end
|