How To Disable Method In Url And Rediret To Another Line In Certain Condition

Hello yii friends

I am trying disable some specific methods when I enter to the certain condtion and redirect to required page in yii. for let us say

i have the following code:-

          if ($model->login($data)) // pass the data to login function and store in database and session


                        {


                            $role = new User();





                            $userRole = $role->GetRolesForUser(Yii::app()->user->name);  // check the roles for users.


                            $userRole_list = $userRole->GetRolesForUserResult->string;





                            if ($this->actionCheckRole($userRole_list) == TRUE)  // if role exist for user rediret to index page.


                            {


                                $session = new CHttpSession;


                                $session->open();


                                // $session['login'] = $login_result;


                                $session['sessionkey'] = $session_key;


                                $session['loggeduser'] = 1;


                                $session->close();


                                $session_key = $session['sessionkey'];


                                header('Location: ' . $setsso_url . '?sso=' . $session_key . '&return=' . Yii::app()->getBaseUrl(true) . '/site/index');


                                exit;


                            }


                            else


                            {

// when i enter here than i want disable some specific method and rediret to another link

                                $this->redirect(array('setting/ssopermission', 'name' => $_POST['LoginForm']['username']));


                            }


                        }

how can i achieve such condition…

thanks in advance