Showing
10 changed files
with
372 additions
and
32 deletions
@@ -27,8 +27,8 @@ return [ | @@ -27,8 +27,8 @@ return [ | ||
27 | 'admin'=>array( | 27 | 'admin'=>array( |
28 | '后台管理',array( | 28 | '后台管理',array( |
29 | 'admin/list'=>array('用户','admin/list'), | 29 | 'admin/list'=>array('用户','admin/list'), |
30 | - 'admin/permission'=>array('菜单权限','admin/permission'), | ||
31 | 'admin/role'=>array('用户组','admin/role'), | 30 | 'admin/role'=>array('用户组','admin/role'), |
31 | + 'admin/permission'=>array('权限','admin/permission'), | ||
32 | ) | 32 | ) |
33 | ), | 33 | ), |
34 | ), | 34 | ), |
@@ -25,10 +25,11 @@ class AdminController extends BaseController | @@ -25,10 +25,11 @@ class AdminController extends BaseController | ||
25 | public function actionList() | 25 | public function actionList() |
26 | { | 26 | { |
27 | if (Yii::$app->request->isPost){ | 27 | if (Yii::$app->request->isPost){ |
28 | + $posts = Yii::$app->request->post(); | ||
28 | $model = new Admin; | 29 | $model = new Admin; |
29 | - $model->username = Yii::$app->request->post('username'); | ||
30 | - $model->email = Yii::$app->request->post('email'); | ||
31 | - $model->setPassword(Yii::$app->request->post('password')); | 30 | + $model->username = $posts['username']; |
31 | + $model->email = $posts['email']; | ||
32 | + $model->setPassword($posts['password']); | ||
32 | $model->generateAuthKey(); | 33 | $model->generateAuthKey(); |
33 | $model->generatePasswordResetToken(); | 34 | $model->generatePasswordResetToken(); |
34 | 35 | ||
@@ -98,7 +99,7 @@ class AdminController extends BaseController | @@ -98,7 +99,7 @@ class AdminController extends BaseController | ||
98 | 99 | ||
99 | $list = $this->authManager->getPermissions(); | 100 | $list = $this->authManager->getPermissions(); |
100 | 101 | ||
101 | - return $this->render('permissions',[ | 102 | + return $this->render('permission',[ |
102 | 'list'=>$list, | 103 | 'list'=>$list, |
103 | ]); | 104 | ]); |
104 | } | 105 | } |
@@ -119,10 +120,12 @@ class AdminController extends BaseController | @@ -119,10 +120,12 @@ class AdminController extends BaseController | ||
119 | $authManager = $this->authManager; | 120 | $authManager = $this->authManager; |
120 | switch (true){ | 121 | switch (true){ |
121 | case $target == 'user' && $type == 'disable': | 122 | case $target == 'user' && $type == 'disable': |
122 | - $r = true; | 123 | + $model = Admin::findOne(Yii::$app->getRequest()->getQueryParam('id')); |
124 | + $r = $model->load(['status'=>Admin::STATUS_DELETED],'') && $model->save(); | ||
123 | break; | 125 | break; |
124 | case $target == 'user' && $type == 'enable': | 126 | case $target == 'user' && $type == 'enable': |
125 | - $r = true; | 127 | + $model = Admin::findOne(Yii::$app->getRequest()->getQueryParam('id')); |
128 | + $r = $model->load(['status'=>Admin::STATUS_ACTIVE],'') && $model->save(); | ||
126 | break; | 129 | break; |
127 | case $target == 'user' && $type == 'del': | 130 | case $target == 'user' && $type == 'del': |
128 | $r = Admin::findOne(Yii::$app->getRequest()->getQueryParam('id'))->delete(); | 131 | $r = Admin::findOne(Yii::$app->getRequest()->getQueryParam('id'))->delete(); |
@@ -146,10 +149,48 @@ class AdminController extends BaseController | @@ -146,10 +149,48 @@ class AdminController extends BaseController | ||
146 | } | 149 | } |
147 | 150 | ||
148 | /** | 151 | /** |
152 | + * 用户组配置 | ||
153 | + * @return type | ||
154 | + */ | ||
155 | + public function actionAssignrole() | ||
156 | + { | ||
157 | + if (!$user_id = Yii::$app->getRequest()->getQueryParam('id')){ | ||
158 | + return $this->redirect($this->_refer); | ||
159 | + } | ||
160 | + if (!$user = Admin::findOne($user_id)){ | ||
161 | + return $this->redirect($this->_refer); | ||
162 | + } | ||
163 | + | ||
164 | + $auth = $this->authManager; | ||
165 | + $allRoles = $auth->getRoles(); | ||
166 | + | ||
167 | + if (Yii::$app->request->isPost){ | ||
168 | + $roles = Yii::$app->request->post('roles',[]); | ||
169 | + $auth->revokeAll($user_id); | ||
170 | + foreach ($roles as $roleName){ | ||
171 | + if (empty($allRoles[$roleName])){ | ||
172 | + continue; | ||
173 | + } | ||
174 | + $role = $allRoles[$roleName]; | ||
175 | + $auth->assign($role,$user_id); | ||
176 | + } | ||
177 | + } | ||
178 | + | ||
179 | + $userRoles = $auth->getRolesByUser($user->getId()); | ||
180 | + //var_dump($allRoles,$userRoles); | ||
181 | + | ||
182 | + return $this->render('assignrole',[ | ||
183 | + 'user'=>$user, | ||
184 | + 'allRoles'=>$allRoles, | ||
185 | + 'userRoles'=>$userRoles, | ||
186 | + ]); | ||
187 | + } | ||
188 | + | ||
189 | + /** | ||
149 | * 权限配置 | 190 | * 权限配置 |
150 | * @return type | 191 | * @return type |
151 | */ | 192 | */ |
152 | - public function actionAssignment() | 193 | + public function actionAssignpermission() |
153 | { | 194 | { |
154 | if (!$name = Yii::$app->getRequest()->get('name')){ | 195 | if (!$name = Yii::$app->getRequest()->get('name')){ |
155 | return $this->redirect($this->_refer); | 196 | return $this->redirect($this->_refer); |
@@ -158,14 +199,11 @@ class AdminController extends BaseController | @@ -158,14 +199,11 @@ class AdminController extends BaseController | ||
158 | $auth = $this->authManager; | 199 | $auth = $this->authManager; |
159 | $role = $auth->getRole($name); | 200 | $role = $auth->getRole($name); |
160 | $allPermissions = $auth->getPermissions(); | 201 | $allPermissions = $auth->getPermissions(); |
161 | - $rolePermissions = $auth->getPermissionsByRole($name); | ||
162 | 202 | ||
163 | if (Yii::$app->request->isPost){ | 203 | if (Yii::$app->request->isPost){ |
164 | - $permissions = Yii::$app->request->post('permissions'); | 204 | + $permissions = Yii::$app->request->post('permissions',[]); |
205 | + $auth->removeChildren($role); | ||
165 | foreach ($permissions as $permissionName){ | 206 | foreach ($permissions as $permissionName){ |
166 | - if (!empty($rolePermissions[$permissionName])){ | ||
167 | - continue; | ||
168 | - } | ||
169 | if (empty($allPermissions[$permissionName])){ | 207 | if (empty($allPermissions[$permissionName])){ |
170 | continue; | 208 | continue; |
171 | } | 209 | } |
@@ -177,10 +215,120 @@ class AdminController extends BaseController | @@ -177,10 +215,120 @@ class AdminController extends BaseController | ||
177 | $rolePermissions = $auth->getPermissionsByRole($name); | 215 | $rolePermissions = $auth->getPermissionsByRole($name); |
178 | //var_dump($allPermissions,$rolePermissions); | 216 | //var_dump($allPermissions,$rolePermissions); |
179 | 217 | ||
180 | - return $this->render('assignment',[ | 218 | + return $this->render('assignpermission',[ |
181 | 'role'=>$role, | 219 | 'role'=>$role, |
182 | 'allPermissions'=>$allPermissions, | 220 | 'allPermissions'=>$allPermissions, |
183 | 'rolePermissions'=>$rolePermissions, | 221 | 'rolePermissions'=>$rolePermissions, |
184 | ]); | 222 | ]); |
185 | } | 223 | } |
224 | + | ||
225 | + /** | ||
226 | + * 编辑用户 | ||
227 | + * @return type | ||
228 | + */ | ||
229 | + public function actionAdminedit() | ||
230 | + { | ||
231 | + if (!$id = Yii::$app->getRequest()->getQueryParam('id')){ | ||
232 | + return $this->redirect($this->_refer); | ||
233 | + } | ||
234 | + | ||
235 | + $model = Admin::findOne($id); | ||
236 | + if (!$model){ | ||
237 | + Yii::$app->session->setFlash('error', '找不到该用户'); | ||
238 | + return $this->redirect($this->_refer); | ||
239 | + } | ||
240 | + | ||
241 | + if(Yii::$app->request->isPost){ | ||
242 | + $posts = Yii::$app->request->post(); | ||
243 | + $model->username = $posts['username']; | ||
244 | + $model->email = $posts['email']; | ||
245 | + if (!empty($posts['password'])){ | ||
246 | + $model->setPassword($posts['password']); | ||
247 | + $model->generateAuthKey(); | ||
248 | + $model->generatePasswordResetToken(); | ||
249 | + } | ||
250 | + | ||
251 | + if($model->save()){ | ||
252 | + if (!empty($posts['password'])){ | ||
253 | + Yii::$app->session->setFlash('success', '密码修改成功。'); | ||
254 | + } | ||
255 | + Yii::$app->session->setFlash('success', '编辑成功。'); | ||
256 | + }else{ | ||
257 | + Yii::$app->session->setFlash('warning', current($model->getFirstErrors())); | ||
258 | + } | ||
259 | + return $this->refresh(); | ||
260 | + } | ||
261 | + | ||
262 | + return $this->render('adminedit',[ | ||
263 | + 'model'=>$model, | ||
264 | + ]); | ||
265 | + } | ||
266 | + | ||
267 | + /** | ||
268 | + * 编辑用户组 | ||
269 | + * @return type | ||
270 | + */ | ||
271 | + public function actionRoleedit() | ||
272 | + { | ||
273 | + if (!$name = Yii::$app->getRequest()->get('name')){ | ||
274 | + return $this->redirect($this->_refer); | ||
275 | + } | ||
276 | + | ||
277 | + $model = $this->authManager->getRole($name); | ||
278 | + if (!$model){ | ||
279 | + Yii::$app->session->setFlash('error', '找不到该用户组'); | ||
280 | + return $this->redirect($this->_refer); | ||
281 | + } | ||
282 | + | ||
283 | + if(Yii::$app->request->isPost){ | ||
284 | + $posts = Yii::$app->request->post(); | ||
285 | + $model->name = $posts['name']; | ||
286 | + $model->description = $posts['description']; | ||
287 | + | ||
288 | + if($this->authManager->update($name,$model)){ | ||
289 | + Yii::$app->session->setFlash('success', '编辑成功。'); | ||
290 | + }else{ | ||
291 | + Yii::$app->session->setFlash('warning', current($model->getFirstErrors())); | ||
292 | + } | ||
293 | + return $this->refresh(); | ||
294 | + } | ||
295 | + | ||
296 | + return $this->render('roleedit',[ | ||
297 | + 'model'=>$model, | ||
298 | + ]); | ||
299 | + } | ||
300 | + | ||
301 | + /** | ||
302 | + * 编辑菜单权限 | ||
303 | + * @return type | ||
304 | + */ | ||
305 | + public function actionPermissionedit() | ||
306 | + { | ||
307 | + if (!$name = Yii::$app->getRequest()->get('name')){ | ||
308 | + return $this->redirect($this->_refer); | ||
309 | + } | ||
310 | + | ||
311 | + $model = $this->authManager->getPermission($name); | ||
312 | + if (!$model){ | ||
313 | + Yii::$app->session->setFlash('error', '找不到该用户组'); | ||
314 | + return $this->redirect($this->_refer); | ||
315 | + } | ||
316 | + | ||
317 | + if(Yii::$app->request->isPost){ | ||
318 | + $posts = Yii::$app->request->post(); | ||
319 | + $model->name = $posts['name']; | ||
320 | + $model->description = $posts['description']; | ||
321 | + | ||
322 | + if($this->authManager->update($name,$model)){ | ||
323 | + Yii::$app->session->setFlash('success', '编辑成功。'); | ||
324 | + }else{ | ||
325 | + Yii::$app->session->setFlash('warning', current($model->getFirstErrors())); | ||
326 | + } | ||
327 | + return $this->refresh(); | ||
328 | + } | ||
329 | + | ||
330 | + return $this->render('permissionedit',[ | ||
331 | + 'model'=>$model, | ||
332 | + ]); | ||
333 | + } | ||
186 | } | 334 | } |
backend/views/admin/adminedit.php
0 → 100644
1 | +<?php | ||
2 | +use yii\web\View; | ||
3 | +use yii\helpers\Html; | ||
4 | +use backend\widgets\YHGImage\Common\Images as CommonImages; | ||
5 | + | ||
6 | +$this->title = $this->params['main_title'].'-'.$this->params['sub_title']; | ||
7 | +?> | ||
8 | +<?php | ||
9 | +$this->registerCssFile('/css/select2.css',array('postion'=>View::POS_END)); | ||
10 | + | ||
11 | +$this->registerJsFile('/js/select2.min.js',array('postion'=>View::POS_END)); | ||
12 | +?> | ||
13 | +<script type="text/javascript"> | ||
14 | +<?php $this->beginBlock('javascript');?> | ||
15 | +jQuery(document).ready(function() { | ||
16 | + // Select2 | ||
17 | + jQuery(".select-basic").select2(); | ||
18 | + | ||
19 | +}); | ||
20 | +<?php | ||
21 | +$this->endBlock(); | ||
22 | +$this->registerJs($this->blocks['javascript'],View::POS_END) | ||
23 | +?> | ||
24 | +</script> | ||
25 | + | ||
26 | +<div class="col-md-6"> | ||
27 | + <form id="form" method="POST" action=""> | ||
28 | + <div class="panel panel-default"> | ||
29 | + | ||
30 | + <div class="panel-body"> | ||
31 | + <div class="row"> | ||
32 | + | ||
33 | + <div class="form-group"> | ||
34 | + <label class="col-sm-3 control-label">用户名: <span class="asterisk">*</span></label> | ||
35 | + <div class="col-sm-5"> | ||
36 | + <input type="text" name="username" class="form-control" required="required" value="<?=$model->username?>"> | ||
37 | + </div> | ||
38 | + </div> | ||
39 | + | ||
40 | + <div class="form-group"> | ||
41 | + <label class="col-sm-3 control-label">邮箱: </label> | ||
42 | + <div class="col-sm-5"> | ||
43 | + <input type="text" name="email" class="form-control" required="required" value="<?=$model->email?>"> | ||
44 | + </div> | ||
45 | + </div> | ||
46 | + | ||
47 | + <div class="form-group"> | ||
48 | + <label class="col-sm-3 control-label">修改密码: <span class="asterisk">*</span></label> | ||
49 | + <div class="col-sm-5"> | ||
50 | + <input type="password" name="password" class="form-control"> | ||
51 | + </div> | ||
52 | + </div> | ||
53 | + | ||
54 | + </div><!-- row --> | ||
55 | + </div><!-- panel-body --> | ||
56 | + <div class="panel-footer"> | ||
57 | + <div class="row"> | ||
58 | + <div class="col-sm-9 col-sm-offset-3"> | ||
59 | + <button class="btn btn-primary mr5" id="upload_button">保存</button> | ||
60 | + <a href="<?=$_refer?>" class="btn btn-dark">取消</a> | ||
61 | + </div> | ||
62 | + </div> | ||
63 | + </div><!-- panel-footer --> | ||
64 | + </div><!-- panel --> | ||
65 | + </form> | ||
66 | + | ||
67 | +</div> |
backend/views/admin/assignrole.php
0 → 100644
1 | +<?php | ||
2 | + | ||
3 | +use yii\web\View; | ||
4 | +use yii\helpers\Html; | ||
5 | +use yii\helpers\ArrayHelper; | ||
6 | + | ||
7 | +$this->title = $this->params['main_title'] . '-' . $this->params['sub_title']; | ||
8 | +?> | ||
9 | + | ||
10 | +<div class="col-md-12"> | ||
11 | + <form class="form-bordered" method="POST" action=""> | ||
12 | + <div class="panel panel-default"> | ||
13 | + | ||
14 | + <div class="panel-heading"> | ||
15 | + <h5 class="panel-title"><?=$user->username?></h5> | ||
16 | + <p><?=$user->email?></p> | ||
17 | + </div><!-- panel-heading --> | ||
18 | + | ||
19 | + <div class="panel-body"> | ||
20 | + <ul class="row icon-list"> | ||
21 | + | ||
22 | + <?php foreach ($allRoles as $roleName=>$role):?> | ||
23 | + <li class="col-xs-6 col-sm-4 col-md-3"> | ||
24 | + <div class="ckbox ckbox-default"> | ||
25 | + <?php echo Html::checkbox('roles[]', array_key_exists($roleName, $userRoles), ['id'=>$roleName,'value'=>$roleName])?> | ||
26 | + <label for="<?=$roleName?>"><?=$role->description?></label> | ||
27 | + </div> | ||
28 | + </li> | ||
29 | + <?php endforeach;?> | ||
30 | + | ||
31 | + </ul> | ||
32 | + </div> | ||
33 | + | ||
34 | + <div class="panel-footer"> | ||
35 | + <div class="row"> | ||
36 | + <div class="col-sm-9 col-sm-offset-3"> | ||
37 | + <button class="btn btn-primary mr5" id="upload_button">保存</button> | ||
38 | + <a href="<?=$_refer?>" class="btn btn-dark">取消</a> | ||
39 | + </div> | ||
40 | + </div> | ||
41 | + </div><!-- panel-footer --> | ||
42 | + | ||
43 | + </div><!-- panel --> | ||
44 | + </form> | ||
45 | +</div> |
@@ -31,17 +31,12 @@ $this->registerJs($this->blocks['javascript'],View::POS_END) | @@ -31,17 +31,12 @@ $this->registerJs($this->blocks['javascript'],View::POS_END) | ||
31 | <div class="col-sm-4"> | 31 | <div class="col-sm-4"> |
32 | <input type="text" name="username" class="form-control" required="required" placeholder="用户名"> | 32 | <input type="text" name="username" class="form-control" required="required" placeholder="用户名"> |
33 | </div> | 33 | </div> |
34 | - <div class="col-sm-5"> | 34 | + <div class="col-sm-4"> |
35 | <input type="text" name="email" class="form-control" required="required" placeholder="邮箱"> | 35 | <input type="text" name="email" class="form-control" required="required" placeholder="邮箱"> |
36 | </div> | 36 | </div> |
37 | - </div> | ||
38 | - <div class="form-group"> | ||
39 | <div class="col-sm-4"> | 37 | <div class="col-sm-4"> |
40 | <input type="password" name="password" class="form-control" required="required" placeholder="密码"> | 38 | <input type="password" name="password" class="form-control" required="required" placeholder="密码"> |
41 | </div> | 39 | </div> |
42 | - <div class="col-sm-5"> | ||
43 | - <?php echo Html::dropDownList('role', null,$roles, ['class' => 'width300 select-basic']);?> | ||
44 | - </div> | ||
45 | </div> | 40 | </div> |
46 | <div class="form-group"> | 41 | <div class="form-group"> |
47 | <div class="col-sm-3"> | 42 | <div class="col-sm-3"> |
@@ -63,7 +58,6 @@ $this->registerJs($this->blocks['javascript'],View::POS_END) | @@ -63,7 +58,6 @@ $this->registerJs($this->blocks['javascript'],View::POS_END) | ||
63 | <th><input type="checkbox" onclick="checkall(this)">选择</th> | 58 | <th><input type="checkbox" onclick="checkall(this)">选择</th> |
64 | <th>用户名</th> | 59 | <th>用户名</th> |
65 | <th>邮箱</th> | 60 | <th>邮箱</th> |
66 | - <th>权限</th> | ||
67 | <th>状态</th> | 61 | <th>状态</th> |
68 | <th>加入时间</th> | 62 | <th>加入时间</th> |
69 | <th>操作</th> | 63 | <th>操作</th> |
@@ -75,22 +69,22 @@ $this->registerJs($this->blocks['javascript'],View::POS_END) | @@ -75,22 +69,22 @@ $this->registerJs($this->blocks['javascript'],View::POS_END) | ||
75 | <td><input type="checkbox" value="<?=$model->id?>" name="room[]"></td> | 69 | <td><input type="checkbox" value="<?=$model->id?>" name="room[]"></td> |
76 | <td><?=$model->username?></td> | 70 | <td><?=$model->username?></td> |
77 | <td><?=$model->email?></td> | 71 | <td><?=$model->email?></td> |
78 | - <td><?=$model->role?></td> | ||
79 | - <td><?=$model->status?></td> | 72 | + <td><?=$model->status ? '启用' : '禁用'?></td> |
80 | <td style="white-space:nowrap"><?=date('Y-m-d H:i:s',$model->create_time)?></td> | 73 | <td style="white-space:nowrap"><?=date('Y-m-d H:i:s',$model->create_time)?></td> |
81 | <td> | 74 | <td> |
82 | 75 | ||
83 | <?php if (!in_array($model->username,['admin','super_admin'])):?> | 76 | <?php if (!in_array($model->username,['admin','super_admin'])):?> |
84 | 77 | ||
85 | - <a href="/live/roomedit/<?=$model->id?>" class="btn btn-default btn-white">编辑</a> | 78 | + <a href="/admin/adminedit/<?=$model->id?>" class="btn btn-default btn-white">编辑</a> |
79 | + <a href="/admin/assignrole/<?=$model->id?>" class="btn btn-default btn-white">用户组配置</a> | ||
86 | 80 | ||
87 | - <?php if ($model->status == 0)://未开始?> | ||
88 | - <a onclick="return confirm('启用用户?')" href="/admin/operate/<?=$model->id?>?type=enable" class="btn btn-success btn-metro">启用</a> | 81 | + <?php if ($model->status == 0)://禁用状态?> |
82 | + <a onclick="return confirm('启用用户?')" href="/admin/operate/<?=$model->id?>?target=user&type=enable" class="btn btn-success btn-metro">启用</a> | ||
89 | <?php else:?> | 83 | <?php else:?> |
90 | - <a onclick="return confirm('禁用用户?')" href="/admin/operate/<?=$model->id?>?type=disable" class="btn btn-danger btn-metro">禁用</a> | 84 | + <a onclick="return confirm('禁用用户?')" href="/admin/operate/<?=$model->id?>?target=user&type=disable" class="btn btn-danger btn-metro">禁用</a> |
91 | <?php endif;?> | 85 | <?php endif;?> |
92 | 86 | ||
93 | - <a onclick="return confirm('删除用户?')" href="/admin/operate/<?=$model->id?>?type=del" class="btn btn-danger btn-metro">删除</a> | 87 | + <a onclick="return confirm('删除用户?')" href="/admin/operate/<?=$model->id?>?target=user&type=del" class="btn btn-danger btn-metro">删除</a> |
94 | 88 | ||
95 | <?php endif;?> | 89 | <?php endif;?> |
96 | </td> | 90 | </td> |
@@ -36,7 +36,7 @@ $this->title = $this->params['main_title'].'-'.$this->params['sub_title']; | @@ -36,7 +36,7 @@ $this->title = $this->params['main_title'].'-'.$this->params['sub_title']; | ||
36 | <thead> | 36 | <thead> |
37 | <tr style="white-space:nowrap"> | 37 | <tr style="white-space:nowrap"> |
38 | <th><input type="checkbox" onclick="checkall(this)">选择</th> | 38 | <th><input type="checkbox" onclick="checkall(this)">选择</th> |
39 | - <th>权限</th> | 39 | + <th>权限标签</th> |
40 | <th>描述</th> | 40 | <th>描述</th> |
41 | <th>添加时间</th> | 41 | <th>添加时间</th> |
42 | <th>操作</th> | 42 | <th>操作</th> |
@@ -51,7 +51,7 @@ $this->title = $this->params['main_title'].'-'.$this->params['sub_title']; | @@ -51,7 +51,7 @@ $this->title = $this->params['main_title'].'-'.$this->params['sub_title']; | ||
51 | <td style="white-space:nowrap"><?=date('Y-m-d H:i:s',$model->createdAt)?></td> | 51 | <td style="white-space:nowrap"><?=date('Y-m-d H:i:s',$model->createdAt)?></td> |
52 | <td> | 52 | <td> |
53 | <?php if ($model->name != 'index/index'):?> | 53 | <?php if ($model->name != 'index/index'):?> |
54 | - <a href="/admin/roledit/?name=<?=$model->name?>" class="btn btn-default btn-white">编辑</a> | 54 | + <a href="/admin/permissionedit/?name=<?=$model->name?>" class="btn btn-default btn-white">编辑</a> |
55 | <a onclick="return confirm('删除用户组?')" href="/admin/operate/?target=permission&type=del&name=<?=$model->name?>" class="btn btn-danger btn-metro">删除</a> | 55 | <a onclick="return confirm('删除用户组?')" href="/admin/operate/?target=permission&type=del&name=<?=$model->name?>" class="btn btn-danger btn-metro">删除</a> |
56 | <?php endif;?> | 56 | <?php endif;?> |
57 | </td> | 57 | </td> |
backend/views/admin/permissionedit.php
0 → 100644
1 | +<?php | ||
2 | +use yii\web\View; | ||
3 | +use yii\helpers\Html; | ||
4 | +use backend\widgets\YHGImage\Common\Images as CommonImages; | ||
5 | + | ||
6 | +$this->title = $this->params['main_title'].'-'.$this->params['sub_title']; | ||
7 | +?> | ||
8 | + | ||
9 | +<div class="col-md-6"> | ||
10 | + <form id="form" method="POST" action=""> | ||
11 | + <div class="panel panel-default"> | ||
12 | + | ||
13 | + <div class="panel-body"> | ||
14 | + <div class="row"> | ||
15 | + | ||
16 | + <div class="form-group"> | ||
17 | + <label class="col-sm-3 control-label">权限标签: <span class="asterisk">*</span></label> | ||
18 | + <div class="col-sm-5"> | ||
19 | + <input type="text" name="name" class="form-control" required="required" value="<?=$model->name?>"> | ||
20 | + </div> | ||
21 | + </div> | ||
22 | + | ||
23 | + <div class="form-group"> | ||
24 | + <label class="col-sm-3 control-label">描述: </label> | ||
25 | + <div class="col-sm-5"> | ||
26 | + <input type="text" name="description" class="form-control" required="required" value="<?=$model->description?>"> | ||
27 | + </div> | ||
28 | + </div> | ||
29 | + | ||
30 | + </div><!-- row --> | ||
31 | + </div><!-- panel-body --> | ||
32 | + <div class="panel-footer"> | ||
33 | + <div class="row"> | ||
34 | + <div class="col-sm-9 col-sm-offset-3"> | ||
35 | + <button class="btn btn-primary mr5" id="upload_button">保存</button> | ||
36 | + <a href="<?=$_refer?>" class="btn btn-dark">取消</a> | ||
37 | + </div> | ||
38 | + </div> | ||
39 | + </div><!-- panel-footer --> | ||
40 | + </div><!-- panel --> | ||
41 | + </form> | ||
42 | + | ||
43 | +</div> |
@@ -51,8 +51,8 @@ $this->title = $this->params['main_title'].'-'.$this->params['sub_title']; | @@ -51,8 +51,8 @@ $this->title = $this->params['main_title'].'-'.$this->params['sub_title']; | ||
51 | <td style="white-space:nowrap"><?=date('Y-m-d H:i:s',$model->createdAt)?></td> | 51 | <td style="white-space:nowrap"><?=date('Y-m-d H:i:s',$model->createdAt)?></td> |
52 | <td> | 52 | <td> |
53 | <?php if ($model->name != 'admin'):?> | 53 | <?php if ($model->name != 'admin'):?> |
54 | - <a href="/admin/roledit/?name=<?=$model->name?>" class="btn btn-default btn-white">编辑</a> | ||
55 | - <a href="/admin/assignment/?name=<?=$model->name?>" class="btn btn-default btn-white">权限配置</a> | 54 | + <a href="/admin/roleedit/?name=<?=$model->name?>" class="btn btn-default btn-white">编辑</a> |
55 | + <a href="/admin/assignpermission/?name=<?=$model->name?>" class="btn btn-default btn-white">权限配置</a> | ||
56 | <a onclick="return confirm('删除用户组?')" href="/admin/operate/?target=role&type=del&name=<?=$model->name?>" class="btn btn-danger btn-metro">删除</a> | 56 | <a onclick="return confirm('删除用户组?')" href="/admin/operate/?target=role&type=del&name=<?=$model->name?>" class="btn btn-danger btn-metro">删除</a> |
57 | <?php endif;?> | 57 | <?php endif;?> |
58 | </td> | 58 | </td> |
backend/views/admin/roleedit.php
0 → 100644
1 | +<?php | ||
2 | +use yii\web\View; | ||
3 | +use yii\helpers\Html; | ||
4 | +use backend\widgets\YHGImage\Common\Images as CommonImages; | ||
5 | + | ||
6 | +$this->title = $this->params['main_title'].'-'.$this->params['sub_title']; | ||
7 | +?> | ||
8 | + | ||
9 | +<div class="col-md-6"> | ||
10 | + <form id="form" method="POST" action=""> | ||
11 | + <div class="panel panel-default"> | ||
12 | + | ||
13 | + <div class="panel-body"> | ||
14 | + <div class="row"> | ||
15 | + | ||
16 | + <div class="form-group"> | ||
17 | + <label class="col-sm-3 control-label">用户组: <span class="asterisk">*</span></label> | ||
18 | + <div class="col-sm-5"> | ||
19 | + <input type="text" name="name" class="form-control" required="required" value="<?=$model->name?>"> | ||
20 | + </div> | ||
21 | + </div> | ||
22 | + | ||
23 | + <div class="form-group"> | ||
24 | + <label class="col-sm-3 control-label">描述: </label> | ||
25 | + <div class="col-sm-5"> | ||
26 | + <input type="text" name="description" class="form-control" required="required" value="<?=$model->description?>"> | ||
27 | + </div> | ||
28 | + </div> | ||
29 | + | ||
30 | + </div><!-- row --> | ||
31 | + </div><!-- panel-body --> | ||
32 | + <div class="panel-footer"> | ||
33 | + <div class="row"> | ||
34 | + <div class="col-sm-9 col-sm-offset-3"> | ||
35 | + <button class="btn btn-primary mr5" id="upload_button">保存</button> | ||
36 | + <a href="<?=$_refer?>" class="btn btn-dark">取消</a> | ||
37 | + </div> | ||
38 | + </div> | ||
39 | + </div><!-- panel-footer --> | ||
40 | + </div><!-- panel --> | ||
41 | + </form> | ||
42 | + | ||
43 | +</div> |
-
Please register or login to post a comment