Review main Abandoned

56557[WIP][FEATURE] Provide VH to check whether the backend user is an administrator

Josef Glatz CR 0 V 0 Normal +165 −0 updated 11/16/18, 10:12

Commit message

Provide a ifAdmin/else condition ViewHelper to check whether the
backend user is an administrator.

Useful e.g. in backend preview fluid templates (page module) when
you want to show extended information only to administrators.

A unit test is added to test such a sensitive security related condition.

Usage examples:

<f:be.security.ifIsAdmin>
    Only visible to a backend admin user
</f:be.security.ifIsAdmin>

<f:be.security.ifIsAdmin>
  <f:then>Only visible to a backend admin user</f:then>
  <f:else>Only visible to a non backend admin user</f:else>
</f:be.security.ifIsAdmin>

{f:be.security.ifIsAdmin(then: 'Only visible to a backend admin user')}
{f:be.security.ifIsAdmin(else: 'Only visible to a non backend admin user')}
{f:be.security.ifIsAdmin(then: 'admin only', else: 'show a text to non admin users')}

Review

  • Code review CR 0
  • Verified V 0

Issues 1

Files 3

Review log 1724

  1. Josef Glatz uploaded patch set 1 04/05/18, 07:00

  2. TYPO3com voted on patch set 1 V +1 04/05/18, 07:08 Completed build in 07m 48s on Thu, 5 Apr, 09:08 AM Test Summary: 30921 passed Find logs and detail information at https://bamboo.typo3.com/browse/CORE-GTC-22021

  3. Mathias Brodala commented on patch set 1 04/05/18, 07:09

    Feature-84622-ViewHelperBeSecurityIfIsAdmin.rst:20

    I'd recommend "user.isAdmin" instead to make this more readable. The PHP class location and namespace needs to be changed accordingly of course.
  4. Josef Glatz commented on patch set 1 04/05/18, 07:33

    Feature-84622-ViewHelperBeSecurityIfIsAdmin.rst:20 Reply

    I've added it to this namespace because of the other already existing VHs. But I think your idea is great – feels more intuitive
  5. Josef Glatz updated the commit message in patch set 2 04/05/18, 07:42

  6. TYPO3com voted on patch set 2 V +1 04/05/18, 07:53 Completed build in 10m 14s on Thu, 5 Apr, 09:53 AM Test Summary: 30921 passed Find logs and detail information at https://bamboo.typo3.com/browse/CORE-GTC-22023

  7. Benni Mack commented on patch set 2 04/05/18, 08:26

    full ack with Mathias
  8. Benni Mack commented on patch set 1 04/05/18, 09:31

    Feature-84622-ViewHelperBeSecurityIfIsAdmin.rst:20 Reply

    Mathias - how about <f:be.security.isAdmin>?
  9. Mathias Brodala commented on patch set 1 04/05/18, 09:35

    Feature-84622-ViewHelperBeSecurityIfIsAdmin.rst:20 Reply

    "backend security is admin" still doesn't sound very logical compared to "backend user is admin" IMO. I can accept the current name if we want to continue with the current naming scheme but it's still odd.
  10. Benni Mack commented on patch set 1 04/05/18, 09:39

    Feature-84622-ViewHelperBeSecurityIfIsAdmin.rst:20 Reply

    Yes. I'd keep it for now and get rid of that weird "security" thing. However, the "be" part is valuable in my opinion. At some later point we should unify and rename the viewhelpers into a new scheme (probably once we loose the dependency on Extbase) while keeping old namings in place. For now, this seems to be overkill to do this with this change.
  11. Mathias Brodala commented on patch set 1 04/05/18, 09:41

    Feature-84622-ViewHelperBeSecurityIfIsAdmin.rst:20 Reply

    Agreed.
  12. Mathias Brodala commented on patch set 2 04/05/18, 12:34

    IfIsAdminViewHelper.php:72

    Please drop this method, see https://review.typo3.org/56561
  13. Josef Glatz commented on patch set 1 04/06/18, 08:24

    on it
  14. Josef Glatz uploaded patch set 3 04/08/18, 07:22

  15. TYPO3com voted on patch set 3 V -1 04/08/18, 07:30 Completed build in 08m 01s on Sun, 8 Apr, 09:30 AM Test Summary: 6 of 31106 failed Find logs and detail information at https://bamboo.typo3.com/browse/CORE-GTC-22193

  16. Stefan Neufeind rebased onto patch set 4 06/22/18, 15:07

  17. TYPO3com voted on patch set 4 V -1 06/22/18, 15:07 Completed build in 07s on Fri, 22 Jun, 05:07 PM Test Summary: No tests found Find logs and detail information at https://bamboo.typo3.com/browse/CORE-GTC-24624

  18. Josef Glatz rebased onto patch set 5 06/25/18, 16:02

  19. TYPO3com voted on patch set 5 V -1 06/25/18, 16:03 Completed build in 06s on Mon, 25 Jun, 06:03 PM Test Summary: No tests found Find logs and detail information at https://bamboo.typo3.com/browse/CORE-GTC-24846

  20. Josef Glatz uploaded patch set 6 06/25/18, 16:18

  21. TYPO3com voted on patch set 6 V -1 06/25/18, 16:27 Completed build in 08m 17s on Mon, 25 Jun, 06:27 PM Test Summary: 7 of 32984 failed Find logs and detail information at https://bamboo.typo3.com/browse/CORE-GTC-24847

  22. Josef Glatz updated the commit message in patch set 7 06/25/18, 16:50

  23. TYPO3com voted on patch set 7 V -1 06/25/18, 16:59 Completed build in 08m 11s on Mon, 25 Jun, 06:59 PM Test Summary: 6 of 32983 failed Find logs and detail information at https://bamboo.typo3.com/browse/CORE-GTC-24848

  24. Josef Glatz abandoned the change 11/16/18, 10:12