Permiso.php 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. <?php
  2. namespace app\models;
  3. use Yii;
  4. /**
  5. * This is the model class for table "Permiso".
  6. *
  7. * @property string $id
  8. * @property string|null $idModulo
  9. * @property string|null $nombre
  10. * @property string|null $descripcion
  11. * @property string|null $creado
  12. * @property string|null $modificado
  13. * @property string|null $eliminado
  14. *
  15. * @property Modulo $idModulo0
  16. * @property PermisoUsuario[] $permisoUsuarios
  17. */
  18. class Permiso extends ModeloBase {
  19. const PERFIL_ISTAI = 'PERUSUARIO-ASESORISTAI';
  20. const PERFIL_COMISIONADO = 'PERUSUARIO-COMISIONADO';
  21. const PERFIL_PROYECTISTA = 'PERUSUARIO-PROYECTISTA';
  22. const PERFIL_PONENCIA = 'PERUSUARIO-PONENCIA';
  23. const PERFIL_SOLICITANTE = 'PERUSUARIO-SOLICITANTE';
  24. const PERFIL_UNIDAD_TRANSPARENCIA = 'PERUSUARIO-UNIDADTRANSP';
  25. const SOLICITUD_VER_TODO = 'SOLICITUD-VERTODO';
  26. const SUJETO_OBLIGADO_VER_TODO = 'SOLICITUD-VER-TODO-SUJETOS';
  27. const RR_TURNAR_PONENCIA = 'RECURSO-TURNAR-PONENCIA';
  28. const RR_VER_DETALLE = 'RECURSO-VERDETALLE';
  29. /**
  30. * {@inheritdoc}
  31. */
  32. public static function tableName() {
  33. return 'Permiso';
  34. }
  35. /**
  36. * {@inheritdoc}
  37. */
  38. public function rules() {
  39. return [
  40. [['id'], 'required'],
  41. [['creado', 'modificado', 'eliminado'], 'safe'],
  42. [['id', 'idModulo'], 'string', 'max' => 50],
  43. [['nombre', 'descripcion'], 'string', 'max' => 100],
  44. [['id'], 'unique'],
  45. [['idModulo'], 'exist', 'skipOnError' => true, 'targetClass' => Modulo::class, 'targetAttribute' => ['idModulo' => 'id']],
  46. ];
  47. }
  48. /**
  49. * {@inheritdoc}
  50. */
  51. public function attributeLabels() {
  52. return [
  53. 'id' => 'ID',
  54. 'idModulo' => 'Id Modulo',
  55. 'nombre' => 'Nombre',
  56. 'descripcion' => 'Descripcion',
  57. 'creado' => 'Creado',
  58. 'modificado' => 'Modificado',
  59. 'eliminado' => 'Eliminado',
  60. ];
  61. }
  62. public function getModulo() {
  63. return $this->hasOne(Modulo::class, ['id' => 'idModulo']);
  64. }
  65. public function getPermisoUsuarios() {
  66. return $this->hasMany(PermisoUsuario::class, ['idPermiso' => 'id']);
  67. }
  68. }