Created
November 30, 2013 04:30
-
-
Save ruliarmando/7715404 to your computer and use it in GitHub Desktop.
WebUser component (Yii Framework)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php class EWebUser extends CWebUser{ | |
// ini buat pengecekan level akses tiap user | |
function getLevel(){ | |
$level = Yii::app()->user->getState('level'); | |
return $level; | |
} | |
function isAdmin(){ // apakah user adalah admin? | |
return Yii::app()->user->getState('level') == 1; | |
} | |
function isSiswa(){ | |
return Yii::app()->user->getState('level') == 2; | |
} | |
function isGuru(){ | |
return Yii::app()->user->getState('level') == 3; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment