mirror of
https://github.com/casdoor/casdoor.git
synced 2025-07-14 16:13:24 +08:00
Compare commits
6 Commits
Author | SHA1 | Date | |
---|---|---|---|
2d6fae32be | |||
741cff99df | |||
cad9c28e92 | |||
524cf4dda5 | |||
077a1cb8b7 | |||
00efdf1d03 |
@ -30,6 +30,7 @@ import (
|
||||
// @Param permissionId query string false "permission id"
|
||||
// @Param modelId query string false "model id"
|
||||
// @Param resourceId query string false "resource id"
|
||||
// @Param owner query string false "owner"
|
||||
// @Success 200 {object} controllers.Response The Response object
|
||||
// @router /enforce [post]
|
||||
func (c *ApiController) Enforce() {
|
||||
@ -37,6 +38,7 @@ func (c *ApiController) Enforce() {
|
||||
modelId := c.Input().Get("modelId")
|
||||
resourceId := c.Input().Get("resourceId")
|
||||
enforcerId := c.Input().Get("enforcerId")
|
||||
owner := c.Input().Get("owner")
|
||||
|
||||
if len(c.Ctx.Input.RequestBody) == 0 {
|
||||
c.ResponseError("The request body should not be empty")
|
||||
@ -117,6 +119,8 @@ func (c *ApiController) Enforce() {
|
||||
c.ResponseError(err.Error())
|
||||
return
|
||||
}
|
||||
} else if owner != "" {
|
||||
permissions, err = object.GetPermissions(owner)
|
||||
} else {
|
||||
c.ResponseError(c.T("general:Missing parameter"))
|
||||
return
|
||||
@ -152,12 +156,14 @@ func (c *ApiController) Enforce() {
|
||||
// @Param body body []string true "array of casbin requests"
|
||||
// @Param permissionId query string false "permission id"
|
||||
// @Param modelId query string false "model id"
|
||||
// @Param owner query string false "owner"
|
||||
// @Success 200 {object} controllers.Response The Response object
|
||||
// @router /batch-enforce [post]
|
||||
func (c *ApiController) BatchEnforce() {
|
||||
permissionId := c.Input().Get("permissionId")
|
||||
modelId := c.Input().Get("modelId")
|
||||
enforcerId := c.Input().Get("enforcerId")
|
||||
owner := c.Input().Get("owner")
|
||||
|
||||
var requests [][]string
|
||||
err := json.Unmarshal(c.Ctx.Input.RequestBody, &requests)
|
||||
@ -227,6 +233,8 @@ func (c *ApiController) BatchEnforce() {
|
||||
c.ResponseError(err.Error())
|
||||
return
|
||||
}
|
||||
} else if owner != "" {
|
||||
permissions, err = object.GetPermissions(owner)
|
||||
} else {
|
||||
c.ResponseError(c.T("general:Missing parameter"))
|
||||
return
|
||||
|
@ -1,5 +1,5 @@
|
||||
{{- if .Values.autoscaling.enabled }}
|
||||
apiVersion: autoscaling/v2beta1
|
||||
apiVersion: autoscaling/v2
|
||||
kind: HorizontalPodAutoscaler
|
||||
metadata:
|
||||
name: {{ include "casdoor.fullname" . }}
|
||||
@ -17,12 +17,15 @@ spec:
|
||||
- type: Resource
|
||||
resource:
|
||||
name: cpu
|
||||
targetAverageUtilization: {{ .Values.autoscaling.targetCPUUtilizationPercentage }}
|
||||
target:
|
||||
type: Utilization
|
||||
averageUtilization: {{ .Values.autoscaling.targetCPUUtilizationPercentage }}
|
||||
{{- end }}
|
||||
{{- if .Values.autoscaling.targetMemoryUtilizationPercentage }}
|
||||
- type: Resource
|
||||
resource:
|
||||
name: memory
|
||||
targetAverageUtilization: {{ .Values.autoscaling.targetMemoryUtilizationPercentage }}
|
||||
target:
|
||||
averageUtilization: {{ .Values.autoscaling.targetMemoryUtilizationPercentage }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
|
@ -664,7 +664,7 @@ func applicationChangeTrigger(oldName string, newName string) error {
|
||||
}
|
||||
}
|
||||
permissions[i].Resources = permissionResoureces
|
||||
_, err = session.Where("name=?", permissions[i].Name).Update(permissions[i])
|
||||
_, err = session.Where("owner=?", permissions[i].Owner).Where("name=?", permissions[i].Name).Update(permissions[i])
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
@ -36,16 +36,14 @@ import (
|
||||
)
|
||||
|
||||
var (
|
||||
ormer *Ormer = nil
|
||||
isCreateDatabaseDefined = false
|
||||
createDatabase = true
|
||||
ormer *Ormer = nil
|
||||
createDatabase = true
|
||||
configPath = "conf/app.conf"
|
||||
)
|
||||
|
||||
func InitFlag() {
|
||||
if !isCreateDatabaseDefined {
|
||||
isCreateDatabaseDefined = true
|
||||
createDatabase = getCreateDatabaseFlag()
|
||||
}
|
||||
createDatabase = getCreateDatabaseFlag()
|
||||
configPath = getConfigFlag()
|
||||
}
|
||||
|
||||
func getCreateDatabaseFlag() bool {
|
||||
@ -54,6 +52,12 @@ func getCreateDatabaseFlag() bool {
|
||||
return *res
|
||||
}
|
||||
|
||||
func getConfigFlag() string {
|
||||
res := flag.String("config", "conf/app.conf", "set it to \"/your/path/app.conf\" if your config file is not in: \"/conf/app.conf\"")
|
||||
flag.Parse()
|
||||
return *res
|
||||
}
|
||||
|
||||
func InitConfig() {
|
||||
err := beego.LoadAppConfig("ini", "../conf/app.conf")
|
||||
if err != nil {
|
||||
@ -68,7 +72,7 @@ func InitConfig() {
|
||||
|
||||
func InitAdapter() {
|
||||
if conf.GetConfigString("driverName") == "" {
|
||||
if !util.FileExist("conf/app.conf") {
|
||||
if !util.FileExist(configPath) {
|
||||
dir, err := os.Getwd()
|
||||
if err != nil {
|
||||
panic(err)
|
||||
|
@ -867,7 +867,8 @@ func GetUserInfo(user *User, scope string, aud string, host string) *Userinfo {
|
||||
}
|
||||
if strings.Contains(scope, "email") {
|
||||
resp.Email = user.Email
|
||||
resp.EmailVerified = user.EmailVerified
|
||||
// resp.EmailVerified = user.EmailVerified
|
||||
resp.EmailVerified = true
|
||||
}
|
||||
if strings.Contains(scope, "address") {
|
||||
resp.Address = user.Location
|
||||
|
Reference in New Issue
Block a user