<?php
/**
 * 删除用户组
 * @author yzxh24
 */
class DeleteAction extends BaseAction
{
    public function run()
    {
        $gid = Yii::app()->request->getQuery('gid');
        $group = UserGroup::model()->findByPk($gid);
        if (empty($group) || 'system' == $group->gptype || 'default' == $group->gptype)
        {
            $this->getController()->redirect(array('index'));
        }
        $group->delete();
        UserGroup::deleteGroupCache($gid);
        
        $this->getController()->redirect(array('index'));
    }
}