Ok actually you can do this by using If statement in your View code. You can do like this
<?php
if(Yii::app()->authManager->checkAccess('Admin', Yii::app()->user->id)) {
?>
<?php $criteria=new CDbCriteria();
$criteria->condition="NOT user_type=Admin";
echo $form->dropDownList($model,'user_type_id',
CHtml::listData(UserType::model()->findAll($criteria),'id','user_type')); ?>
<?php } ?>
If the user is admin only then the dropdown will be shown.
EDIT: If you want to get it using function call then you can use this.
public function scopeToUse() {
if(Yii::app()->authManager->checkAccess('Admin', Yii::app()->user->id)) {
$this->getDbCriteria()->mergeWith(array(
'condition' => 'NOT user_type="Admin"',
'order'=>'id ASC'
));
}
return $this;
}
then you can use use
<?php echo $form->dropDownList($model,'user_type_id',
CHtml::listData(UserType::model()->scopeToUse()->findAll(),'id','user_type')); ?>