mirror of
https://github.com/veops/oneterm.git
synced 2025-10-26 09:00:26 +08:00
fix: connectable without gateway and asset count when no-admin
This commit is contained in:
@@ -92,7 +92,7 @@ func (c *Controller) GetAssets(ctx *gin.Context) {
|
||||
|
||||
if info && !acl.IsAdmin(currentUser) {
|
||||
//rs := make([]*acl.Resource, 0)
|
||||
rs, err := acl.GetRoleResources(ctx, currentUser.Acl.Rid, acl.GetResourceTypeName(conf.RESOURCE_AUTHORIZATION))
|
||||
authorizationResourceIds, err := GetAutorizationResourceIds(ctx)
|
||||
if err != nil {
|
||||
handleRemoteErr(ctx, err)
|
||||
return
|
||||
@@ -100,7 +100,7 @@ func (c *Controller) GetAssets(ctx *gin.Context) {
|
||||
ids := make([]int, 0)
|
||||
if err = mysql.DB.
|
||||
Model(&model.Authorization{}).
|
||||
Where("resource_id IN ?", lo.Map(rs, func(r *acl.Resource, _ int) int { return r.ResourceId })).
|
||||
Where("resource_id IN ?", authorizationResourceIds).
|
||||
Distinct().
|
||||
Pluck("asset_id", &ids).
|
||||
Error; err != nil {
|
||||
|
||||
Reference in New Issue
Block a user