Answers.Body: <p>You can check if the current entry's author is the <code>currentUser</code>.</p>
  
  <pre><code>{% if entry.author.id == currentUser.id %}
      {# User can edit entry #}
  {% endif %}
  </code></pre>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2018-10-30T13:31:59.450Z
Answers.Text: Thank you!
  It turned out, I needed to enable the other options, and check if the user was related to another entry to verify the ability to edit/delete.
Answers.UserDisplayName: Damon
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2018-10-29T23:41:25.100Z
Answers.LastActivityDate: 2018-10-29T23:41:25.100Z
Answers.UserDisplayName: Simon Kuran
Body: <p>I have a front-end form that registered users can log into and edit entries.</p>
  
  <p>I am checking for the correct user group, then also checking for the permission:</p>
  
  <pre><code>{% if currentUser.isInGroup('myGroup') %}
  
      {# Get the entry #}
      {% set request = craft.app.request.segment(3) %}
      {% set entry = craft.entries.section('mySection').slug(request).one() %}
  
      {% if entry|length &gt; 0 %}
          {% if currentUser.can('editEntries:7') %}
            {# user can edit the current entry #}
          {% endif %}
      {% endif %}
  
  {% endif %}
  </code></pre>
  
  <p>All is fine, but if I change the url to another valid url (where the logged in user is not the author) I am still able to see the entry.</p>
  
  <p>Is there a way to prevent that? Is it as easy as just checking/comparing authors? Or is there a more eloquent way? I do have other permissions disabled...
  <a href="https://i.sstatic.net/E3Dr3.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/E3Dr3.png" alt="enter image description here"></a></p>
  
  <p>Thank you for any suggestions!</p>
  
Tags: <craft3>
Title: How can I only allow authors to edit their own entires via front-end?
ThreadText: # How can I only allow authors to edit their own entires via front-end?
  
  (Asked by: username_0 on 2018-10-29)
  
  I have a front-end form that registered users can log into and edit entries.
  
  I am checking for the correct user group, then also checking for the permission:
  
  ```
  {% if currentUser.isInGroup('myGroup') %}
  
      {# Get the entry #}
      {% set request = craft.app.request.segment(3) %}
      {% set entry = craft.entries.section('mySection').slug(request).one() %}
  
      {% if entry|length > 0 %}
          {% if currentUser.can('editEntries:7') %}
            {# user can edit the current entry #}
          {% endif %}
      {% endif %}
  
  {% endif %}
  
  ```
  
  All is fine, but if I change the url to another valid url (where the logged in user is not the author) I am still able to see the entry.
  
  Is there a way to prevent that? Is it as easy as just checking/comparing authors? Or is there a more eloquent way? I do have other permissions disabled...
  [![enter image description here](https://i.sstatic.net/E3Dr3.png)](https://i.sstatic.net/E3Dr3.png)
  
  Thank you for any suggestions!
  
  **Tags:** craft3
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2018-10-29. Score: 2 | Accepted answer
  
  You can check if the current entry's author is the `currentUser`.
  
  ```
  {% if entry.author.id == currentUser.id %}
      {# User can edit entry #}
  {% endif %}
  
  ```
  
  > **Comments:**
  > **username_0**: Thank you! It turned out, I needed to enable the other options, and check if the user was related to another entry to verify the ability to edit/delete.  
  
  ---
  
  