mardi 20 septembre 2016

RBAC managing permissions by role

I'm currently trying to make this work:

http://ift.tt/2cPVcrE

However, this doesn't seem to work out for me. So I want to be able to manage the permissions by role. Like Role 'member' needs to have specific perms, but if necessary, I want to be able to add or remove those permissions. I really don't know how I should fix this and I'm stuck at the moment I need to show if the user has the permission enabled or not.

This is my current code:

HTML:

<table class="table">
   <thead>
      <tr>
        <th>Naam</th>
        <th>Beschrijving</th>
        <th>Status</th>
        <th></th>
      </tr>
    </thead>
    <tbody>
      @foreach($getperms as $perm)
         <tr>
           <td></td>
           <td></td>
           <td><span class="label label-danger">Not enabled</span></td>
           <td><input type="checkbox" name=""></td>
          </tr>
       @endforeach
      </tbody>
</table>

And this is my controller:

/**
     * editUserPerms
     *
     * @return Response
     */
    public function editRolePerms($id)
    {
      $getrole = Role::find($id);

      $getperms = Permission::all();

      return view('admin.editroleperms')->with('role', $getrole)->with('getperms', $getperms);
    }

If someone could help me out with this, so I'm able to grant or revoke permissions and see if the permission is nabled or not would be awesome.e



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire