Merge permissions cache and inherited permissions #110

Merged
aheathershaw merged 10 commits from feature/71-permissions-cache into master 2018-09-16 22:19:38 +01:00
4 changed files with 25 additions and 8 deletions
Showing only changes of commit b03ab47039 - Show all commits

View File

@ -216,6 +216,11 @@ class DefaultController extends Controller
return $photoController->store($request);
}
public function rebuildPermissionsCache()
{
return response()->json(true);
}
public function saveSettings(SaveSettingsRequest $request)
{
$this->authorizeAccessToAdminPanel('admin:configure');

View File

@ -50,7 +50,7 @@ function AboutViewModel(urls) {
* This model is used by admin/settings.blade.php.
* @constructor
*/
function SettingsViewModel(urls) {
function SettingsViewModel(urls, lang) {
this.el = '#settings-app';
this.data = {
@ -58,7 +58,7 @@ function SettingsViewModel(urls) {
};
this.methods = {
rebuildPermissionsCache: function () {
rebuildPermissionsCache: function (e) {
var self = this;
$.ajax(
@ -69,13 +69,17 @@ function SettingsViewModel(urls) {
},
dataType: 'json',
error: function (xhr, textStatus, errorThrown) {
alert(lang.permissions_cache_rebuild_failed);
},
method: 'GET',
method: 'POST',
success: function (data) {
alert('success');
alert(lang.permissions_cache_rebuild_succeeded);
}
}
);
e.preventDefault();
return false;
}
};
}

View File

@ -212,6 +212,8 @@ return [
'permissions_cache' => 'Permissions Cache',
'permissions_cache_intro' => 'Blue Twilight maintains the permissions each user has to albums in the database. If you feel these aren\'t correct based on what\'s configured, you can rebuild the cache by clicking the button below.',
'rebuild_permissions_cache' => 'Rebuild Permissions Cache',
'rebuild_permissions_cache_failed' => 'The permissions cache rebuild failed to complete. Please check the server logs.',
'rebuild_permissions_cache_succeeded' => 'The permissions cache rebuild completed successfully.',
'security_allow_self_registration' => 'Allow self-registration',
'security_allow_self_registration_description' => 'With this option enabled, users can sign up for their own accounts. You can grant permissions to accounts to allow users to upload their own photos or manage yours.',
'social_facebook' => 'Facebook',

View File

@ -294,7 +294,7 @@
<fieldset>
<legend>@lang('admin.settings.permissions_cache')</legend>
<p>@lang('admin.settings.permissions_cache_intro')</p>
<button class="btn btn-primary">@lang('admin.settings.rebuild_permissions_cache')</button>
<button class="btn btn-primary" v-on:click="rebuildPermissionsCache">@lang('admin.settings.rebuild_permissions_cache')</button>
</fieldset>
</div>
@ -491,9 +491,15 @@
@push('scripts')
<script type="text/javascript">
var viewModel = new SettingsViewModel({
var viewModel = new SettingsViewModel(
{
'rebuild_permissions_cache': '{{ route('admin.rebuildPermissionsCache') }}'
});
},
{
'permissions_cache_rebuild_failed': '@lang('admin.settings.rebuild_permissions_cache_failed')',
'permissions_cache_rebuild_succeeded': '@lang('admin.settings.rebuild_permissions_cache_succeeded')'
}
);
$(document).ready(function() {
var app = new Vue(viewModel);