Permission http://drupal8.ovh/en/tags/permission en Create a custom permission in Drupal 8 http://drupal8.ovh/en/tutoriels/66/create-a-custom-permission-drupal-8 <span class="field field--name-title field--type-string field--label-hidden">Create a custom permission in Drupal 8</span> <div class="clearfix text-formatted field field--name-field-question field--type-text-long field--label-above"> <div class="field__label">Question</div> <div class="field__item"><p>How to create a custom permission in Drupal 8 ?</p> </div> </div> <span class="field field--name-uid field--type-entity-reference field--label-hidden"><span lang="" about="/en/users/editor" typeof="schema:Person" property="schema:name" datatype="">editor</span></span> <span class="field field--name-created field--type-created field--label-hidden">Sat, 12/05/2015 - 17:53</span> <div class="clearfix text-formatted field field--name-body field--type-text-with-summary field--label-hidden field__item"><p>Example with a module '<strong>mymodule</strong>'</p> <p>Step 1.<br /> Create if not exist yet, <strong>mymodule.</strong>permissions.yml (root of mymodule)<br /> Add your new permission like:</p> <p><code><strong>mymodule test_permission</strong>:<br />     title: 'My Test Permission'<br />     description: 'The description'<br />     restrict access: false</code></p> <p>Step 2.<br /> On your <strong>mymodule.</strong>routing.yml<br /><code>mymodule.home:<br />   path: 'test/home'<br />   defaults:<br />     _controller: '\Drupal\mymodule\Controller\Test::home'<br />     _title: 'My test Home'<br />   requirements:<br />     _permission: '<strong>mymodule test_permission</strong>'</code></p> <p>Set permissions on :<strong> /admin/people/permissions</strong></p> <p> </p> <p> </p> </div> <div class="field field--name-field-tags field--type-entity-reference field--label-inline clearfix"> <h3 class="field__label inline">Tags</h3> <ul class="links field__items"> <li><a href="/en/tags/drupal-8" hreflang="en">Drupal 8</a></li> <li><a href="/en/tags/code" hreflang="en">Code</a></li> <li><a href="/en/tags/permission" hreflang="en">Permission</a></li> </ul> </div> <section class="field field--name-comment field--type-comment field--label-above comment-wrapper"> <h2 class="title comment-form__title">Add new comment</h2> <drupal-render-placeholder callback="comment.lazy_builders:renderForm" arguments="0=node&amp;1=66&amp;2=comment&amp;3=comment" token="dbf7b108"></drupal-render-placeholder> </section> Sat, 05 Dec 2015 16:53:24 +0000 editor 66 at http://drupal8.ovh http://drupal8.ovh/en/tutoriels/66/create-a-custom-permission-drupal-8#comments