Array of users

Hello

I have this function:




protected function getAdministradores() 

        {

            $a = array();

            $adms = Usuarios::model()->administrativo()->findAll();

            foreach($adms as $k => $adm) { $a[] = $adm->usuario; }

            return $a;

        }

        protected function getGerentes() 

        {

            $g = array();

            $gerentes = Usuarios::model()->gerente()->findAll();

            foreach($gerentes as $k => $ge) { $g[] = $ge->usuario; }

            return $g;

        }



This functions use a scope in my model Usuarios:




public function scopes() 

        {

            return array('gerente' => array('condition' => 'nivel="'.self::GERENTE . '"') ,

            'administrativo' => array('condition' => 'nivel="'.self::ADMINISTRATIVO. '"'),

            'manutencao' => array('condition' => 'nivel="'.self::MANUTENCAO . '"'),

            'caixa' => array('condition' => 'nivel="'.self::CAIXA . '"'));

        }



In my controller ClientController I use the function to determine what the user may access:




array('allow', // allow authenticated user to perform 'create' and 'update' actions

				'actions'=>array('index','view','update','admin','delete'),

                                'users'=>$this->getAdministradores(),

			),



This run ok. But I need use the function getAdministradores and getGerentes, but this funtions are array, How can I put this functions on my rule?

If I try this:




array('allow', // allow authenticated user to perform 'create' and 'update' actions

				'actions'=>array('index','view','update','admin','delete'),

                                'users'=>$this->getAdministradores() . $this->getManutencao(),



Don’t run because both functions are array. I try other way but don’t run. How can I do this?

i think you should use cbehavior to attach these functions it to the model that will make is easy to implement such access control.

Thank you for help.

I used other way, I did this:


Usuarios::model()->administrativo()->manutencao()->findAll();