24 lines
582 B
Go
24 lines
582 B
Go
package controllers
|
|
|
|
import (
|
|
"apiserver/common"
|
|
logger "apiserver/utils"
|
|
|
|
"github.com/gin-gonic/gin"
|
|
"go.uber.org/zap"
|
|
)
|
|
|
|
type PermController struct{}
|
|
|
|
func (pc *PermController) GetPermsInfo(ctx *gin.Context) {
|
|
logger.Debug("Enter GetPermsInfo() function from ", zap.String("client_ip", ctx.ClientIP()))
|
|
|
|
queryResult := GetAllPermissions()
|
|
if len(queryResult) == 0 {
|
|
logger.Error("No permissions found")
|
|
ReturnError(ctx, common.ERROR_CODE, common.ERROR_QUERY_PERMISSIONS_MSG, nil)
|
|
return
|
|
}
|
|
|
|
ReturnSuccess(ctx, common.SUCCESS_CODE, common.SUCCESS_MSG, queryResult)
|
|
}
|