Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
T
tl_estate
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
hujun
tl_estate
Commits
b81ea1f7
Commit
b81ea1f7
authored
Jan 22, 2018
by
zfc
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
添加权限编辑1
parent
eec36560
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
51 additions
and
1 deletion
+51
-1
.gitignore
.gitignore
+2
-0
Auth.php
application/index/controller/Auth.php
+48
-0
access.html
application/index/view/auth/access.html
+0
-0
route.php
application/route.php
+1
-0
auth.js
public/resource/js/auth.js
+0
-1
No files found.
.gitignore
View file @
b81ea1f7
...
@@ -2,3 +2,4 @@
...
@@ -2,3 +2,4 @@
composer.lock
composer.lock
*.log
*.log
/nbproject/private/
\ No newline at end of file
application/index/controller/Auth.php
View file @
b81ea1f7
...
@@ -118,5 +118,52 @@ class Auth extends Basic
...
@@ -118,5 +118,52 @@ class Auth extends Basic
}
}
}
}
/**
* 权限分配
* @param integer $group_id 组ID
* @return [type] [description]
* @date 2018-01-22
* @author zfc
*/
public
function
access_look
(
$group_id
=
0
){
$table
=
New
AuthGroup
();
$data
[
'title'
]
=
'权限分配'
;
echo
$group_id
;
exit
;
if
(
IS_POST
&&
$group_id
=
0
)
{
//添加or修改
$data
[
'id'
]
=
$group_id
;
$menu_auth
=
input
(
'post.menu_auth/a'
,
''
);
//获取所有授权菜单id
$data
[
'rules'
]
=
implode
(
','
,
$menu_auth
);
//拼接
$id
=
isset
(
$data
[
'id'
])
&&
$data
[
'id'
]
>
0
?
$data
[
'id'
]
:
false
;
//开发过程中先关闭这个限制
//if($group_id==1){
//$this->error('不能修改超级管理员'.$title);
// }else{
if
(
$table
->
editData
(
$data
,
$id
))
{
cache
(
'admin_sidebar_menus_'
.
$this
->
currentUser
[
'uid'
],
null
);
return
$this
->
response
(
200
,
'成功'
);
}
else
{
return
$this
->
response
(
100
,
'失败'
);
}
//}
}
else
{
//查看
$role_auth_rule
=
$table
->
where
([
'id'
=>
intval
(
$group_id
)])
->
value
(
'rules'
);
$data
[
'menu_auth_rules'
]
=
explode
(
','
,
$role_auth_rule
);
//获取指定获取到的权限
}
$menu
=
$table
->
where
([
'pid'
=>
0
,
'status'
=>
1
])
->
order
(
'sort asc'
)
->
select
();
foreach
(
$menu
as
$k
=>
$v
){
$menu
[
$k
][
'_child'
]
=
$this
->
authRuleModel
->
where
([
'pid'
=>
$v
[
'id'
]])
->
order
(
'sort asc'
)
->
select
();
}
$data
[
'all_auth_rules'
]
=
$menu
;
//所以规则
return
$this
->
response
(
200
,
'可以查看'
,
$data
);
}
}
}
\ No newline at end of file
application/index/view/auth/access.html
View file @
b81ea1f7
This diff is collapsed.
Click to expand it.
application/route.php
View file @
b81ea1f7
...
@@ -76,6 +76,7 @@ Route::group('index', [
...
@@ -76,6 +76,7 @@ Route::group('index', [
'getAuth'
=>
[
'index/auth/getAuth'
,
[
'method'
=>
'get'
]],
//权限列表
'getAuth'
=>
[
'index/auth/getAuth'
,
[
'method'
=>
'get'
]],
//权限列表
'access'
=>
[
'index/auth/access'
,
[
'method'
=>
'get'
]],
//权限分配
'access'
=>
[
'index/auth/access'
,
[
'method'
=>
'get'
]],
//权限分配
'addAuth'
=>
[
'index/auth/addAuth'
,
[
'method'
=>
'post'
]],
//添加角色
'addAuth'
=>
[
'index/auth/addAuth'
,
[
'method'
=>
'post'
]],
//添加角色
'access_look'
=>
[
'index/auth/access_look'
,
[
'method'
=>
'post'
]],
//查看编辑角色权限
'roleedit'
=>
[
'index/auth/roleedit'
,
[
'method'
=>
'get'
]],
//编辑角色
'roleedit'
=>
[
'index/auth/roleedit'
,
[
'method'
=>
'get'
]],
//编辑角色
'accessUser'
=>
[
'index/auth/accessUser'
,
[
'method'
=>
'get'
]],
//成员授权
'accessUser'
=>
[
'index/auth/accessUser'
,
[
'method'
=>
'get'
]],
//成员授权
'BusinessDistrict'
=>
[
'index/BusinessDistrict/index'
,
[
'method'
=>
'get'
]],
//商圈列表
'BusinessDistrict'
=>
[
'index/BusinessDistrict/index'
,
[
'method'
=>
'get'
]],
//商圈列表
...
...
public/resource/js/auth.js
View file @
b81ea1f7
...
@@ -27,7 +27,6 @@ define (['doT', 'text!temp/auth_template_tpl.html', 'css!style/home.css','pagina
...
@@ -27,7 +27,6 @@ define (['doT', 'text!temp/auth_template_tpl.html', 'css!style/home.css','pagina
var
temp
=
document
.
getElementById
(
'auth_list_tpl'
).
innerHTML
;
var
temp
=
document
.
getElementById
(
'auth_list_tpl'
).
innerHTML
;
var
doTtmpl
=
doT
.
template
(
temp
);
var
doTtmpl
=
doT
.
template
(
temp
);
$
(
"#auth_list"
).
html
(
doTtmpl
(
data
.
data
.
list
));
$
(
"#auth_list"
).
html
(
doTtmpl
(
data
.
data
.
list
));
/*分页代码*/
/*分页代码*/
$
(
"#pagediv"
).
pagination
({
$
(
"#pagediv"
).
pagination
({
length
:
data
.
data
.
total
,
length
:
data
.
data
.
total
,
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment