mirror of https://gitee.com/karson/fastadmin.git
parent
9d2e7f1c95
commit
6f56a83422
|
|
@ -218,6 +218,10 @@ class Admin extends Backend
|
||||||
*/
|
*/
|
||||||
public function del($ids = "")
|
public function del($ids = "")
|
||||||
{
|
{
|
||||||
|
if (!$this->request->isPost()) {
|
||||||
|
$this->error(__("Invalid parameters"));
|
||||||
|
}
|
||||||
|
$ids = $ids ? $ids : $this->request->post("ids");
|
||||||
if ($ids) {
|
if ($ids) {
|
||||||
$ids = array_intersect($this->childrenAdminIds, array_filter(explode(',', $ids)));
|
$ids = array_intersect($this->childrenAdminIds, array_filter(explode(',', $ids)));
|
||||||
// 避免越权删除管理员
|
// 避免越权删除管理员
|
||||||
|
|
|
||||||
|
|
@ -8,7 +8,7 @@ use app\common\controller\Backend;
|
||||||
/**
|
/**
|
||||||
* 管理员日志
|
* 管理员日志
|
||||||
*
|
*
|
||||||
* @icon fa fa-users
|
* @icon fa fa-users
|
||||||
* @remark 管理员可以查看自己所拥有的权限的管理员日志
|
* @remark 管理员可以查看自己所拥有的权限的管理员日志
|
||||||
*/
|
*/
|
||||||
class Adminlog extends Backend
|
class Adminlog extends Backend
|
||||||
|
|
@ -30,7 +30,7 @@ class Adminlog extends Backend
|
||||||
$this->childrenGroupIds = $this->auth->getChildrenGroupIds($this->auth->isSuperAdmin() ? true : false);
|
$this->childrenGroupIds = $this->auth->getChildrenGroupIds($this->auth->isSuperAdmin() ? true : false);
|
||||||
|
|
||||||
$groupName = AuthGroup::where('id', 'in', $this->childrenGroupIds)
|
$groupName = AuthGroup::where('id', 'in', $this->childrenGroupIds)
|
||||||
->column('id,name');
|
->column('id,name');
|
||||||
|
|
||||||
$this->view->assign('groupdata', $groupName);
|
$this->view->assign('groupdata', $groupName);
|
||||||
}
|
}
|
||||||
|
|
@ -40,21 +40,20 @@ class Adminlog extends Backend
|
||||||
*/
|
*/
|
||||||
public function index()
|
public function index()
|
||||||
{
|
{
|
||||||
if ($this->request->isAjax())
|
if ($this->request->isAjax()) {
|
||||||
{
|
|
||||||
list($where, $sort, $order, $offset, $limit) = $this->buildparams();
|
list($where, $sort, $order, $offset, $limit) = $this->buildparams();
|
||||||
$total = $this->model
|
$total = $this->model
|
||||||
->where($where)
|
->where($where)
|
||||||
->where('admin_id', 'in', $this->childrenAdminIds)
|
->where('admin_id', 'in', $this->childrenAdminIds)
|
||||||
->order($sort, $order)
|
->order($sort, $order)
|
||||||
->count();
|
->count();
|
||||||
|
|
||||||
$list = $this->model
|
$list = $this->model
|
||||||
->where($where)
|
->where($where)
|
||||||
->where('admin_id', 'in', $this->childrenAdminIds)
|
->where('admin_id', 'in', $this->childrenAdminIds)
|
||||||
->order($sort, $order)
|
->order($sort, $order)
|
||||||
->limit($offset, $limit)
|
->limit($offset, $limit)
|
||||||
->select();
|
->select();
|
||||||
$result = array("total" => $total, "rows" => $list);
|
$result = array("total" => $total, "rows" => $list);
|
||||||
|
|
||||||
return json($result);
|
return json($result);
|
||||||
|
|
@ -68,8 +67,9 @@ class Adminlog extends Backend
|
||||||
public function detail($ids)
|
public function detail($ids)
|
||||||
{
|
{
|
||||||
$row = $this->model->get(['id' => $ids]);
|
$row = $this->model->get(['id' => $ids]);
|
||||||
if (!$row)
|
if (!$row) {
|
||||||
$this->error(__('No Results were found'));
|
$this->error(__('No Results were found'));
|
||||||
|
}
|
||||||
$this->view->assign("row", $row->toArray());
|
$this->view->assign("row", $row->toArray());
|
||||||
return $this->view->fetch();
|
return $this->view->fetch();
|
||||||
}
|
}
|
||||||
|
|
@ -87,7 +87,7 @@ class Adminlog extends Backend
|
||||||
* 编辑
|
* 编辑
|
||||||
* @internal
|
* @internal
|
||||||
*/
|
*/
|
||||||
public function edit($ids = NULL)
|
public function edit($ids = null)
|
||||||
{
|
{
|
||||||
$this->error();
|
$this->error();
|
||||||
}
|
}
|
||||||
|
|
@ -97,21 +97,21 @@ class Adminlog extends Backend
|
||||||
*/
|
*/
|
||||||
public function del($ids = "")
|
public function del($ids = "")
|
||||||
{
|
{
|
||||||
if ($ids)
|
if (!$this->request->isPost()) {
|
||||||
{
|
$this->error(__("Invalid parameters"));
|
||||||
|
}
|
||||||
|
$ids = $ids ? $ids : $this->request->post("ids");
|
||||||
|
if ($ids) {
|
||||||
$childrenGroupIds = $this->childrenGroupIds;
|
$childrenGroupIds = $this->childrenGroupIds;
|
||||||
$adminList = $this->model->where('id', 'in', $ids)->where('admin_id', 'in', function($query) use($childrenGroupIds) {
|
$adminList = $this->model->where('id', 'in', $ids)->where('admin_id', 'in', function ($query) use ($childrenGroupIds) {
|
||||||
$query->name('auth_group_access')->field('uid');
|
$query->name('auth_group_access')->field('uid');
|
||||||
})->select();
|
})->select();
|
||||||
if ($adminList)
|
if ($adminList) {
|
||||||
{
|
|
||||||
$deleteIds = [];
|
$deleteIds = [];
|
||||||
foreach ($adminList as $k => $v)
|
foreach ($adminList as $k => $v) {
|
||||||
{
|
|
||||||
$deleteIds[] = $v->id;
|
$deleteIds[] = $v->id;
|
||||||
}
|
}
|
||||||
if ($deleteIds)
|
if ($deleteIds) {
|
||||||
{
|
|
||||||
$this->model->destroy($deleteIds);
|
$this->model->destroy($deleteIds);
|
||||||
$this->success();
|
$this->success();
|
||||||
}
|
}
|
||||||
|
|
@ -129,10 +129,9 @@ class Adminlog extends Backend
|
||||||
// 管理员禁止批量操作
|
// 管理员禁止批量操作
|
||||||
$this->error();
|
$this->error();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function selectpage()
|
public function selectpage()
|
||||||
{
|
{
|
||||||
return parent::selectpage();
|
return parent::selectpage();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -11,7 +11,7 @@ use think\Exception;
|
||||||
/**
|
/**
|
||||||
* 角色组
|
* 角色组
|
||||||
*
|
*
|
||||||
* @icon fa fa-group
|
* @icon fa fa-group
|
||||||
* @remark 角色组可以有多个,角色有上下级层级关系,如果子角色有角色组和管理员的权限则可以派生属于自己组别下级的角色组或管理员
|
* @remark 角色组可以有多个,角色有上下级层级关系,如果子角色有角色组和管理员的权限则可以派生属于自己组别下级的角色组或管理员
|
||||||
*/
|
*/
|
||||||
class Group extends Backend
|
class Group extends Backend
|
||||||
|
|
@ -140,7 +140,7 @@ class Group extends Backend
|
||||||
$this->error(__('The parent group exceeds permission limit'));
|
$this->error(__('The parent group exceeds permission limit'));
|
||||||
}
|
}
|
||||||
// 父节点不能是它自身的子节点或自己本身
|
// 父节点不能是它自身的子节点或自己本身
|
||||||
if (in_array($params['pid'], Tree::instance()->getChildrenIds($row->id,true))){
|
if (in_array($params['pid'], Tree::instance()->getChildrenIds($row->id, true))) {
|
||||||
$this->error(__('The parent group can not be its own child or itself'));
|
$this->error(__('The parent group can not be its own child or itself'));
|
||||||
}
|
}
|
||||||
$params['rules'] = explode(',', $params['rules']);
|
$params['rules'] = explode(',', $params['rules']);
|
||||||
|
|
@ -163,16 +163,16 @@ class Group extends Backend
|
||||||
Db::startTrans();
|
Db::startTrans();
|
||||||
try {
|
try {
|
||||||
$row->save($params);
|
$row->save($params);
|
||||||
$children_auth_groups = model("AuthGroup")->all(['id'=>['in',implode(',',(Tree::instance()->getChildrenIds($row->id)))]]);
|
$children_auth_groups = model("AuthGroup")->all(['id' => ['in', implode(',', (Tree::instance()->getChildrenIds($row->id)))]]);
|
||||||
$childparams = [];
|
$childparams = [];
|
||||||
foreach ($children_auth_groups as $key=>$children_auth_group) {
|
foreach ($children_auth_groups as $key => $children_auth_group) {
|
||||||
$childparams[$key]['id'] = $children_auth_group->id;
|
$childparams[$key]['id'] = $children_auth_group->id;
|
||||||
$childparams[$key]['rules'] = implode(',', array_intersect(explode(',', $children_auth_group->rules), $rules));
|
$childparams[$key]['rules'] = implode(',', array_intersect(explode(',', $children_auth_group->rules), $rules));
|
||||||
}
|
}
|
||||||
model("AuthGroup")->saveAll($childparams);
|
model("AuthGroup")->saveAll($childparams);
|
||||||
Db::commit();
|
Db::commit();
|
||||||
$this->success();
|
$this->success();
|
||||||
}catch (Exception $e){
|
} catch (Exception $e) {
|
||||||
Db::rollback();
|
Db::rollback();
|
||||||
$this->error($e->getMessage());
|
$this->error($e->getMessage());
|
||||||
}
|
}
|
||||||
|
|
@ -189,6 +189,10 @@ class Group extends Backend
|
||||||
*/
|
*/
|
||||||
public function del($ids = "")
|
public function del($ids = "")
|
||||||
{
|
{
|
||||||
|
if (!$this->request->isPost()) {
|
||||||
|
$this->error(__("Invalid parameters"));
|
||||||
|
}
|
||||||
|
$ids = $ids ? $ids : $this->request->post("ids");
|
||||||
if ($ids) {
|
if ($ids) {
|
||||||
$ids = explode(',', $ids);
|
$ids = explode(',', $ids);
|
||||||
$grouplist = $this->auth->getGroups();
|
$grouplist = $this->auth->getGroups();
|
||||||
|
|
|
||||||
|
|
@ -134,6 +134,10 @@ class Rule extends Backend
|
||||||
*/
|
*/
|
||||||
public function del($ids = "")
|
public function del($ids = "")
|
||||||
{
|
{
|
||||||
|
if (!$this->request->isPost()) {
|
||||||
|
$this->error(__("Invalid parameters"));
|
||||||
|
}
|
||||||
|
$ids = $ids ? $ids : $this->request->post("ids");
|
||||||
if ($ids) {
|
if ($ids) {
|
||||||
$delIds = [];
|
$delIds = [];
|
||||||
foreach (explode(',', $ids) as $k => $v) {
|
foreach (explode(',', $ids) as $k => $v) {
|
||||||
|
|
|
||||||
|
|
@ -103,6 +103,10 @@ class Attachment extends Backend
|
||||||
*/
|
*/
|
||||||
public function del($ids = "")
|
public function del($ids = "")
|
||||||
{
|
{
|
||||||
|
if (!$this->request->isPost()) {
|
||||||
|
$this->error(__("Invalid parameters"));
|
||||||
|
}
|
||||||
|
$ids = $ids ? $ids : $this->request->post("ids");
|
||||||
if ($ids) {
|
if ($ids) {
|
||||||
\think\Hook::add('upload_delete', function ($params) {
|
\think\Hook::add('upload_delete', function ($params) {
|
||||||
if ($params['storage'] == 'local') {
|
if ($params['storage'] == 'local') {
|
||||||
|
|
|
||||||
|
|
@ -87,6 +87,10 @@ class Rule extends Backend
|
||||||
*/
|
*/
|
||||||
public function del($ids = "")
|
public function del($ids = "")
|
||||||
{
|
{
|
||||||
|
if (!$this->request->isPost()) {
|
||||||
|
$this->error(__("Invalid parameters"));
|
||||||
|
}
|
||||||
|
$ids = $ids ? $ids : $this->request->post("ids");
|
||||||
if ($ids) {
|
if ($ids) {
|
||||||
$delIds = [];
|
$delIds = [];
|
||||||
foreach (explode(',', $ids) as $k => $v) {
|
foreach (explode(',', $ids) as $k => $v) {
|
||||||
|
|
|
||||||
|
|
@ -52,6 +52,7 @@ class User extends Backend
|
||||||
->limit($offset, $limit)
|
->limit($offset, $limit)
|
||||||
->select();
|
->select();
|
||||||
foreach ($list as $k => $v) {
|
foreach ($list as $k => $v) {
|
||||||
|
$v->avatar = $v->avatar ? cdnurl($v->avatar, true) : letter_avatar($v->nickname);
|
||||||
$v->hidden(['password', 'salt']);
|
$v->hidden(['password', 'salt']);
|
||||||
}
|
}
|
||||||
$result = array("total" => $total, "rows" => $list);
|
$result = array("total" => $total, "rows" => $list);
|
||||||
|
|
@ -94,6 +95,10 @@ class User extends Backend
|
||||||
*/
|
*/
|
||||||
public function del($ids = "")
|
public function del($ids = "")
|
||||||
{
|
{
|
||||||
|
if (!$this->request->isPost()) {
|
||||||
|
$this->error(__("Invalid parameters"));
|
||||||
|
}
|
||||||
|
$ids = $ids ? $ids : $this->request->post("ids");
|
||||||
$row = $this->model->get($ids);
|
$row = $this->model->get($ids);
|
||||||
$this->modelValidate = true;
|
$this->modelValidate = true;
|
||||||
if (!$row) {
|
if (!$row) {
|
||||||
|
|
|
||||||
|
|
@ -11725,9 +11725,11 @@ define('table',['jquery', 'bootstrap', 'moment', 'moment/locale/zh-cn', 'bootstr
|
||||||
}
|
}
|
||||||
//渲染内容前
|
//渲染内容前
|
||||||
table.on('pre-body.bs.table', function (e, data) {
|
table.on('pre-body.bs.table', function (e, data) {
|
||||||
$.each(data, function (i, row) {
|
if (options.maintainSelected) {
|
||||||
row[options.stateField] = $.inArray(row[options.pk], options.selectedIds) > -1;
|
$.each(data, function (i, row) {
|
||||||
});
|
row[options.stateField] = $.inArray(row[options.pk], options.selectedIds) > -1;
|
||||||
|
});
|
||||||
|
}
|
||||||
});
|
});
|
||||||
//当内容渲染完成后
|
//当内容渲染完成后
|
||||||
table.on('post-body.bs.table', function (e, data) {
|
table.on('post-body.bs.table', function (e, data) {
|
||||||
|
|
|
||||||
|
|
@ -199,9 +199,11 @@ define(['jquery', 'bootstrap', 'moment', 'moment/locale/zh-cn', 'bootstrap-table
|
||||||
}
|
}
|
||||||
//渲染内容前
|
//渲染内容前
|
||||||
table.on('pre-body.bs.table', function (e, data) {
|
table.on('pre-body.bs.table', function (e, data) {
|
||||||
$.each(data, function (i, row) {
|
if (options.maintainSelected) {
|
||||||
row[options.stateField] = $.inArray(row[options.pk], options.selectedIds) > -1;
|
$.each(data, function (i, row) {
|
||||||
});
|
row[options.stateField] = $.inArray(row[options.pk], options.selectedIds) > -1;
|
||||||
|
});
|
||||||
|
}
|
||||||
});
|
});
|
||||||
//当内容渲染完成后
|
//当内容渲染完成后
|
||||||
table.on('post-body.bs.table', function (e, data) {
|
table.on('post-body.bs.table', function (e, data) {
|
||||||
|
|
|
||||||
|
|
@ -74,22 +74,12 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
//Different radius each side
|
//Different radius each side
|
||||||
.border-radius(@top-left;
|
.border-radius(@top-left, @top-right, @bottom-left, @bottom-right)
|
||||||
@top-right
|
|
||||||
;
|
|
||||||
@bottom-left
|
|
||||||
;
|
|
||||||
@bottom-right
|
|
||||||
)
|
|
||||||
{
|
{
|
||||||
border-top-left-radius: @top-left
|
border-top-left-radius: @top-left;
|
||||||
;
|
border-top-right-radius: @top-right;
|
||||||
border-top-right-radius: @top-right
|
border-bottom-right-radius: @bottom-right;
|
||||||
;
|
border-bottom-left-radius: @bottom-left;
|
||||||
border-bottom-right-radius: @bottom-right
|
|
||||||
;
|
|
||||||
border-bottom-left-radius: @bottom-left
|
|
||||||
;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//Gradient background
|
//Gradient background
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue