Skip to content

Commit

Permalink
check and complete permission-role function
Browse files Browse the repository at this point in the history
1. fix the validation does not work for password data type
2. path problem. forgot to use url method
3. complete adding role function.
  • Loading branch information
taoyu65 committed Aug 11, 2017
1 parent 29bd8a7 commit 70522d9
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 14 deletions.
7 changes: 4 additions & 3 deletions src/Umi/DataTable/DataType/BcryptPasswordDataType.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,17 @@ class BcryptPasswordDataType extends DataTypeAbstract
{
public function regulateDataEditAdd($data, $relatedTable = '', $relatedField = '', $validation = '', $option = [])
{
return $this->getHtml($data, $option);
return $this->getHtml($data, $option, $validation);
}

private function getHtml($data, $option)
private function getHtml($data, $option, $validation)
{
$property = $this->getProperty($option);
$validation = $this->getValidation($validation);
$url = url('/api/generatePassword');

return <<<UMI
<input class='form-control' type='password' $property id='thisPassword' placeholder='after input click Generate Password'>
<input class='form-control' type='password' $property $validation id='thisPassword' placeholder='after input click Generate Password'>
<button type='button' class='btn btn-sm btn-info' onclick="getPassword()">Generate Password</button>
<span id="status"></span>
<script>
Expand Down
18 changes: 13 additions & 5 deletions src/resources/views/authority/rolePermission.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

@section('content')

<?php $assetPath = config('umi.assets_path') ?>
<?php $path = $assetPath . '/ace' ?>
<?php $assetPath = url(config('umi.assets_path')) ?>
<?php $path = url($assetPath . '/ace') ?>

<h3 class="header smaller orange">{{trans('umiTrans::rolePermission.selectRole')}}: <strong><span id="roleTitle" class="red roleTitle"></span></strong></h3>
<form class="form-horizontal" id="updateSubmit" action="{{url('authority/wizardUpdate')}}" method="post">
Expand Down Expand Up @@ -41,7 +41,7 @@

<script src="{{$path}}/js/jquery.validate.min.js"></script>

<script>
<script type="text/javascript">
$(document).ready(function () {
//根据角色获取权限
//get all permissions according to the role selected
Expand Down Expand Up @@ -102,14 +102,22 @@
});
$('#newPermissions').val(JSON.stringify(newPermission));
$('#updateSubmit').validate({errorClass: 'red'});
$("#updateSubmit").validate({errorClass: 'red'});
$('#updateSubmit').submit();
});
//增加一个新角色
//add a new role
$('#addNewRole').click(function () {
var url = "{{url('adding') . '/' . config('umiEnum.system_table_name.umi_roles')}}";
layer.open({
type: 2,
title: 'Add Role',
maxmin: true,
shadeClose: true,
area: ['80%', '90%'],
content: url
});
});
});
</script>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
<label>
<input name="browser{{$table->id}}" class="ace ace-checkbox-2 permissionCheckBox" type="checkbox"
{{in_array('browser' . $table->id, $permission) ? '' : 'disabled'}} />
<span class="lbl"> {{trans('umiTrans::permissionCheckBox.browser')}}</span>
<span class="lbl">{{trans('umiTrans::permissionCheckBox.browser')}}</span>
</label>
</div>
</div>
Expand All @@ -42,7 +42,7 @@
<label>
<input name="read{{$table->id}}" class="ace ace-checkbox-2 permissionCheckBox" type="checkbox"
{{in_array('read' . $table->id, $permission) ? '' : 'disabled'}} />
<span class="lbl"> {{trans('umiTrans::permissionCheckBox.read')}}</span>
<span class="lbl">{{trans('umiTrans::permissionCheckBox.read')}}</span>
</label>
</div>
</div>
Expand All @@ -51,7 +51,7 @@
<label>
<input name="edit{{$table->id}}" class="ace ace-checkbox-2 permissionCheckBox" type="checkbox"
{{in_array('edit' . $table->id, $permission) ? '' : 'disabled'}} />
<span class="lbl"> {{trans('umiTrans::permissionCheckBox.edit')}}</span>
<span class="lbl">{{trans('umiTrans::permissionCheckBox.edit')}}</span>
</label>
</div>
</div>
Expand All @@ -60,7 +60,7 @@
<label>
<input name="add{{$table->id}}" class="ace ace-checkbox-2 permissionCheckBox" type="checkbox"
{{in_array('add' . $table->id, $permission) ? '' : 'disabled'}} />
<span class="lbl"> {{trans('umiTrans::permissionCheckBox.add')}}</span>
<span class="lbl">{{trans('umiTrans::permissionCheckBox.add')}}</span>
</label>
</div>
</div>
Expand All @@ -69,7 +69,7 @@
<label>
<input name="delete{{$table->id}}" class="ace ace-checkbox-2 permissionCheckBox" type="checkbox"
{{in_array('delete' . $table->id, $permission) ? '' : 'disabled'}} />
<span class="lbl"> {{trans('umiTrans::permissionCheckBox.delete')}}</span>
<span class="lbl">{{trans('umiTrans::permissionCheckBox.delete')}}</span>
</label>
</div>
</div>
Expand Down
2 changes: 1 addition & 1 deletion src/resources/views/login.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<meta charset="utf-8" />
<title>UMI admin - login page</title>

<?php $path = config('umi.assets_path') . '/ace' ?>
<?php $path = url(config('umi.assets_path')) . '/ace' ?>

<meta name="description" content="User login page" />
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0" />
Expand Down

0 comments on commit 70522d9

Please sign in to comment.