菜单
This commit is contained in:
parent
a6bc413aef
commit
57cb57b0f1
@ -12,7 +12,15 @@ class AuthAdminCheckPermission
|
||||
{
|
||||
$alias = $request->route()[1]['as'];
|
||||
|
||||
if ($this->hasConfigured($alias) && !$this->shouldPassThrough($request)) {
|
||||
$alias = str_replace('api.', '', $alias);
|
||||
|
||||
$permissions = app(PermissionService::class)->getPermissions()->pluck('name')->toArray();
|
||||
|
||||
foreach ($permissions as $key => $value) {
|
||||
$permissions[$key] = str_replace('_', '.', $value);
|
||||
}
|
||||
|
||||
if (in_array($alias, $permissions) && !$this->shouldPassThrough($request)) {
|
||||
if (!$account->can($alias)) {
|
||||
throw new AuthException('用户无访问权限', AuthException::PERMISSION_DENIED);
|
||||
}
|
||||
@ -41,21 +49,4 @@ class AuthAdminCheckPermission
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* 已配置过权限的
|
||||
*
|
||||
* @param Request $request
|
||||
* @return void
|
||||
*/
|
||||
protected function hasConfigured($alias)
|
||||
{
|
||||
$permissions = app(PermissionService::class)->getPermissions()->pluck('name')->toArray();
|
||||
|
||||
if (in_array($alias, $permissions)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
@ -29,7 +29,7 @@ class OrderController extends Controller
|
||||
*
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function paginate(Dicts $dicts)
|
||||
public function index(Dicts $dicts)
|
||||
{
|
||||
$conditions = $this->request->all();
|
||||
$conditions['limit'] = $this->request->get('limit', 20);
|
||||
|
@ -43,10 +43,10 @@ $router->group(['prefix' => 'virtual', 'as' => 'virtual', 'middleware' => ['admi
|
||||
$router->post('/products/destroy', ['as' => 'products.destroy', 'uses' => 'ProductController@destroy']);
|
||||
|
||||
// 订单管理
|
||||
$router->get('/orders/paginate', ['as' => 'orders/paginate', 'uses' => 'OrderController@paginate']);
|
||||
$router->get('/orders/show/{id}', ['as' => 'orders/show', 'uses' => 'OrderController@show']);
|
||||
$router->get('/orders/index', ['as' => 'orders.index', 'uses' => 'OrderController@index']);
|
||||
$router->get('/orders/show/{id}', ['as' => 'orders.show', 'uses' => 'OrderController@show']);
|
||||
$router->post('/orders/create', ['as' => 'orders.create', 'uses' => 'OrderController@create']);
|
||||
$router->post('/orders/update/{id}', ['as' => 'orders/update', 'uses' => 'OrderController@update']);
|
||||
$router->post('/orders/update/{id}', ['as' => 'orders.update', 'uses' => 'OrderController@update']);
|
||||
$router->post('/orders/destroy', ['as' => 'orders.destroy', 'uses' => 'OrderController@destroy']);
|
||||
|
||||
/**
|
||||
|
@ -14,7 +14,7 @@ class PermissionSeeder extends Seeder
|
||||
|
||||
const PERMISSIONS = [
|
||||
[
|
||||
'name' => 'system.ctrl.menu',
|
||||
'name' => 'system_ctrl',
|
||||
'title' => '系统设置',
|
||||
'path' => '#',
|
||||
'icon' => 'ios-settings',
|
||||
@ -22,46 +22,113 @@ class PermissionSeeder extends Seeder
|
||||
'open' => 3,
|
||||
'children' => [
|
||||
[
|
||||
'name' => 'api.permissions.menu', 'title' => '权限管理', 'path' => '/permissions', 'icon' => 'ios-cube', 'type' => 0, 'open' => 3,
|
||||
'name' => 'permissions', 'title' => '权限管理', 'path' => '/permissions', 'icon' => 'ios-cube', 'type' => 0, 'open' => 3,
|
||||
'children' => [
|
||||
['name' => 'api.permissions.create', 'title' => '创建', 'description' => 'create', 'type' => 1],
|
||||
['name' => 'api.permissions.update', 'title' => '编辑', 'description' => 'update', 'type' => 1],
|
||||
['name' => 'api.permissions.destroy', 'title' => '删除', 'description' => 'destroy', 'type' => 1],
|
||||
['name' => 'permissions.create', 'title' => '创建', 'description' => 'create', 'type' => 1],
|
||||
['name' => 'permissions.update', 'title' => '编辑', 'description' => 'update', 'type' => 1],
|
||||
['name' => 'permissions.destroy', 'title' => '删除', 'description' => 'destroy', 'type' => 1],
|
||||
],
|
||||
],
|
||||
[
|
||||
'name' => 'api.roles.menu', 'title' => '角色管理', 'path' => '/roles', 'icon' => 'ios-appstore', 'type' => 0, 'open' => 3,
|
||||
'name' => 'roles', 'title' => '角色管理', 'path' => '/roles', 'icon' => 'ios-appstore', 'type' => 0, 'open' => 3,
|
||||
'children' => [
|
||||
['name' => 'api.roles.index', 'title' => '查看', 'description' => 'index', 'type' => 1],
|
||||
['name' => 'api.roles.create', 'title' => '创建', 'description' => 'create', 'type' => 1],
|
||||
['name' => 'api.roles.update', 'title' => '编辑', 'description' => 'update', 'type' => 1],
|
||||
['name' => 'api.roles.destroy', 'title' => '删除', 'description' => 'destroy', 'type' => 1],
|
||||
['name' => 'api.roles.sync_permissions', 'title' => '分配权限', 'description' => 'sync', 'type' => 1],
|
||||
['name' => 'api.roles.sync_roles', 'title' => '分配角色', 'description' => 'sync', 'type' => 1],
|
||||
['name' => 'roles.show', 'title' => '查看', 'description' => 'show', 'type' => 1],
|
||||
['name' => 'roles.create', 'title' => '创建', 'description' => 'create', 'type' => 1],
|
||||
['name' => 'roles.update', 'title' => '编辑', 'description' => 'update', 'type' => 1],
|
||||
['name' => 'roles.destroy', 'title' => '删除', 'description' => 'destroy', 'type' => 1],
|
||||
['name' => 'roles.sync_permissions', 'title' => '分配权限', 'description' => 'jurisdiction', 'type' => 1],
|
||||
],
|
||||
],
|
||||
[
|
||||
'name' => 'api.accounts.menu', 'title' => '账号管理', 'path' => '/accounts', 'icon' => 'ios-browsers', 'type' => 0, 'open' => 3,
|
||||
'name' => 'accounts', 'title' => '账号管理', 'path' => '/accounts', 'icon' => 'ios-browsers', 'type' => 0, 'open' => 3,
|
||||
'children' => [
|
||||
['name' => 'api.accounts.index', 'title' => '查看', 'description' => 'index', 'type' => 1],
|
||||
['name' => 'api.accounts.create', 'title' => '创建', 'description' => 'create', 'type' => 1],
|
||||
['name' => 'api.accounts.update', 'title' => '编辑', 'description' => 'update', 'type' => 1],
|
||||
['name' => 'api.accounts.destroy', 'title' => '删除', 'description' => 'destroy', 'type' => 1],
|
||||
['name' => 'accounts.show', 'title' => '查看', 'description' => 'show', 'type' => 1],
|
||||
['name' => 'accounts.create', 'title' => '创建', 'description' => 'create', 'type' => 1],
|
||||
['name' => 'accounts.update', 'title' => '编辑', 'description' => 'update', 'type' => 1],
|
||||
['name' => 'accounts.destroy', 'title' => '删除', 'description' => 'destroy', 'type' => 1],
|
||||
],
|
||||
],
|
||||
[
|
||||
'name' => 'api.logs.menu', 'title' => '日志管理', 'path' => '/logs', 'icon' => 'ios-cube', 'type' => 0, 'open' => 3,
|
||||
'name' => 'logs', 'title' => '日志管理', 'path' => '/logs', 'icon' => 'ios-cube', 'type' => 0, 'open' => 3,
|
||||
'children' => [
|
||||
['name' => 'api.logs.index','title' => '查看','description' => 'index','type' => 1],
|
||||
['name' => 'api.logs.destroy','title' => '删除','description' => 'destroy','type' => 1],
|
||||
['name' => 'logs.show','title' => '查看','description' => 'show','type' => 1],
|
||||
['name' => 'logs.destroy','title' => '删除','description' => 'destroy','type' => 1],
|
||||
],
|
||||
],
|
||||
],
|
||||
],
|
||||
[
|
||||
'name' => 'virtual_company_ctrl',
|
||||
'title' => '企业设置',
|
||||
'path' => '#',
|
||||
'icon' => 'ios-settings',
|
||||
'type' => 0,
|
||||
'open' => 3,
|
||||
'children' => [
|
||||
[
|
||||
'name' => 'virtual.companies.index', 'title' => '企业管理', 'path' => '/companies', 'icon' => 'ios-cube', 'type' => 0, 'open' => 3,
|
||||
'children' => [
|
||||
['name' => 'virtual.companies.show', 'title' => '查看', 'description' => 'show', 'type' => 1],
|
||||
['name' => 'virtual.companies.create', 'title' => '创建', 'description' => 'create', 'type' => 1],
|
||||
['name' => 'virtual.companies.update', 'title' => '编辑', 'description' => 'update', 'type' => 1],
|
||||
['name' => 'virtual.companies.destroy', 'title' => '删除', 'description' => 'destroy', 'type' => 1],
|
||||
],
|
||||
],
|
||||
[
|
||||
'name' => 'virtual.company.accounts.index', 'title' => '账号管理', 'path' => '/company/accounts', 'icon' => 'ios-browsers', 'type' => 0, 'open' => 3,
|
||||
'children' => [
|
||||
['name' => 'virtual.company.accounts.create', 'title' => '创建', 'description' => 'create', 'type' => 1],
|
||||
['name' => 'virtual.company.accounts.update', 'title' => '编辑', 'description' => 'update', 'type' => 1],
|
||||
['name' => 'virtual.company.accounts.destroy', 'title' => '删除', 'description' => 'destroy', 'type' => 1],
|
||||
],
|
||||
],
|
||||
[
|
||||
'name' => 'virtual.products.index', 'title' => '定价管理', 'path' => '/logs', 'icon' => 'ios-cube', 'type' => 0, 'open' => 3,
|
||||
'children' => [
|
||||
['name' => 'virtual.products.create', 'title' => '创建', 'description' => 'create', 'type' => 1],
|
||||
['name' => 'virtual.products.update', 'title' => '编辑', 'description' => 'update', 'type' => 1],
|
||||
['name' => 'virtual.products.destroy', 'title' => '删除', 'description' => 'destroy', 'type' => 1],
|
||||
],
|
||||
],
|
||||
],
|
||||
],
|
||||
[
|
||||
'name' => 'virtual_package_ctrl',
|
||||
'title' => '套餐设置',
|
||||
'path' => '#',
|
||||
'icon' => 'ios-settings',
|
||||
'type' => 0,
|
||||
'open' => 3,
|
||||
'children' => [
|
||||
[
|
||||
'name' => 'virtual.packages.index', 'title' => '基础套餐', 'path' => '/packages?type=0', 'icon' => 'ios-cube', 'type' => 0, 'open' => 3,
|
||||
'children' => [
|
||||
['name' => 'virtual.packages.create', 'title' => '创建', 'description' => 'create', 'type' => 1],
|
||||
['name' => 'virtual.packages.update', 'title' => '编辑', 'description' => 'update', 'type' => 1],
|
||||
['name' => 'virtual.packages.destroy', 'title' => '删除', 'description' => 'destroy', 'type' => 1],
|
||||
],
|
||||
],
|
||||
],
|
||||
],
|
||||
[
|
||||
'name' => 'virtual_order_ctrl',
|
||||
'title' => '订单管理',
|
||||
'path' => '#',
|
||||
'icon' => 'ios-settings',
|
||||
'type' => 0,
|
||||
'open' => 3,
|
||||
'children' => [
|
||||
[
|
||||
'name' => 'virtual.orders.index', 'title' => '销售订单', 'path' => '/orders?type=0', 'icon' => 'ios-cube', 'type' => 0, 'open' => 3,
|
||||
'children' => [
|
||||
['name' => 'virtual.orders.show', 'title' => '查看', 'description' => 'show', 'type' => 1],
|
||||
['name' => 'virtual.orders.create', 'title' => '创建', 'description' => 'create', 'type' => 1],
|
||||
['name' => 'virtual.orders.update', 'title' => '编辑', 'description' => 'update', 'type' => 1],
|
||||
['name' => 'virtual.orders.destroy', 'title' => '删除', 'description' => 'destroy', 'type' => 1],
|
||||
],
|
||||
],
|
||||
],
|
||||
],
|
||||
];
|
||||
|
||||
const ROOT_PERMISSIONS = [
|
||||
'system.*', 'api.permissions.*', 'api.logs.*', 'api.roles.*', 'api.accounts.*'
|
||||
];
|
||||
|
||||
/**
|
||||
@ -85,9 +152,7 @@ class PermissionSeeder extends Seeder
|
||||
|
||||
$permissions = app(PermissionService::class)->getPermissions();
|
||||
|
||||
$rootRole->syncPermissions($permissions->filter(function ($value, $key) {
|
||||
return Str::is(self::ROOT_PERMISSIONS, $value['name']);
|
||||
}));
|
||||
$rootRole->syncPermissions($permissions);
|
||||
|
||||
Account::where('username', 'root')->first()->assignRole($rootRole);
|
||||
}
|
||||
|
@ -3,12 +3,12 @@
|
||||
*/
|
||||
|
||||
/**
|
||||
* [paginate 订单列表]
|
||||
* [index 订单列表]
|
||||
* @param {[type]} data [description]
|
||||
* @return {[type]} [description]
|
||||
*/
|
||||
export function paginate(data) {
|
||||
return service.get('api/virtual/orders/paginate', {
|
||||
export function index(data) {
|
||||
return service.get('api/virtual/orders/index', {
|
||||
params: data
|
||||
});
|
||||
}
|
||||
|
@ -138,7 +138,7 @@
|
||||
<div class="ui-list-title"><span class="title-require">*</span>按钮权限类型:</div>
|
||||
<div class="ui-list-content">
|
||||
<Select v-model="params.description">
|
||||
<Option value="index">查看操作</Option>
|
||||
<Option value="show">查看操作</Option>
|
||||
<Option value="create">添加操作</Option>
|
||||
<Option value="update">编辑操作</Option>
|
||||
<Option value="destroy">删除操作</Option>
|
||||
|
@ -66,7 +66,7 @@ export default{
|
||||
render: (h, { row, column, index }) => {
|
||||
let html = [];
|
||||
|
||||
if (this.haveJurisdiction('index')) {
|
||||
if (this.haveJurisdiction('show')) {
|
||||
html.push(h('Button', {
|
||||
props: {
|
||||
type: 'success',
|
||||
|
@ -34,7 +34,7 @@ export default{
|
||||
render: (h, { row, column, index }) => {
|
||||
let html = [];
|
||||
|
||||
if (this.haveJurisdiction('index')) {
|
||||
if (this.haveJurisdiction('show')) {
|
||||
html.push(h('Button', {
|
||||
props: {
|
||||
type: 'success',
|
||||
|
@ -65,7 +65,7 @@ export default {
|
||||
return h('Tag', { props: { color: 'default' } }, '该企业已被删除');
|
||||
}
|
||||
|
||||
if (this.haveJurisdiction('index')) {
|
||||
if (this.haveJurisdiction('show')) {
|
||||
html.push(h('Button', {
|
||||
props: {
|
||||
type: 'success',
|
||||
|
@ -131,7 +131,7 @@ export default {
|
||||
return h('Tag', { props: { color: 'default' } }, '该企业已被删除');
|
||||
}
|
||||
|
||||
if (this.haveJurisdiction('index')) {
|
||||
if (this.haveJurisdiction('show')) {
|
||||
html.push(h('Button', {
|
||||
props: {
|
||||
type: 'success',
|
||||
|
@ -101,7 +101,7 @@ export default {
|
||||
return h('Tag', { props: { color: 'default' } }, '该套餐已被删除');
|
||||
}
|
||||
|
||||
if (this.haveJurisdiction('index')) {
|
||||
if (this.haveJurisdiction('show')) {
|
||||
html.push(h('Button', {
|
||||
props: {
|
||||
type: 'success',
|
||||
|
2
public/js/app.070bbff0.js
Normal file
2
public/js/app.070bbff0.js
Normal file
File diff suppressed because one or more lines are too long
1
public/js/app.070bbff0.js.map
Normal file
1
public/js/app.070bbff0.js.map
Normal file
File diff suppressed because one or more lines are too long
2
public/js/app.d73cac4f.js
Normal file
2
public/js/app.d73cac4f.js
Normal file
File diff suppressed because one or more lines are too long
1
public/js/app.d73cac4f.js.map
Normal file
1
public/js/app.d73cac4f.js.map
Normal file
File diff suppressed because one or more lines are too long
2
public/js/chunk-6d306fd9.333e8f88.js
Normal file
2
public/js/chunk-6d306fd9.333e8f88.js
Normal file
File diff suppressed because one or more lines are too long
1
public/js/chunk-6d306fd9.333e8f88.js.map
Normal file
1
public/js/chunk-6d306fd9.333e8f88.js.map
Normal file
File diff suppressed because one or more lines are too long
2
public/js/chunk-6d306fd9.6211f3be.js
Normal file
2
public/js/chunk-6d306fd9.6211f3be.js
Normal file
File diff suppressed because one or more lines are too long
1
public/js/chunk-6d306fd9.6211f3be.js.map
Normal file
1
public/js/chunk-6d306fd9.6211f3be.js.map
Normal file
File diff suppressed because one or more lines are too long
@ -1 +1 @@
|
||||
<!DOCTYPE html><html><head><meta charset=utf-8><meta http-equiv=X-UA-Compatible content="IE=edge"><meta name=viewport content="width=device-width,initial-scale=1"><link rel=icon href=\favicon.ico><script src=\config.js></script><title></title><link href=/css/chunk-6d306fd9.729cc3c7.css rel=prefetch><link href=/js/chunk-00ae0766.4cb97496.js rel=prefetch><link href=/js/chunk-6d306fd9.b2817be0.js rel=prefetch><link href=/css/app.36043160.css rel=preload as=style><link href=/css/chunk-vendors.3c3b2e85.css rel=preload as=style><link href=/js/app.0e37939f.js rel=preload as=script><link href=/js/chunk-vendors.02a4e5bc.js rel=preload as=script><link href=/css/chunk-vendors.3c3b2e85.css rel=stylesheet><link href=/css/app.36043160.css rel=stylesheet></head><body><noscript><strong>很抱歉,如果没有启用JavaScript,程序不能正常工作,若要继续使用请启用它。</strong></noscript><div id=app></div><script src=/js/chunk-vendors.02a4e5bc.js></script><script src=/js/app.0e37939f.js></script></body></html>
|
||||
<!DOCTYPE html><html><head><meta charset=utf-8><meta http-equiv=X-UA-Compatible content="IE=edge"><meta name=viewport content="width=device-width,initial-scale=1"><link rel=icon href=\favicon.ico><script src=\config.js></script><title></title><link href=/css/chunk-6d306fd9.729cc3c7.css rel=prefetch><link href=/js/chunk-00ae0766.4cb97496.js rel=prefetch><link href=/js/chunk-6d306fd9.333e8f88.js rel=prefetch><link href=/css/app.36043160.css rel=preload as=style><link href=/css/chunk-vendors.3c3b2e85.css rel=preload as=style><link href=/js/app.070bbff0.js rel=preload as=script><link href=/js/chunk-vendors.02a4e5bc.js rel=preload as=script><link href=/css/chunk-vendors.3c3b2e85.css rel=stylesheet><link href=/css/app.36043160.css rel=stylesheet></head><body><noscript><strong>很抱歉,如果没有启用JavaScript,程序不能正常工作,若要继续使用请启用它。</strong></noscript><div id=app></div><script src=/js/chunk-vendors.02a4e5bc.js></script><script src=/js/app.070bbff0.js></script></body></html>
|
Loading…
x
Reference in New Issue
Block a user