Skip to content

Commit

Permalink
fix bug: new user without menus will not show page
Browse files Browse the repository at this point in the history
  • Loading branch information
taoyu65 committed Aug 9, 2017
1 parent f1ecfbe commit e6b356f
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 17 deletions.
9 changes: 5 additions & 4 deletions src/Models/User.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,13 @@ public function menusJson()
{
$minute = Config::get('umi.cache_minutes');
$json = Cache::remember('menuJson', $minute, function () {
return self::find(Auth::user()->id)
return $re = self::find(Auth::user()->id)
->MenuJson()
->firstOrFail()
->json;
->first();
//->firstOrFail()
//->json;
});
return $json;
return $json ? $json->json : $json;
}

public function userNameList()
Expand Down
8 changes: 4 additions & 4 deletions src/Umi/TableRelation/TRDeleteInterlock.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@ public function showConfirmation($activeTableName, $activeField, $currentFieldVa

public function executeExtraOperation($activeTableName, $activeField, $currentFieldValue, $targetValue, $responseTableName, $responseField, $checkOperation = '=')
{
// $count = DB::table($responseTableName)
// ->where($responseField, $checkOperation, $currentFieldValue)
// ->delete();
return 0;//$count;//todo - waiting for final test
$count = DB::table($responseTableName)
->where($responseField, $checkOperation, $currentFieldValue)
->delete();
return $count;
}

private function errMessage($activeTableName, $activeField, $currentFieldValue, $targetValue, $responseTableName, $responseField, $checkOperation)
Expand Down
2 changes: 1 addition & 1 deletion src/Umi/TableRelation/UmiTableRelation.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ class UmiTableRelation
public $message;

public function showConfirmation($activeFieldValues)
{//todo - need to see authority for all the relation operation.
{
$tableId = YM::currentTableId();
$TRO = new TableRelationOperation();
$rules = $TRO->getRulesForConfirmation($tableId);
Expand Down
6 changes: 4 additions & 2 deletions src/Umi/umiMenusBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,8 @@ public function Menus($json = '')
$json = $json === '' ? $this->menusJson() : $json;

if (!is_string($json) || !is_array(json_decode($json)))
throw new Exception('loading Menus was failed');
//throw new Exception('loading Menus was failed');
return 'No menus or Loading menus was failed, Please set a user menus permission first!';

$html = '';//$this->dashboard();
try {
Expand Down Expand Up @@ -324,7 +325,8 @@ public function showDragDropTreeByJson($jsonArr)
#show user's menu, reading from user's json, can be customized
private function createUserTree($jsonArr)
{
$html = '<ol class="dd-list">';
$emptyContainer = count($jsonArr) > 0 ? '' : 'dd-empty';
$html = "<ol class='dd-list $emptyContainer'>";

foreach ($jsonArr as $item) {
$record = $this->menus->getOneMenu($item->id);
Expand Down
6 changes: 0 additions & 6 deletions src/resources/views/field/fieldBrowserRead.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -314,12 +314,6 @@ function recordDelete(tableName, tableId) {
});
}
//更新记录
//update record
function recordEdit(tableName, tableId) {
//todo - edit need to be completed
}
//加载数据当选择表名的时候
//load data when select table name
function loadTable(url) {
Expand Down

0 comments on commit e6b356f

Please sign in to comment.