1
0
mirror of https://github.com/BookStackApp/BookStack.git synced 2025-08-07 23:03:00 +03:00

Added permission system

This commit is contained in:
Dan Brown
2015-08-29 15:03:42 +01:00
parent 0513239c25
commit ae95d0a239
24 changed files with 519 additions and 87 deletions

View File

@@ -60,6 +60,11 @@
&.large {
padding: $-xl;
}
>h1, >h2, >h3, >h4 {
&:first-child {
margin-top: 0.1em;
}
}
}
.padded-vertical, .padded-top {
padding-top: $-m;
@@ -67,6 +72,7 @@
padding-top: $-xl;
}
}
.padded-vertical, .padded-bottom {
padding-bottom: $-m;
&.large {

View File

@@ -197,7 +197,7 @@ p.secondary, p .secondary, span.secondary, .text-secondary {
*/
ul {
list-style: disc;
margin-left: $-m;
margin-left: $-m*1.5;
}
/*

View File

@@ -0,0 +1,11 @@
<?php
return [
/**
* Error text strings.
*/
// Pages
'permission' => 'You do not have permission to access the requested page.',
];

View File

@@ -0,0 +1,15 @@
<select id="{{ $name }}" name="{{ $name }}">
@foreach($options as $option)
<option value="{{$option->id}}"
@if($errors->has($name)) class="neg" @endif
@if(isset($model) || old($name)) @if(old($name) && old($name) === $option->id) selected @elseif(isset($model) && $model->id === $option->id) selected @endif @endif
>
{{ $option->$displayKey }}
</option>
@endforeach
</select>
@if($errors->has($name))
<div class="text-neg text-small">{{ $errors->first($name) }}</div>
@endif

View File

@@ -14,6 +14,7 @@
<div class="row">
<div class="page-content">
<div class="row">
<div class="col-md-6">
<h1>Edit User</h1>
@@ -33,6 +34,24 @@
</div>
</div>
</div>
<hr class="margin-top large">
<div class="row">
<div class="col-md-12">
<h3>Permissions</h3>
<p>User Role: <strong>{{$user->role->display_name}}</strong>.</p>
<ul class="text-muted">
@foreach($user->role->permissions as $permission)
<li>
{{ $permission->display_name }}
</li>
@endforeach
</ul>
</div>
</div>
</div>
</div>

View File

@@ -1,4 +1,3 @@
<div class="form-group">
<label for="name">Name</label>
@include('form/text', ['name' => 'name'])
@@ -10,11 +9,18 @@
</div>
@if(isset($model))
<div class="form-group">
<div class="form-group">
<span class="text-muted">
Only fill the below if you would like <br>to change your password:
</span>
</div>
</div>
@endif
@if($currentUser->can('user-update'))
<div class="form-group">
<label for="role">User Role</label>
@include('form/model-select', ['name' => 'role', 'options' => \Oxbow\Role::all(), 'displayKey' => 'display_name'])
</div>
@endif
<div class="form-group">

View File

@@ -8,7 +8,9 @@
<div class="col-md-6"></div>
<div class="col-md-6 faded">
<div class="action-buttons">
<a href="/users/create" class="text-pos"><i class="zmdi zmdi-account-add"></i>New User</a>
@if($currentUser->can('user-create'))
<a href="/users/create" class="text-pos"><i class="zmdi zmdi-account-add"></i>New User</a>
@endif
</div>
</div>
</div>
@@ -21,12 +23,22 @@
<th></th>
<th>Name</th>
<th>Email</th>
<th>User Type</th>
</tr>
@foreach($users as $user)
<tr>
<td style="line-height: 0;"><img class="avatar" src="{{$user->getAvatar(40)}}" alt="{{$user->name}}"></td>
<td><a href="/users/{{$user->id}}">{{$user->name}}</a></td>
<td>
@if($currentUser->can('user-update') || $currentUser->id == $user->id)
<a href="/users/{{$user->id}}">
@endif
{{$user->name}}
@if($currentUser->can('user-update') || $currentUser->id == $user->id)
</a>
@endif
</td>
<td>{{$user->email}}</td>
<td>{{ $user->role->display_name }}</td>
</tr>
@endforeach
</table>