Class | StaffChief
In: | app/models/staff_chief.rb
Parent: | User

Clase para los usuarios de tipo "Jefe de gabinete". Es subclase de User, por lo que su tabla es `users`

### Methods

can_access? can_create? can_edit? empty_unnecessary_fields inherited_permissions

### Public Class methods

inherited_permissions()

De momento, igual que DepartmentEditor.inherited_permissions

[Source]

        # File app/models/staff_chief.rb, line 42
    42:   def self.inherited_permissions
    43:     [{:module => "news", :action => "create"}, \
    44:      {:module => "comments", :action => "edit"}, {:module => "comments", :action => "official"}, \
    45:      {:module => "events", :action => "create_private"}, {:module => "events", :action => "create_irekia"}, \
    46:      {:module => "events", :action => "create_agencia"}]
    47:   end

### Public Instance methods

can_access?(doc_type)

Indica si tiene permiso para acceder a la administración de los recursos de tipo `doc_type`. Ejemplos:

- current_user.can_access?("news")
- current_user.can_access?("photos")

[Source]

        # File app/models/staff_chief.rb, line 17
    17:   def can_access?(doc_type)
    18:     if doc_type.eql?('schedule_events')
    19:       !self.editable_schedules.blank?
    20:     else
    21:       ["news", "events", "comments"].include?(doc_type)
    22:     end
    23:   end

can_create?(doc_type)

Indica si puede crear recursos de tipo `doc_type`. Ejemplos:

- current_user.can_create?("news")
- current_user.can_create?("photos")

[Source]

        # File app/models/staff_chief.rb, line 37
    37:   def can_create?(doc_type)
    38:     self.can_access?(doc_type)
    39:   end

can_edit?(doc_type)

Indica si puede modificar recursos de tipo `doc_type`. Ejemplos:

- current_user.can_edit?("news")
- current_user.can_edit?("photos")

[Source]

        # File app/models/staff_chief.rb, line 29
    29:   def can_edit?(doc_type)
    30:     self.can_access?(doc_type)
    31:   end

empty_unnecessary_fields()

Vacia los campos irrelevantes para este tipo de usuario. Se llama desde before_save

[Source]

        # File app/models/staff_chief.rb, line 9
     9:   def empty_unnecessary_fields
    10:     self.media = nil
    11:   end

[Validate]