Skip to content

Commit

Permalink
Merge pull request #542 from go-admin-team/dev
Browse files Browse the repository at this point in the history
Dev
  • Loading branch information
wenjianzhang authored Aug 19, 2021
2 parents 8c5639a + bdaa6e0 commit aa6c3df
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 33 deletions.
6 changes: 3 additions & 3 deletions app/admin/service/dto/sys_user.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@ func (m *SysUserGetPageReq) GetNeedSearch() interface{} {
}

type ResetSysUserPwdReq struct {
UserId int `json:"userId" comment:"用户ID" binding:"required"` // 用户ID
Password string `json:"password" comment:"密码" binding:"required"`
UserId int `json:"userId" comment:"用户ID" vd:"$>0"` // 用户ID
Password string `json:"password" comment:"密码" vd:"len($)>0"`
common.ControlBy
}

Expand Down Expand Up @@ -185,4 +185,4 @@ func (s *SysUserById) GenerateM() (common.ActiveRecord, error) {
type PassWord struct {
NewPassword string `json:"newPassword" vd:"len($)>0"`
OldPassword string `json:"oldPassword" vd:"len($)>0"`
}
}
13 changes: 11 additions & 2 deletions app/admin/service/sys_role.go
Original file line number Diff line number Diff line change
Expand Up @@ -142,12 +142,21 @@ func (e *SysRole) Update(c *dto.SysRoleUpdateReq, cb *casbin.SyncedEnforcer) err
e.Log.Errorf("delete policy error:%s", err)
return err
}

mp:=make(map [string] interface{} ,0)
polices := make([][]string, 0)
for _, menu := range mlist {
for _, api := range menu.SysApi {
_, err = cb.AddNamedPolicy("p", model.RoleKey, api.Path, api.Action)
if mp[model.RoleKey+"-"+api.Path+"-"+api.Action] != "" {
mp[model.RoleKey+"-"+api.Path+"-"+api.Action] = ""
//_, err = cb.AddNamedPolicy("p", model.RoleKey, api.Path, api.Action)
polices = append(polices, []string{model.RoleKey, api.Path, api.Action})
}
}
}
_, err = cb.AddNamedPolicies("p", polices)
if err != nil {
return err
}
_ = cb.SavePolicy()
return nil
}
Expand Down
27 changes: 2 additions & 25 deletions config/db.sql
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ COMMIT;
BEGIN;
INSERT INTO `sys_menu` VALUES (2, 'Admin', '系统管理', 'api-server', '/admin', '/0/2', 'M', '', '', 0, 1, '', 'Layout', 10, '0', '1', 0, 1, '2021-05-20 21:58:45.679', '2021-06-17 11:48:40.703', NULL);
INSERT INTO `sys_menu` VALUES (3, 'SysUserManage', '用户管理', 'user', '/admin/sys-user', '/0/2/3', 'C', '', 'admin:sysUser:list', 2, 0, '', '/admin/sys-user/index', 10, '0', '1', 0, 1, '2021-05-20 22:08:44.526', '2021-06-17 20:31:14.305', NULL);
INSERT INTO `sys_menu` VALUES (43, '', '新增管理员1', 'app-group-fill', '', '/0/2/3/43', 'F', 'POST', 'admin:sysUser:add', 3, 0, '', '', 10, '0', '1', 0, 1, '2021-05-20 22:08:44.526', '2021-06-17 20:31:14.305', NULL);
INSERT INTO `sys_menu` VALUES (43, '', '新增管理员', 'app-group-fill', '', '/0/2/3/43', 'F', 'POST', 'admin:sysUser:add', 3, 0, '', '', 10, '0', '1', 0, 1, '2021-05-20 22:08:44.526', '2021-06-17 20:31:14.305', NULL);
INSERT INTO `sys_menu` VALUES (44, '', '查询管理员', 'app-group-fill', '', '/0/2/3/44', 'F', 'GET', 'admin:sysUser:query', 3, 0, '', '', 40, '0', '1', 0, 1, '2021-05-20 22:08:44.526', '2021-06-17 20:31:14.305', NULL);
INSERT INTO `sys_menu` VALUES (45, '', '修改管理员', 'app-group-fill', '', '/0/2/3/45', 'F', 'PUT', 'admin:sysUser:edit', 3, 0, '', '', 30, '0', '1', 0, 1, '2021-05-20 22:08:44.526', '2021-06-17 20:31:14.305', NULL);
INSERT INTO `sys_menu` VALUES (46, '', '删除管理员', 'app-group-fill', '', '/0/2/3/46', 'F', 'DELETE', 'admin:sysUser:remove', 3, 0, '', '', 20, '0', '1', 0, 1, '2021-05-20 22:08:44.526', '2021-06-17 20:31:14.305', NULL);
Expand Down Expand Up @@ -259,37 +259,14 @@ INSERT INTO `sys_menu` VALUES (462, 'sys_job', '创建定时任务', 'app-group-
INSERT INTO `sys_menu` VALUES (463, 'sys_job', '修改定时任务', 'app-group-fill', '', '/0/459/460/463', 'F', '', 'job:sysJob:edit', 460, 0, '', '', 0, '0', '1', 1, 1, '2020-08-03 09:17:37.000', '2021-06-05 22:15:03.465', NULL);
INSERT INTO `sys_menu` VALUES (464, 'sys_job', '删除定时任务', 'app-group-fill', '', '/0/459/460/464', 'F', '', 'job:sysJob:remove', 460, 0, '', '', 0, '0', '1', 1, 1, '2020-08-03 09:17:37.000', '2021-06-05 22:15:03.465', NULL);
INSERT INTO `sys_menu` VALUES (471, 'JobLog', '日志', 'bug', '/schedule/log', '/0/459/471', 'C', '', '', 459, 0, '', '/schedule/log', 0, '1', '1', 1, 1, '2020-08-05 21:24:46.000', '2021-06-05 22:15:03.465', NULL);
INSERT INTO `sys_menu` VALUES (496, 'Sources', '资源管理', 'network', '/sources', '/0/496', 'M', '', '', 0, 1, '', 'Layout', 50, '0', '1', 1, 1, '2021-05-13 19:56:39.690', '2021-06-05 22:15:03.465', NULL);
INSERT INTO `sys_menu` VALUES (497, 'File', '文件管理', 'documentation', '/sources/file-manage', '/0/496/497', 'C', '', '', 496, 1, '', '/other/fileManage/index', 0, '0', '1', 1, 1, '2021-05-13 19:56:39.690', '2021-06-05 22:15:03.465', NULL);
INSERT INTO `sys_menu` VALUES (498, '', '内容管理', 'archived', '/cms', '/0/498', 'M', '', '', 0, 1, '', 'Layout', 60, '0', '1', 0, 1, '2021-06-05 16:06:16.525', '2021-06-05 22:15:03.465', NULL);
INSERT INTO `sys_menu` VALUES (499, 'SysCategoryManage', '分类', 'list', '/cms/sys-category', '/0/498/499', 'C', '', 'cms:sysCategory:list', 498, 1, '', '/sys-category/index', 0, '0', '0', 0, 1, '2021-06-05 16:06:16.525', '2021-06-05 22:15:03.465', NULL);
INSERT INTO `sys_menu` VALUES (500, '', '分页获取分类', 'app-group-fill', '', '/0/498/499/500', 'F', '', 'cms:sysCategory:query', 499, 1, '', '', 0, '0', '0', 1, 1, '2021-05-13 19:56:39.690', '2021-06-05 22:15:03.465', NULL);
INSERT INTO `sys_menu` VALUES (501, '', '创建分类', 'app-group-fill', '', '/0/498/499/501', 'F', '', 'cms:sysCategory:add', 499, 1, '', '', 0, '0', '0', 1, 1, '2021-05-13 19:56:39.690', '2021-06-05 22:15:03.465', NULL);
INSERT INTO `sys_menu` VALUES (502, '', '修改分类', 'app-group-fill', '', '/0/498/499/502', 'F', '', 'cms:sysCategory:edit', 499, 1, '', '', 0, '0', '0', 1, 1, '2021-05-13 19:56:39.690', '2021-06-05 22:15:03.465', NULL);
INSERT INTO `sys_menu` VALUES (503, '', '删除分类', 'app-group-fill', '', '/0/498/499/503', 'F', '', 'cms:sysCategory:remove', 499, 1, '', '', 0, '0', '0', 1, 1, '2021-05-13 19:56:39.690', '2021-06-05 22:15:03.465', NULL);
INSERT INTO `sys_menu` VALUES (511, 'SysContentManage', '内容管理', 'pass', '/cms/sys-content', '/0/498/511', 'C', '', 'cms:sysContent:list', 498, 1, '', '/sys-content/index', 0, '0', '0', 0, 1, '2021-06-05 16:06:16.525', '2021-06-05 22:15:03.465', NULL);
INSERT INTO `sys_menu` VALUES (512, '', '分页获取内容管理', 'app-group-fill', '', '/0/510/511/512', 'F', '', 'cms:sysContent:query', 511, 1, '', '', 0, '0', '0', 1, 1, '2021-05-13 19:56:39.690', '2021-06-05 22:15:03.465', NULL);
INSERT INTO `sys_menu` VALUES (513, '', '创建内容管理', 'app-group-fill', '', '/0/510/511/513', 'F', '', 'cms:sysContent:add', 511, 1, '', '', 0, '0', '0', 1, 1, '2021-05-13 19:56:39.690', '2021-06-05 22:15:03.465', NULL);
INSERT INTO `sys_menu` VALUES (514, '', '修改内容管理', 'app-group-fill', '', '/0/510/511/514', 'F', '', 'cms:sysContent:edit', 511, 1, '', '', 0, '0', '0', 1, 1, '2021-05-13 19:56:39.690', '2021-06-05 22:15:03.465', NULL);
INSERT INTO `sys_menu` VALUES (515, '', '删除内容管理', 'app-group-fill', '', '/0/510/511/515', 'F', '', 'cms:sysContent:remove', 511, 1, '', '', 0, '0', '0', 1, 1, '2021-05-13 19:56:39.690', '2021-06-05 22:15:03.465', NULL);
INSERT INTO `sys_menu` VALUES (522, 'SysContentCreate', '新增', 'form', '/cms/sys-content/create', '/0/498/522', 'C', '', 'cms:sysContent:add', 498, 0, '', '/syscontent/create.vue', 0, '1', '1', 0, 1, '2021-06-05 16:06:16.525', '2021-06-05 22:15:03.465', NULL);
INSERT INTO `sys_menu` VALUES (523, 'SysContentEdit', '编辑', 'edit', '/cms/sys-content/edit:id', '/0/498/523', 'C', '', 'cmd:sysContent:edit', 498, 0, '', '/sys-content/edit.vue', 0, '1', '1', 0, 1, '2021-06-05 16:06:16.525', '2021-06-05 22:15:03.465', NULL);
INSERT INTO `sys_menu` VALUES (528, 'SysApiManage', '接口管理', 'api-doc', '/admin/sys-api', '/0/527/528', 'C', '', 'admin:sysApi:list', 2, 0, '', '/admin/sys-api/index', 0, '0', '0', 0, 1, '2021-05-20 22:08:44.526', '2021-06-17 11:48:40.703', NULL);
INSERT INTO `sys_menu` VALUES (529, '', '查询接口', 'app-group-fill', '', '/0/527/528/529', 'F', '', 'admin:sysApi:query', 528, 0, '', '', 40, '0', '0', 0, 1, '2021-05-20 22:08:44.526', '2021-06-17 11:48:40.703', NULL);
INSERT INTO `sys_menu` VALUES (531, '', '修改接口', 'app-group-fill', '', '/0/527/528/531', 'F', '', 'admin:sysApi:edit', 528, 0, '', '', 30, '0', '0', 0, 1, '2021-05-20 22:08:44.526', '2021-06-17 11:48:40.703', NULL);
INSERT INTO `sys_menu` VALUES (537, 'SysTools', '系统工具', 'system-tools', '/sys-tools', '', 'M', '', '', 0, 0, '', 'Layout', 30, '0', '1', 1, 1, '2021-05-21 11:13:32.166', '2021-06-16 21:26:12.446', NULL);
INSERT INTO `sys_menu` VALUES (538, 'SysChinaAreaData', '行政区管理', 'nested', '/sys-tools/sys-china-area-data', '', 'C', '', 'sysTools:sysChinaAreaData:list', 537, 0, '', '/sys-tools/sys-china-area-data/index', 0, '0', '1', 1, 1, '2021-05-21 11:18:50.712', '2021-06-16 21:26:12.446', NULL);
INSERT INTO `sys_menu` VALUES (540, 'SysConfigSet', '参数设置', 'system-tools', '/admin/sys-config/set', '', 'C', '', 'admin:sysConfigSet:list', 2, 0, '', '/admin/sys-config/set', 0, '0', '1', 1, 1, '2021-05-25 16:06:52.560', '2021-06-17 11:48:40.703', NULL);
INSERT INTO `sys_menu` VALUES (542, '', '修改', 'upload', '', '', 'F', '', 'admin:sysConfigSet:update', 540, 0, '', '', 0, '0', '1', 1, 1, '2021-06-13 11:45:48.670', '2021-06-17 11:48:40.703', NULL);
INSERT INTO `sys_menu` VALUES (544, '1', '1', '404', '1', '', 'C', '', '1', 0, 0, '', '1', 0, '0', '1', 1, 1, '2021-06-16 21:42:52.603', '2021-06-16 21:43:05.400', '2021-06-16 21:43:14.403');
INSERT INTO `sys_menu` VALUES (545, '1', '1', 'chart', '1', '', 'C', '', '1', 0, 0, '', '1', 0, '0', '1', 1, 0, '2021-06-16 21:43:39.774', '2021-06-16 21:43:39.774', '2021-06-16 21:48:54.255');
INSERT INTO `sys_menu` VALUES (546, '1', '1', '404', '1', '', 'C', '', '1', 0, 0, '', '1', 0, '0', '1', 1, 1, '2021-06-16 21:49:13.861', '2021-06-16 21:49:48.583', '2021-06-16 21:49:52.490');
INSERT INTO `sys_menu_api_rule` VALUES (544, 5);
INSERT INTO `sys_menu_api_rule` VALUES (546, 5);
INSERT INTO `sys_menu_api_rule` VALUES (216, 6);
INSERT INTO `sys_menu_api_rule` VALUES (250, 6);
INSERT INTO `sys_menu_api_rule` VALUES (546, 6);
INSERT INTO `sys_menu_api_rule` VALUES (546, 7);
INSERT INTO `sys_menu_api_rule` VALUES (58, 21);
INSERT INTO `sys_menu_api_rule` VALUES (236, 21);
INSERT INTO `sys_menu_api_rule` VALUES (238, 23);
Expand Down Expand Up @@ -364,4 +341,4 @@ COMMIT;

SET FOREIGN_KEY_CHECKS = 1;

-- 数据完成 ;
-- 数据完成 ;
6 changes: 3 additions & 3 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ require (
github.com/bytedance/go-tagexpr/v2 v2.7.12
github.com/casbin/casbin/v2 v2.25.1
github.com/gin-gonic/gin v1.7.3
github.com/go-admin-team/go-admin-core v1.3.7
github.com/go-admin-team/go-admin-core/sdk v1.3.7
github.com/go-admin-team/go-admin-core v1.3.8
github.com/go-admin-team/go-admin-core/sdk v1.3.8
github.com/google/uuid v1.2.0
github.com/mssola/user_agent v0.5.2
github.com/opentracing/opentracing-go v1.1.0
Expand All @@ -35,4 +35,4 @@ require (
//replace (
// github.com/go-admin-team/go-admin-core => ../go-admin-core
// github.com/go-admin-team/go-admin-core/sdk => ../go-admin-core/sdk
//)
//)

0 comments on commit aa6c3df

Please sign in to comment.