summaryrefslogtreecommitdiffstats
path: root/settings/Controller
diff options
context:
space:
mode:
authorDaniel Kesselberg <mail@danielkesselberg.de>2019-02-12 23:40:53 +0100
committerDaniel Kesselberg <mail@danielkesselberg.de>2019-02-13 20:57:47 +0100
commit840f0c38fca7d8a82b4dde91be78e3af03876ed7 (patch)
tree620ff25cce192a5c81316cc84d5e299ff0b742a5 /settings/Controller
parent004f7fa8e141b159cc76f99cc041eec215444236 (diff)
downloadnextcloud-server-840f0c38fca7d8a82b4dde91be78e3af03876ed7.tar.gz
nextcloud-server-840f0c38fca7d8a82b4dde91be78e3af03876ed7.zip
Show more information on update app password
Add Renamed, Filesystem Granted and Filesystem Revoked to activity app. Signed-off-by: Daniel Kesselberg <mail@danielkesselberg.de>
Diffstat (limited to 'settings/Controller')
-rw-r--r--settings/Controller/AuthSettingsController.php22
1 files changed, 12 insertions, 10 deletions
diff --git a/settings/Controller/AuthSettingsController.php b/settings/Controller/AuthSettingsController.php
index 5b2788bb0c1..71bd3bf53d8 100644
--- a/settings/Controller/AuthSettingsController.php
+++ b/settings/Controller/AuthSettingsController.php
@@ -158,7 +158,7 @@ class AuthSettingsController extends Controller {
$tokenData['canDelete'] = true;
$tokenData['canRename'] = true;
- $this->publishActivity(Provider::APP_TOKEN_CREATED, $deviceToken->getId(), $deviceToken->getName());
+ $this->publishActivity(Provider::APP_TOKEN_CREATED, $deviceToken->getId(), ['name' => $deviceToken->getName()]);
return new JSONResponse([
'token' => $token,
@@ -206,7 +206,7 @@ class AuthSettingsController extends Controller {
}
$this->tokenProvider->invalidateTokenById($this->uid, $token->getId());
- $this->publishActivity(Provider::APP_TOKEN_DELETED, $token->getId(), $token->getName());
+ $this->publishActivity(Provider::APP_TOKEN_DELETED, $token->getId(), ['name' => $token->getName()]);
return [];
}
@@ -226,32 +226,34 @@ class AuthSettingsController extends Controller {
return new JSONResponse([], Http::STATUS_NOT_FOUND);
}
- $token->setScope([
- 'filesystem' => $scope['filesystem']
- ]);
+ $currentName = $token->getName();
+ if ($scope !== $token->getScopeAsArray()) {
+ $token->setScope(['filesystem' => $scope['filesystem']]);
+ $this->publishActivity($scope['filesystem'] ? Provider::APP_TOKEN_FILESYSTEM_GRANTED : Provider::APP_TOKEN_FILESYSTEM_REVOKED, $token->getId(), ['name' => $currentName]);
+ }
- if ($token instanceof INamedToken) {
+ if ($token instanceof INamedToken && $name !== $currentName) {
$token->setName($name);
+ $this->publishActivity(Provider::APP_TOKEN_RENAMED, $token->getId(), ['name' => $currentName, 'newName' => $name]);
}
$this->tokenProvider->updateToken($token);
- $this->publishActivity(Provider::APP_TOKEN_UPDATED, $token->getId(), $token->getName());
return [];
}
/**
* @param string $subject
* @param int $id
- * @param string|null $tokenName
+ * @param array $parameters
*/
- private function publishActivity(string $subject, int $id, ?string $tokenName = null): void {
+ private function publishActivity(string $subject, int $id, array $parameters = []): void {
$event = $this->activityManager->generateEvent();
$event->setApp('settings')
->setType('security')
->setAffectedUser($this->uid)
->setAuthor($this->uid)
- ->setSubject($subject, [$tokenName])
+ ->setSubject($subject, $parameters)
->setObject('app_token', $id, 'App Password');
try {