You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

44 lines
807 B

package sysService
import (
"GoClouds/core/comms"
"GoClouds/models"
"strings"
"xorm.io/builder"
)
func FindRole(xid string) *models.SysRole {
e := new(models.SysRole)
if comms.XormOne(xid, e, "xid") {
return e
}
return nil
}
func FindPermission(xid string) *models.SysPermssion {
e := new(models.SysPermssion)
if comms.XormOne(xid, e, "xid") {
return e
}
return nil
}
func FindPermissions(xids string) string {
if len(xids) <= 0 {
return ""
}
rets := ""
permssions := make([]*models.SysPermssion, 0)
err := comms.DbSysHelper.GetDB().Where(builder.In("xid", strings.Split(xids, ","))).Find(&permssions)
if err == nil {
ln := len(permssions)
for i, o := range permssions {
if i < ln-1 {
rets += o.Title + ","
} else {
rets += o.Title
}
}
}
return rets
}