예제 #1
0
 public function actionPasswd()
 {
     $users = User::findAll(['password_hash' => '']);
     $report = [];
     foreach ($users as $u) {
         $u->password_hash = Yii::$app->getSecurity()->generatePasswordHash($u->user_name);
         $u->save();
         $report[$u->user_name] = $u->password_hash;
     }
     return $this->render('passwd', ['report' => $report]);
 }
예제 #2
0
 public function disableOldAccounts()
 {
     $newList = [];
     $ldap = new LdapComponent();
     $users = User::findAll(['status_id' => Types::$status['active']['id']]);
     foreach ($users as $u) {
         $search = $ldap->userSearch($u->user_name);
         if ($search == false) {
             $u->status_id = Types::$status['inactive']['id'];
             $u->save();
             yii::$app->LogComponent->deactivateUser($u->user_name, sprintf('Removing user: %s %s', $u->first_name, $u->last_name));
             $newList[] = $u;
         }
     }
     return $newList;
 }
예제 #3
0
 /**
  * Delete multiple existing User model.
  * For ajax request will return json object
  * and for non-ajax request if deletion is successful, the browser will be redirected to the 'index' page.
  * @param integer $id
  * @return mixed
  */
 public function actionBulkDelete()
 {
     $request = Yii::$app->request;
     $pks = $request->post('pks');
     // Array or selected records primary keys
     foreach (User::findAll(json_decode($pks)) as $model) {
         $model->delete();
     }
 }