trilbymedia / grav-plugin-flex-directory

Flexible plugin that allows CRUD functionality on complex data types
MIT License
39 stars 7 forks source link

Access for groups #23

Open achwell opened 6 years ago

achwell commented 6 years ago

Would it be possible to include configuration that tells which group(s) that should have access to this plugin?

mahagr commented 6 years ago

In admin it has these permission checks:

access:
    admin.flex-directory: true
    admin.super: true
achwell commented 6 years ago

But not possible to let only people with one specific group edit content in flex-directory? If editor of flex-directory-content is not admin?

mahagr commented 6 years ago

Yes. Create a user group which has access to admin.flex-directory and prevent access on other parts of admin.

achwell commented 6 years ago

Created group with admin.flex-directory: "true", admin.login: "true", everything else "false" , and user with this group only. When logged in with user, only "Dashboard" and "Log out" in menu.

Tried with Grav 1.3.10 and 1.4.0-rc.1, same result

grouprights logged in user

jazzyjube commented 5 years ago

Same problem here :/ Properly set flex-directory permission to the group but impossible to see on the sidebar when logged as the group user. Perhaps, it's possible for the group user to access the url /admin/flex-directory/entries directly from the browser.

Have a good day

jazzyjube commented 5 years ago

Found a fix to access the entry manager logged as a specific group user !

  1. As you mentioned before, we need first to set the permission to the group :

    Created group with admin.flex-directory: "true", admin.login: "true", everything else "false" , and user with this group only.

  2. Change line 92 in user/⁨plugins⁩/⁨flex-directory⁩/⁨flex-directory⁩.php for :

$this->grav['twig']->plugins_hooked_nav['PLUGIN_FLEX_DIRECTORY.TITLE'] = ['route' => $this->name .'/entries', 'icon' => 'fa-list', 'authorize' => ' admin.flex-directory'];

It was missing a parameter for the navigation template to check if we can access or not