Preview:
model/userbackend:

class Userbackend extends ActiveRecord implements IdentityInterface
{
    const STATUS_DELETED = 0;
    const STATUS_ACTIVE = 10;
    const ROLE_ADMIN = 25; //RolMaximo
    const ROLE_ENTE = 15; //Rol#1
    const ROLE_SUP_ENTE = 20; //Rol#2
    const ROLE_PRESIDENTE_ENTE = 26; //Rol#3
    const ROLE_VICEMINISTRO_SECTOR = 30; //Rol#4
    const ROLE_DESPACHO_MINISTRO = 35; //Rol#5

 public function getRole()
    {
        if ($this->role == self::ROLE_ADMIN) { //MAXIMO
            $r = 'ADMINISTRADOR';
        } elseif ($this->role == self::ROLE_ENTE) {//Rol#1
            $r = 'ENTE';
        } elseif ($this->role == self::ROLE_SUP_ENTE) { //Rol#2
            $r = 'SUPERVIDOR ENTE';
        } elseif ($this->role == self::ROLE_PRESIDENTE_ENTE) {//Rol#3
            $r = 'PRESIDENTE ENTE';

        } elseif ($this->role == self::ROLE_VICEMINISTRO_SECTOR){//Rol#4
            $r = 'VICEMINISTRO SECTOR';

        } elseif ($this->role == self::ROLE_DESPACHO_MINISTRO) {//Rol#5
            $r = 'DESPACHO MINISTRO';

        } else {
            $r = '';
        }
        return $r;
    }

nota: las siguientes lineas van debajo de la siguiente funcion:

public function getDatosUsuario()
    {
        return $this->nomper . " " . $this->apeper . " (" . $this->username . ")";
    }

// desde aqui

public static function isUserAdmin($username)
    {
        if (static::findOne(['username' => $username, 'role' => self::ROLE_ADMIN])) {//maximo
            return true;
        } else {
            return false;
        }
    }

    
    public static function isUserEnte($username)
    {
        if (static::findOne(['username' => $username, 'role' => self::ROLE_ENTE])) {//Rol#1
            return true;
        } else {
            return false;
        }
    }

    public static function isUserSup_Ente($username)
    {
        if (static::findOne(['username' => $username, 'role' => self::ROLE_SUP_ENTE])) {//Rol#2
            return true;
        } else {
            return false;
        }
    }

    public static function isUserPres_Ente($username)
    {
        if (static::findOne(['username' => $username, 'role' => self::ROLE_PRESIDENTE_ENTE])) {//Rol#3
            return true;
        } else {
            return false;
        }
    }


    public static function isUserVice_Sector($username)
    {
        if (static::findOne(['username' => $username, 'role' => self::ROLE_VICEMINISTRO_SECTOR])) {//Rol#4
            return true;
        } else {
            return false;
        }
    }

    public static function isUserDesp_Ministro($username)
    {
        if (static::findOne(['username' => $username, 'role' => self::ROLE_DESPACHO_MINISTRO])) {//Rol#5
            return true;
        } else {
            return false;
        }
    }

downloadDownload PNG downloadDownload JPEG downloadDownload SVG

Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!

Click to optimize width for Twitter