<?php
/**
 * 创建角色（角色名可以随意定义，所以单独一个方法创建）
 * @author ouyang
 */
class CreateRoleAction extends BaseAction
{
	public function run()
	{
		if (Yii::app()->request->getIsPostRequest())
		{
            $auth = Yii::app()->getAuthManager();
            try
            {
                $auth->createAuthItem($_POST['name'], $_POST['type'] ,$_POST['description'], $_POST['bizrule']);
                $this->getController()->redirect(array('/platform/author/rolelist'));
            }catch(Exception $e)
            {
                #抛出异常
                $this->getController()->render('createrole',array('title'=>'创建角色'));
            }
        }
        $this->getController()->render('createrole',array('title'=>'创建角色'));   
	}
}