Skip to content

Commit

Permalink
Permissions
Browse files Browse the repository at this point in the history
  • Loading branch information
24aitor committed Apr 24, 2017
1 parent 50ef79d commit 813840e
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 6 deletions.
6 changes: 3 additions & 3 deletions src/Policies/RolePolicy.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ public function create($user)
*
* @return bool
*/
public function update($user)
public function update($user, $role)
{
return User::findOrFail($user->id)->hasPermission('laralum::roles.update');
}
Expand All @@ -65,7 +65,7 @@ public function update($user)
*
* @return bool
*/
public function manage_permissions($user)
public function manage_permissions($user, $role)
{
return User::findOrFail($user->id)->hasPermission('laralum::roles.permissions');
}
Expand All @@ -77,7 +77,7 @@ public function manage_permissions($user)
*
* @return bool
*/
public function delete($user)
public function delete($user, $role)
{
return User::findOrFail($user->id)->hasPermission('laralum::roles.delete');
}
Expand Down
30 changes: 27 additions & 3 deletions src/Views/index.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,33 @@
<td style="color:{{ $role->color }}">{{ $role->name }}</td>
<td class="uk-table-shrink">
<div class="uk-button-group">
<a href="{{ route('laralum::roles.edit', ['id' => $role->id]) }}" class="uk-button uk-button-small uk-button-default">@lang('laralum_roles::general.edit')</a>
<a href="{{ route('laralum::roles.permissions', ['id' => $role->id]) }}" class="uk-button uk-button-small uk-button-default">@lang('laralum_roles::general.permissions')</a>
<a href="{{ route('laralum::roles.destroy.confirm', ['ticket' => $role->id]) }}" class="uk-button uk-button-small uk-button-danger">@lang('laralum_roles::general.delete')</a>
@can('update', $role)
<a href="{{ route('laralum::roles.edit', ['id' => $role->id]) }}" class="uk-button uk-button-small uk-button-default">
@lang('laralum_roles::general.edit')
</a>
@else
<button disabled="disabled" class="uk-button uk-button-small uk-button-default uk-disabled">
@lang('laralum_roles::general.edit')
</button>
@endcan
@can('update', $role)
<a href="{{ route('laralum::roles.permissions', ['id' => $role->id]) }}" class="uk-button uk-button-small uk-button-default">
@lang('laralum_roles::general.permissions')
</a>
@else
<button disabled="disabled" class="uk-button uk-button-small uk-button-default uk-disabled">
@lang('laralum_roles::general.permissions')
</button>
@endcan
@can('delete', $role)
<a href="{{ route('laralum::roles.destroy.confirm', ['ticket' => $role->id]) }}" class="uk-button uk-button-small uk-button-danger">
@lang('laralum_roles::general.delete')
</a>
@else
<button disabled="disabled" class="uk-button uk-button-small uk-button-default uk-disabled">
@lang('laralum_roles::general.delete')
</button>
@endcan
</div>
</td>
</tr>
Expand Down

0 comments on commit 813840e

Please sign in to comment.