Skip to content

Commit

Permalink
Merge pull request #1047 from arawa/backport/add-capability/1041/stab…
Browse files Browse the repository at this point in the history
…le3.2

Backport/add capability/1041/stable3.2
  • Loading branch information
zak39 authored Aug 22, 2024
2 parents fb5531a + 0f1029b commit 52bbf4d
Show file tree
Hide file tree
Showing 5 changed files with 39 additions and 2 deletions.
10 changes: 9 additions & 1 deletion lib/AppInfo/Application.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,14 @@
use OCA\Workspace\Service\SpaceService;
use OCA\Workspace\Service\UserService;
use OCP\AppFramework\App;
use OCP\AppFramework\Bootstrap\IBootContext;
use OCP\AppFramework\Bootstrap\IBootstrap;
use OCP\AppFramework\Bootstrap\IRegistrationContext;
use OCP\AppFramework\Utility\IControllerMethodReflector;
use OCP\IRequest;
use OCP\IURLGenerator;

class Application extends App {
class Application extends App implements IBootstrap {
public const APP_ID = 'workspace';

public function __construct(array $urlParams = []) {
Expand Down Expand Up @@ -67,5 +69,11 @@ public function register(IRegistrationContext $context): void {

$context->registerMiddleware(WorkspaceAccessControlMiddleware::class);
$context->registerMiddleware(IsSpaceAdminMiddleware::class);
$context->registerMiddleware(IsGeneralManagerMiddleware::class);

$context->registerCapability(Capabilities::class);
}

public function boot(IBootContext $context): void {
}
}
27 changes: 27 additions & 0 deletions lib/AppInfo/Capabilities.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<?php

declare(strict_types=1);

namespace OCA\Workspace\AppInfo;

use OCP\App\IAppManager;
use OCP\Capabilities\ICapability;
use OCP\IAppConfig;

class Capabilities implements ICapability {
public function __construct(
private IAppManager $appManager,
private IAppConfig $appConfigManager
) {
}

public function getCapabilities(): array {
return [
Application::APP_ID => [
'version' => $this->appManager->getAppVersion(Application::APP_ID),
'is_enabled' => $this->appManager->isEnabledForUser(Application::APP_ID),
'groupfolders_version' => $this->appManager->getAppVersion('groupfolders'),
]
];
}
}
2 changes: 1 addition & 1 deletion lib/Controller/WorkspaceController.php
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ public function createWorkspace(string $spaceName,
* Deletes the workspace, and the corresponding groupfolder and groups
*
* @NoAdminRequired
* @SpaceAdminRequired
* @GeneralManagerRequired
* @param array $workspace
*
*/
Expand Down
1 change: 1 addition & 0 deletions src/services/groupfoldersService.js
Original file line number Diff line number Diff line change
Expand Up @@ -306,6 +306,7 @@ export function rename(workspace, newSpaceName) {
{
workspace,
newSpaceName,
spaceId: workspace.id
})
.then(resp => {
// If space is updated...
Expand Down
1 change: 1 addition & 0 deletions src/store/actions.js
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@ export default {
gid,
displayName,
},
spaceId: space.id
})
.then((resp) => {
addGroupToGroupfolder(space.groupfolderId, resp.data.group.gid)
Expand Down

0 comments on commit 52bbf4d

Please sign in to comment.