Class | Colaborator
In: | app/models/colaborator.rb
Parent: | User

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

### Methods

can? can_access? can_create? can_edit? empty_unnecessary_fields inherited_permissions

### Public Class methods

inherited_permissions()

[Source]

        # File app/models/colaborator.rb, line 40
    40:   def self.inherited_permissions
    41:     [{:module => "news", :action => "create"}, {:module => "news", :action => "complete"}]
    42:   end

### Public Instance methods

can?(perm_type, doc_type)

[Source]

        # File app/models/colaborator.rb, line 36
    36:   def can?(perm_type, doc_type)
    37:     (perm_type.eql?("complete") && doc_type.eql?("news")) || permission?(perm_type, doc_type)
    38:   end

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/colaborator.rb, line 16
    16:   def can_access?(doc_type)
    17:     ["news", "photos", "videos"].include?(doc_type)
    18:   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/colaborator.rb, line 32
    32:   def can_create?(doc_type)
    33:     self.can_access?(doc_type)
    34:   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/colaborator.rb, line 24
    24:   def can_edit?(doc_type)
    25:     self.can_access?(doc_type)
    26:   end

empty_unnecessary_fields()

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

[Source]

        # File app/models/colaborator.rb, line 7
     7:   def empty_unnecessary_fields
     8:     self.department_id = nil
     9:     self.media = nil
    10:   end

[Validate]