Skip to content

Commit 008eeb3

Browse files
committed
Privilege for app section added
1 parent 367cc1d commit 008eeb3

4 files changed

Lines changed: 14 additions & 5 deletions

File tree

Controller/Dashboard.php

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,15 @@
88
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
99
use Webkul\UVDesk\ExtensionFrameworkBundle\Utils\ApplicationCollection;
1010
use Symfony\Component\DependencyInjection\ContainerInterface;
11-
11+
use Webkul\UVDesk\CoreFrameworkBundle\Services\UserService;
1212
class Dashboard extends AbstractController
1313
{
14-
public function applications(Request $request)
14+
public function applications(Request $request, UserService $userService)
1515
{
16+
if (! $userService->isAccessAuthorized('ROLE_AGENT_MANAGE_APP')) {
17+
return $this->redirect($this->generateUrl('helpdesk_member_dashboard'));
18+
}
19+
1620
return $this->render('@UVDeskExtensionFramework//dashboard.html.twig', []);
1721
}
1822

@@ -29,7 +33,7 @@ public function applicationsXHR(Request $request, ApplicationCollection $applica
2933
'name' => $metadata->getName(),
3034
'qname' => $metadata->getQualifiedName(),
3135
'reference' => [
32-
'vendor' => $packageMetadata->getVendor(),
36+
'vendor' => $packageMetadata->getVendor(),
3337
'package' => $packageMetadata->getPackage(),
3438
],
3539
];

UIComponents/Dashboard/Homepage/Sections/Apps.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,6 @@ public static function getDescription() : string
1818

1919
public static function getRoles() : array
2020
{
21-
return [];
21+
return ['ROLE_AGENT_MANAGE_APP'];
2222
}
2323
}

UIComponents/Dashboard/Navigation/Apps.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ public static function getRouteName() : string
3232

3333
public static function getRoles() : array
3434
{
35-
return [];
35+
return ['ROLE_AGENT_MANAGE_APP'];
3636
}
3737

3838
public function getChildrenRoutes() : array

UIComponents/Dashboard/Search/Apps.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,4 +34,9 @@ public function getChildrenRoutes() : array
3434
{
3535
return [];
3636
}
37+
38+
public static function getRoles() : array
39+
{
40+
return ['ROLE_AGENT_MANAGE_APP'];
41+
}
3742
}

0 commit comments

Comments
 (0)