diff options
author | Julius Härtl <jus@bitgrid.net> | 2022-02-01 16:22:20 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-02-01 16:22:20 +0300 |
commit | d56488826b454554145e2c986c6a9ee9acc7e05e (patch) | |
tree | d04f7b2532b2ad042e209834a8d5d6f1ca27661a /lib | |
parent | 6646edbf7461cdaf539acb3038b4e942d3a90028 (diff) | |
parent | 6256fd85f2133764c0bdaf82adea58157d2ca461 (diff) |
Merge pull request #1810 from hcvcastro/pr/00
add "is_admin" to extra info user data
Diffstat (limited to 'lib')
-rw-r--r-- | lib/Controller/WopiController.php | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/lib/Controller/WopiController.php b/lib/Controller/WopiController.php index 7cc57b7f..8d642af6 100644 --- a/lib/Controller/WopiController.php +++ b/lib/Controller/WopiController.php @@ -46,6 +46,7 @@ use OCP\Files\Node; use OCP\Files\NotFoundException; use OCP\Files\NotPermittedException; use OCP\IConfig; +use OCP\IGroupManager; use OCP\ILogger; use OCP\IRequest; use OCP\IURLGenerator; @@ -81,6 +82,8 @@ class WopiController extends Controller { private $federationService; /** @var IEncryptionManager */ private $encryptionManager; + /** @var IGroupManager */ + private $groupManager; // Signifies LOOL that document has been changed externally in this storage const LOOL_STATUS_DOC_CHANGED = 1010; @@ -118,7 +121,8 @@ class WopiController extends Controller { IShareManager $shareManager, UserScopeService $userScopeService, FederationService $federationService, - IEncryptionManager $encryptionManager + IEncryptionManager $encryptionManager, + IGroupManager $groupManager ) { parent::__construct($appName, $request); $this->rootFolder = $rootFolder; @@ -134,6 +138,7 @@ class WopiController extends Controller { $this->userScopeService = $userScopeService; $this->federationService = $federationService; $this->encryptionManager = $encryptionManager; + $this->groupManager = $groupManager; } /** @@ -233,6 +238,9 @@ class WopiController extends Controller { $user = $this->userManager->get($wopi->getEditorUid()); if($user !== null) { $response['UserExtraInfo']['avatar'] = $this->urlGenerator->linkToRouteAbsolute('core.avatar.getAvatar', ['userId' => $wopi->getEditorUid(), 'size' => self::WOPI_AVATAR_SIZE]); + if ($this->groupManager->isAdmin($wopi->getEditorUid())) { + $response['UserExtraInfo']['is_admin'] = true; + } } else { $response['UserExtraInfo']['avatar'] = $this->urlGenerator->linkToRouteAbsolute('core.GuestAvatar.getAvatar', ['guestName' => urlencode($wopi->getGuestDisplayname()), 'size' => self::WOPI_AVATAR_SIZE]); } |