Make user actions available from contextual menu
This commit is contained in:
@@ -36,7 +36,7 @@ class AvatarFileController extends BaseController
|
||||
$this->flash->failure(t('Unable to upload files, check the permissions of your data folder.'));
|
||||
}
|
||||
|
||||
$this->response->redirect($this->helper->url->to('AvatarFileController', 'show', array('user_id' => $user['id'])));
|
||||
$this->renderResponse($user['id']);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -48,7 +48,7 @@ class AvatarFileController extends BaseController
|
||||
$user = $this->getUser();
|
||||
$this->avatarFileModel->remove($user['id']);
|
||||
$this->userSession->refresh($user['id']);
|
||||
$this->response->redirect($this->helper->url->to('AvatarFileController', 'show', array('user_id' => $user['id'])));
|
||||
$this->renderResponse($user['id']);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -91,4 +91,13 @@ class AvatarFileController extends BaseController
|
||||
$this->logger->error($e->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
protected function renderResponse($userId)
|
||||
{
|
||||
if ($this->request->isAjax()) {
|
||||
$this->show();
|
||||
} else {
|
||||
$this->response->redirect($this->helper->url->to('AvatarFileController', 'show', array('user_id' => $userId)));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -100,10 +100,15 @@ class TwoFactorController extends UserViewController
|
||||
unset($this->sessionStorage->twoFactorSecret);
|
||||
$this->userSession->disablePostAuthentication();
|
||||
|
||||
$this->response->redirect($this->helper->url->to('TwoFactorController', 'index', array('user_id' => $user['id'])));
|
||||
$this->response->redirect($this->helper->url->to('TwoFactorController', 'index', array('user_id' => $user['id'])), true);
|
||||
} else {
|
||||
$this->flash->failure(t('The two factor authentication code is not valid.'));
|
||||
$this->response->redirect($this->helper->url->to('TwoFactorController', 'show', array('user_id' => $user['id'])));
|
||||
|
||||
if ($this->request->isAjax()) {
|
||||
$this->show();
|
||||
} else {
|
||||
$this->response->redirect($this->helper->url->to('TwoFactorController', 'show', array('user_id' => $user['id'])));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -127,7 +132,7 @@ class TwoFactorController extends UserViewController
|
||||
$this->userSession->disablePostAuthentication();
|
||||
|
||||
$this->flash->success(t('User updated successfully.'));
|
||||
$this->response->redirect($this->helper->url->to('TwoFactorController', 'index', array('user_id' => $user['id'])));
|
||||
$this->response->redirect($this->helper->url->to('TwoFactorController', 'index', array('user_id' => $user['id'])), true);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -192,7 +197,7 @@ class TwoFactorController extends UserViewController
|
||||
'twofactor_secret' => '',
|
||||
));
|
||||
|
||||
$this->response->redirect($this->helper->url->to('UserViewController', 'show', array('user_id' => $user['id'])));
|
||||
$this->response->redirect($this->helper->url->to('UserViewController', 'show', array('user_id' => $user['id'])), true);
|
||||
} else {
|
||||
$this->response->html($this->helper->layout->user('twofactor/disable', array(
|
||||
'user' => $user,
|
||||
|
||||
@@ -32,7 +32,7 @@ class UserApiAccessController extends BaseController
|
||||
'api_access_token' => Token::getToken(),
|
||||
));
|
||||
|
||||
$this->response->redirect($this->helper->url->to('UserApiAccessController', 'show', array('user_id' => $user['id'])));
|
||||
$this->renderResponse();
|
||||
}
|
||||
|
||||
public function remove()
|
||||
@@ -45,6 +45,15 @@ class UserApiAccessController extends BaseController
|
||||
'api_access_token' => null,
|
||||
));
|
||||
|
||||
$this->response->redirect($this->helper->url->to('UserApiAccessController', 'show', array('user_id' => $user['id'])));
|
||||
$this->renderResponse();
|
||||
}
|
||||
|
||||
protected function renderResponse()
|
||||
{
|
||||
if ($this->request->isAjax()) {
|
||||
$this->show();
|
||||
} else {
|
||||
$this->response->redirect($this->helper->url->to('UserApiAccessController', 'show', array('user_id' => $user['id'])));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -47,14 +47,14 @@ class UserCredentialController extends BaseController
|
||||
if ($this->userModel->update($values)) {
|
||||
$this->flash->success(t('Password modified successfully.'));
|
||||
$this->userLockingModel->resetFailedLogin($user['username']);
|
||||
$this->response->redirect($this->helper->url->to('UserViewController', 'show', array('user_id' => $user['id'])), true);
|
||||
return;
|
||||
} else {
|
||||
$this->flash->failure(t('Unable to change the password.'));
|
||||
}
|
||||
|
||||
return $this->response->redirect($this->helper->url->to('UserViewController', 'show', array('user_id' => $user['id'])));
|
||||
}
|
||||
|
||||
return $this->changePassword($values, $errors);
|
||||
$this->changePassword($values, $errors);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -97,14 +97,14 @@ class UserCredentialController extends BaseController
|
||||
if ($valid) {
|
||||
if ($this->userModel->update($values)) {
|
||||
$this->flash->success(t('User updated successfully.'));
|
||||
$this->response->redirect($this->helper->url->to('UserCredentialController', 'changeAuthentication', array('user_id' => $user['id'])), true);
|
||||
return;
|
||||
} else {
|
||||
$this->flash->failure(t('Unable to update your user.'));
|
||||
$this->flash->failure(t('Unable to update this user.'));
|
||||
}
|
||||
|
||||
return $this->response->redirect($this->helper->url->to('UserCredentialController', 'changeAuthentication', array('user_id' => $user['id'])));
|
||||
}
|
||||
|
||||
return $this->changeAuthentication($values, $errors);
|
||||
$this->changeAuthentication($values, $errors);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -57,13 +57,13 @@ class UserModificationController extends BaseController
|
||||
if ($valid) {
|
||||
if ($this->userModel->update($values)) {
|
||||
$this->flash->success(t('User updated successfully.'));
|
||||
$this->response->redirect($this->helper->url->to('UserViewController', 'show', array('user_id' => $user['id'])), true);
|
||||
return;
|
||||
} else {
|
||||
$this->flash->failure(t('Unable to update your user.'));
|
||||
$this->flash->failure(t('Unable to update this user.'));
|
||||
}
|
||||
|
||||
return $this->response->redirect($this->helper->url->to('UserViewController', 'show', array('user_id' => $user['id'])));
|
||||
}
|
||||
|
||||
return $this->show($values, $errors);
|
||||
$this->show($values, $errors);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -123,7 +123,12 @@ class UserViewController extends BaseController
|
||||
$this->checkCSRFParam();
|
||||
$user = $this->getUser();
|
||||
$this->rememberMeSessionModel->remove($this->request->getIntegerParam('id'));
|
||||
$this->response->redirect($this->helper->url->to('UserViewController', 'sessions', array('user_id' => $user['id'])));
|
||||
|
||||
if ($this->request->isAjax()) {
|
||||
$this->sessions();
|
||||
} else {
|
||||
$this->response->redirect($this->helper->url->to('UserViewController', 'sessions', array('user_id' => $user['id'])), true);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -139,10 +144,11 @@ class UserViewController extends BaseController
|
||||
$values = $this->request->getValues();
|
||||
$this->userNotificationModel->saveSettings($user['id'], $values);
|
||||
$this->flash->success(t('User updated successfully.'));
|
||||
return $this->response->redirect($this->helper->url->to('UserViewController', 'notifications', array('user_id' => $user['id'])));
|
||||
$this->response->redirect($this->helper->url->to('UserViewController', 'notifications', array('user_id' => $user['id'])), true);
|
||||
return;
|
||||
}
|
||||
|
||||
return $this->response->html($this->helper->layout->user('user_view/notifications', array(
|
||||
$this->response->html($this->helper->layout->user('user_view/notifications', array(
|
||||
'projects' => $this->projectUserRoleModel->getProjectsByUser($user['id'], array(ProjectModel::ACTIVE)),
|
||||
'notifications' => $this->userNotificationModel->readSettings($user['id']),
|
||||
'types' => $this->userNotificationTypeModel->getTypes(),
|
||||
@@ -164,7 +170,8 @@ class UserViewController extends BaseController
|
||||
$values = $this->request->getValues();
|
||||
$this->userMetadataModel->save($user['id'], $values);
|
||||
$this->flash->success(t('User updated successfully.'));
|
||||
$this->response->redirect($this->helper->url->to('UserViewController', 'integrations', array('user_id' => $user['id'])));
|
||||
$this->response->redirect($this->helper->url->to('UserViewController', 'integrations', array('user_id' => $user['id'])), true);
|
||||
return;
|
||||
}
|
||||
|
||||
$this->response->html($this->helper->layout->user('user_view/integrations', array(
|
||||
@@ -206,10 +213,15 @@ class UserViewController extends BaseController
|
||||
$this->flash->failure(t('Unable to update this user.'));
|
||||
}
|
||||
|
||||
return $this->response->redirect($this->helper->url->to('UserViewController', 'share', array('user_id' => $user['id'])));
|
||||
if (! $this->request->isAjax()) {
|
||||
$this->response->redirect($this->helper->url->to('UserViewController', 'share', array('user_id' => $user['id'])), true);
|
||||
return;
|
||||
}
|
||||
|
||||
$user = $this->getUser();
|
||||
}
|
||||
|
||||
return $this->response->html($this->helper->layout->user('user_view/share', array(
|
||||
$this->response->html($this->helper->layout->user('user_view/share', array(
|
||||
'user' => $user,
|
||||
'title' => t('Public access'),
|
||||
)));
|
||||
|
||||
Reference in New Issue
Block a user