Пример #1
0
 public function allRoles($client)
 {
     $allRole = $client->api('role')->all(array('limit' => 1000));
     try {
         $roles = new Roles();
         foreach ($allRole['roles'] as $key => $role) {
             $roles->exchangeArray($role);
             $this->getRolesTable()->saveRoles($roles);
         }
     } catch (\Exception $ex) {
         //send mail if any error occur during CRON JOB
     }
 }
Пример #2
0
 public function allRoles()
 {
     $client = new Client("https://portal.optimusinfo.com/redmine/", 'vikas.singhal', 'vzi950');
     $userInfo = $client->api('user')->getCurrentUser();
     // echo "<pre>";print_r($userInfo);die;
     $roles = new Roles();
     foreach ($userInfo['user']['memberships'] as $key => $value) {
         foreach ($value['roles'] as $role) {
             $roles->exchangeArray($role);
             $this->getRolesTable()->saveRoles($roles);
         }
     }
     return true;
 }