更新若干功能
This commit is contained in:
1 parent
892ba5886d
commit
79d5ae6b66
45 files changed
+6755
-38
No files matched your search
@@ -57,12 +57,15 @@ func isTenantAdmin(userID int, tenantID int) bool {
|
||||
if tu.GroupID == 0 {
|
||||
return true
|
||||
}
|
||||
// 「租户管理员」「租户用户」是 cid=2 且 tenant_id=0 的全局预置角色,
|
||||
// 只有租户自建角色才带自己的 tenant_id,因此两种归属都要接受,
|
||||
// 否则全局角色会因 tenant_id 不匹配而永远查不到角色。
|
||||
cond := orm.NewCondition().
|
||||
And("id", tu.GroupID).
|
||||
And("cid", 2).
|
||||
AndCond(orm.NewCondition().Or("tenant_id", 0).Or("tenant_id", tenantID))
|
||||
var role models.AdminRole
|
||||
if err := models.Orm.QueryTable(new(models.AdminRole)).
|
||||
Filter("id", tu.GroupID).
|
||||
Filter("cid", 2).
|
||||
Filter("tenant_id", tenantID).
|
||||
One(&role); err != nil {
|
||||
if err := models.Orm.QueryTable(new(models.AdminRole)).SetCond(cond).One(&role); err != nil {
|
||||
return false
|
||||
}
|
||||
if role.Name == "租户管理员" {
|
||||
|
||||
Reference in new issue
Block a user