tuandm / laravue

Admin dashboard for enterprise Laravel applications built by VueJS and Element UI https://laravue.dev
https://laravue.dev
MIT License
2.21k stars 653 forks source link

Just trying to understand the permissions #83

Closed Benoit1980 closed 5 years ago

Benoit1980 commented 5 years ago

Hello,

Well done, this is a great admin panel!

I would like to understand further the permissions as I do not know if this is a bug or normal.

Upon login as an administrator, I see all the menus on the left side, fine. These menus(as I understand it) are just demo pages with multiple components.

So based on that, it looks like I will not use the admin account as there are too many demo pages. This takes me to the manager account and user account(as I won't use the others).

I removed, from the admin account, all the permissions for the manager and user: /#/administrator/roles>>Edit permissions.

I unticked them all and emptied the cache: php artisan cache:clear php artisan view:clear php artisan config:clear php artisan config:cache

Upon reloading the admin panel and login in as a user or Manager, all the left side menus are still showing, why?

Also, in the permission popup as shown below: Annotation 2019-10-17 235916

If I create a new folder with an index.vue page and would like this folder to appear in this permission popup, how to do this please? As I cannot see this in your docs.

Thank you.

tuandm commented 5 years ago

@FreddyCrugger I've cleared all permissions or Manager role: image

And this is the result (after logging with manager account): image

Is this what you are expecting?

Please note that we also manage permission at user level.

I will create a document to guide how to add new page to permission system.

Thanks.

Benoit1980 commented 5 years ago

Thank you for your reply. What I was expecting is that when I untick one permission, the left side link in the navbar should disappear as well at the page itself(I mean...it should give a 404 error).

I have been on it this morning but still cannot work it out sorry :-)

I have added this in my index route:

  {
    path: '/speech',
    component: Layout,
    redirect: '/speech/index',
    meta: {
      title: 'speech',
      icon: 'clipboard',
      noCache: true,
      permissions: ['view menu speech']
    },
    children: [
      {
        path: 'index',
        component: () => import('@/views/speech/index.vue'),
        name: 'speech',
        meta: { title: 'speech', roles: ['admin'] },
      },
    ],
  },

This created the side menu item "Speech" I have also created a speech folder and an index.vue file. When clicking on the link, I can see the page. All good till now.

I have then added the permission "view menu speech" to the table "permissions". I was trying to find a way to add this from the GUI but could not. So I have input this permission manually in the DB.

Now, where I am very confused is that I unticked(in the edit permission manager) the permission "view menu speech" for the "user" but left it ticked for the "admin".

Upon login as a "user", I still see the left side link "speech" and can still click on it. I emptied the browser cache and laravel cache, same thing.

Did I miss something somewhere please?

Benoit1980 commented 5 years ago

@FreddyCrugger I've cleared all permissions or Manager role: image

And this is the result (after logging with manager account): image

Is this what you are expecting?

Please note that we also manage permission at user level.

I will create a document to guide how to add new page to permission system.

Thanks.

Will you be able to update me on this post when you will have the new guide online please?

Thank you.

tuandm commented 5 years ago

@FreddyCrugger I'm working on the documentation, but seems your new permission isn't added for admin group, therefore it doesn't show. I will update you when the document is done.

tuandm commented 5 years ago

@FreddyCrugger Here is the document for how to work with permission: https://doc.laravue.dev/guide/development/work-with-permission.html