<?php
/**
 * 列出用户权限
 *
 * @author ouyang
 */
class UserAssignAction extends BaseAction
{
    //put your code here
    public function run()
    {
        $username = Yii::app()->getRequest()->getQuery('name');

        $roles = $this->getController()->getRoles();
        $tasks = $this->getController()->getTasks();

        $assigns = Yii::app()->getAuthManager()->getAuthAssignments($username);
        $hasOperations=array();
        foreach($assigns as $assign)
        {
            $hasOperations[] = $assign->itemName;
        }

        $this->getController()->render('userassign', array(
                'title'=>'用户授权',
                'roles' => $roles,
                'tasks' => $tasks,
                'hasoperations' => $hasOperations,
                'username' => $username
                )
            );
    }
}

