Class: LesliVault::Descriptor::PrivilegesController
- Inherits:
-
ApplicationController
- Object
- Lesli::ApplicationLesliController
- ApplicationController
- LesliVault::Descriptor::PrivilegesController
- Defined in:
- app/controllers/lesli_vault/descriptor/privileges_controller.rb
Instance Method Summary collapse
-
#create ⇒ Object
POST /descriptor/privileges.
-
#destroy ⇒ Object
DELETE /descriptor/privileges/1.
-
#index ⇒ Object
GET /descriptor/privileges.
Instance Method Details
#create ⇒ Object
POST /descriptor/privileges
51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 |
# File 'app/controllers/lesli_vault/descriptor/privileges_controller.rb', line 51 def create descriptor_privilege_status = false descriptor_privilege = @descriptor.privileges.with_deleted.find_by( :system_controller_action_id => descriptor_privilege_params[:action_id] ) if not descriptor_privilege descriptor_privilege = @descriptor.privileges.new( :system_controller_action_id => descriptor_privilege_params[:action_id] ) descriptor_privilege_status = descriptor_privilege.save elsif descriptor_privilege.deleted? descriptor_privilege_status = descriptor_privilege.recover end if descriptor_privilege_status #Role::Activity.log_create_descriptor(current_user, @role, role_descriptor) respond_with_successful(descriptor_privilege) else respond_with_error(descriptor_privilege.errors..to_sentence) end end |
#destroy ⇒ Object
DELETE /descriptor/privileges/1
77 78 79 80 81 82 83 |
# File 'app/controllers/lesli_vault/descriptor/privileges_controller.rb', line 77 def destroy if @descriptor_privilege.destroy respond_with_successful else respond_with_error(@descriptor_privilege.errors..to_sentence) end end |
#index ⇒ Object
GET /descriptor/privileges
41 42 43 44 45 46 47 48 |
# File 'app/controllers/lesli_vault/descriptor/privileges_controller.rb', line 41 def index respond_to do |format| format.html {} format.json do respond_with_successful(Descriptor::Privilege.index(current_user, @query, params)) end end end |