Merge permissions cache and inherited permissions #110
@ -0,0 +1,42 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
class CreateAlbumPermissionsCacheTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('album_permissions_cache', function (Blueprint $table) {
|
||||
$table->unsignedInteger('user_id');
|
||||
$table->unsignedInteger('album_id');
|
||||
$table->unsignedInteger('permission_id');
|
||||
|
||||
$table->foreign('user_id')
|
||||
->references('id')->on('users')
|
||||
->onDelete('cascade');
|
||||
$table->foreign('album_id')
|
||||
->references('id')->on('albums')
|
||||
->onDelete('cascade');
|
||||
$table->foreign('permission_id')
|
||||
->references('id')->on('permissions')
|
||||
->onDelete('no action');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('album_permissions_cache');
|
||||
}
|
||||
}
|
@ -45,3 +45,37 @@ function AboutViewModel(urls) {
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* This model is used by admin/settings.blade.php.
|
||||
* @constructor
|
||||
*/
|
||||
function SettingsViewModel(urls) {
|
||||
this.el = '#settings-app';
|
||||
|
||||
this.data = {
|
||||
is_rebuilding_permissions_cache: false
|
||||
};
|
||||
|
||||
this.methods = {
|
||||
rebuildPermissionsCache: function () {
|
||||
var self = this;
|
||||
|
||||
$.ajax(
|
||||
urls.rebuild_permissions_cache,
|
||||
{
|
||||
complete: function() {
|
||||
self.is_rebuilding_permissions_cache = false;
|
||||
},
|
||||
dataType: 'json',
|
||||
error: function (xhr, textStatus, errorThrown) {
|
||||
},
|
||||
method: 'GET',
|
||||
success: function (data) {
|
||||
alert('success');
|
||||
}
|
||||
}
|
||||
);
|
||||
}
|
||||
};
|
||||
}
|
@ -209,6 +209,9 @@ return [
|
||||
'analytics_enable_visitor_hits' => 'Enable built-in visitor hit tracking',
|
||||
'analytics_enable_visitor_hits_description' => 'Visitor hits to the public gallery will be recorded in the Blue Twilight database, allowing for analysis such as the most popular album/photo.',
|
||||
'analytics_tab' => 'Analytics',
|
||||
'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',
|
||||
'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',
|
||||
|
@ -10,7 +10,7 @@
|
||||
@section('content')
|
||||
<div class="container">
|
||||
<div class="row">
|
||||
<div class="col">
|
||||
<div class="col" id="settings-app">
|
||||
<h1>@yield('title')</h1>
|
||||
<p style="margin-bottom: 30px;">@lang('admin.settings_intro')</p>
|
||||
|
||||
@ -239,7 +239,9 @@
|
||||
</label>
|
||||
</div>
|
||||
|
||||
<fieldset style="margin-top: 30px;">
|
||||
<hr/>
|
||||
|
||||
<fieldset>
|
||||
<legend>@lang('admin.settings_recaptcha')</legend>
|
||||
|
||||
<div class="form-group">
|
||||
@ -265,7 +267,9 @@
|
||||
</div>
|
||||
</fieldset>
|
||||
|
||||
<fieldset style="margin-top: 20px;">
|
||||
<hr/>
|
||||
|
||||
<fieldset>
|
||||
<legend>@lang('admin.settings_image_protection')</legend>
|
||||
|
||||
<div class="form-check">
|
||||
@ -284,6 +288,14 @@
|
||||
</label>
|
||||
</div>
|
||||
</fieldset>
|
||||
|
||||
<hr/>
|
||||
|
||||
<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>
|
||||
</fieldset>
|
||||
</div>
|
||||
|
||||
{{-- Analytics --}}
|
||||
@ -479,7 +491,13 @@
|
||||
|
||||
@push('scripts')
|
||||
<script type="text/javascript">
|
||||
var viewModel = new SettingsViewModel({
|
||||
'rebuild_permissions_cache': '{{ route('admin.rebuildPermissionsCache') }}'
|
||||
});
|
||||
|
||||
$(document).ready(function() {
|
||||
var app = new Vue(viewModel);
|
||||
|
||||
$('#test-email-button').click(function() {
|
||||
var data = $('form').serialize();
|
||||
$('#test-email-status').show();
|
||||
|
@ -21,6 +21,7 @@ Route::group(['prefix' => 'admin'], function () {
|
||||
Route::get('/photo-metadata', 'Admin\DefaultController@metadataUpgrade')->name('admin.metadataUpgrade');
|
||||
Route::post('quick-upload', 'Admin\DefaultController@quickUpload')->name('admin.quickUpload');
|
||||
Route::post('settings/save', 'Admin\DefaultController@saveSettings')->name('admin.saveSettings');
|
||||
Route::post('settings/rebuild-permissions-cache', 'Admin\DefaultController@rebuildPermissionsCache')->name('admin.rebuildPermissionsCache');
|
||||
Route::post('settings/test-email', 'Admin\DefaultController@testMailSettings')->name('admin.testMailSettings');
|
||||
Route::get('settings', 'Admin\DefaultController@settings')->name('admin.settings');
|
||||
Route::post('statistics/save', 'Admin\StatisticsController@save')->name('admin.statistics.save');
|
||||
|
Loading…
Reference in New Issue
Block a user