Skip to content
Permalink
Browse files

Merge pull request #708 from ezsystems/ezp-29793-permission-aware-das…

…hboard-button

EZP-29793: Implement permissions for the Create button on the dashboard
  • Loading branch information...
lserwatka committed Nov 8, 2018
2 parents 029bee5 + 988a643 commit 997b27417885bccfce50fdd4865294ff42fdc36e
@@ -10,14 +10,23 @@
use EzSystems\EzPlatformAdminUi\Form\Data\Content\Draft\ContentEditData;
use EzSystems\EzPlatformAdminUi\Form\Factory\FormFactory;
use eZ\Publish\API\Repository\PermissionResolver;
class DashboardController extends Controller
{
protected $formFactory;
public function __construct(FormFactory $formFactory)
/** @var \eZ\Publish\API\Repository\PermissionResolver */
private $permissionResolver;
/**
* @param \EzSystems\EzplatformAdminUi\Form\Factory\FormFactory $formFactory
* @param \eZ\Publish\API\Repository\PermissionResolver $permissionResolver
*/
public function __construct(FormFactory $formFactory, PermissionResolver $permissionResolver)
{
$this->formFactory = $formFactory;
$this->permissionResolver = $permissionResolver;
}
public function dashboardAction()
@@ -28,6 +37,7 @@ public function dashboardAction()
return $this->render('@ezdesign/dashboard/dashboard.html.twig', [
'form_edit' => $editForm->createView(),
'can_create_content' => $this->permissionResolver->hasAccess('content', 'create'),
]);
}
}
@@ -106,6 +106,11 @@
<target state="new">Me</target>
<note>key: me</note>
</trans-unit>
<trans-unit id="013cb5f0c7391fd9db25ef277f72bd0d3b62a0e3" resname="my.dashboard">
<source>My dashboard</source>
<target state="new">My dashboard</target>
<note>key: my.dashboard</note>
</trans-unit>
<trans-unit id="c4d3f17636317e532c589f3008d82c263ab5c39d" resname="tab.name.everyone_content">
<source>Content</source>
<target state="new">Content</target>
@@ -361,7 +361,7 @@
<target state="new">Logout</target>
<note>key: user__content</note>
</trans-unit>
<trans-unit id="b244f658b186fa1af8074bdf2f0e83752b504904" resname="user__drafts">
<trans-unit id="22a2aa3863b8f6a0ab24403998badeb4bb196254" resname="user__drafts">
<source>Drafts</source>
<target state="new">Drafts</target>
<note>key: user__drafts</note>
@@ -10,10 +10,10 @@
<div class="container-fluid ez-header">
<div class="col-sm-12">
<div class="container ez-dashboard__header">
<h1 class="py-3">My dashboard</h1>
<h1 class="py-3">{{ 'my.dashboard'|trans|desc('My dashboard') }}</h1>
<div class="ez-dashboard__create">
<button class="btn btn-primary ez-btn--cotf-create" data-udw-config="{{ ez_udw_config('create', {}) }}">
<svg class="ez-icon ez-icon--medium ez-icon--light ez-icon-create">
<button type="button" class="btn btn-primary ez-btn--cotf-create" data-udw-config="{{ ez_udw_config('create', {}) }}" {% if not can_create_content %}disabled{% endif %}>
<svg class="ez-icon ez-icon--medium ez-icon--light">
<use xlink:href="{{ asset('bundles/ezplatformadminui/img/ez-icons.svg') }}#create"></use>
</svg>
<span>{{ 'dashboard.create'|trans|desc('Create') }}</span>

0 comments on commit 997b274

Please sign in to comment.
You can’t perform that action at this time.