增加了自动化视频以及修复了一些已知漏洞 (#1554)

* 解决bug:为角色添加权限时,如果有重复api权限,该角色所有权限均添加失败(包括登录)

* 支持视频上传和选用。视频首帧作为封面预览。

* 增加自动化代码视频选项

* 媒体库可上传视频
SelectImage组件增加参数file-type="image|video" 方便用户对媒体库可选内容做限制

* 自动化代码bug修复

---------

Co-authored-by: liuyahui <liuyahui@wjacloud.com>
Co-authored-by: Alan <alan.cd@qq.com>
This commit is contained in:
奇淼(piexlmax
2023-09-24 15:49:58 +08:00
committed by GitHub
parent c1c37901b5
commit 809e2496c0
12 changed files with 248 additions and 50 deletions

View File

@@ -146,6 +146,9 @@ func (autoCodeService *AutoCodeService) PreviewTemp(autoCode system.AutoCodeStru
if autoCode.Fields[i].FieldType == "picture" {
autoCode.HasPic = true
}
if autoCode.Fields[i].FieldType == "video" {
autoCode.HasPic = true
}
if autoCode.Fields[i].FieldType == "richtext" {
autoCode.HasRichText = true
}
@@ -250,6 +253,9 @@ func (autoCodeService *AutoCodeService) CreateTemp(autoCode system.AutoCodeStruc
if autoCode.Fields[i].FieldType == "picture" {
autoCode.HasPic = true
}
if autoCode.Fields[i].FieldType == "video" {
autoCode.HasPic = true
}
if autoCode.Fields[i].FieldType == "richtext" {
autoCode.HasRichText = true
}

View File

@@ -28,8 +28,14 @@ func (casbinService *CasbinService) UpdateCasbin(AuthorityID uint, casbinInfos [
authorityId := strconv.Itoa(int(AuthorityID))
casbinService.ClearCasbin(0, authorityId)
rules := [][]string{}
//做权限去重处理
deduplicateMap := make(map[string]bool)
for _, v := range casbinInfos {
rules = append(rules, []string{authorityId, v.Path, v.Method})
key := authorityId + v.Path + v.Method
if _, ok := deduplicateMap[key]; !ok {
deduplicateMap[key] = true
rules = append(rules, []string{authorityId, v.Path, v.Method})
}
}
e := casbinService.Casbin()
success, _ := e.AddPolicies(rules)