<?php

class WebUser extends CWebUser {

    private $_model = null;

    function getLogin() {
        if ($user = $this->getModel()) {
            return $user->login;
        }
    }

    function getLevel() {
        if ($user = $this->getModel()) {
            return $user->level;
        }
    }
    
     function getSide() {
        if ($user = $this->getModel()) {
            return $user->side;
        }
    }

    function getRole() {
        if ($user = $this->getModel()) {
            // в таблице User есть поле role
            return $user->role;
        }
    }

    private function getModel() {
        if (!$this->isGuest && $this->_model === null) {
            $this->_model = Users::model()->findByPk($this->id, array('select' => 'role'));
        }
        return $this->_model;
    }

}
