mirror of
https://github.com/casdoor/casdoor.git
synced 2025-07-02 11:20:18 +08:00
Add getInitScore().
This commit is contained in:
@ -90,6 +90,7 @@ p, *, *, POST, /api/set-password, *, *
|
|||||||
p, *, *, POST, /api/send-verification-code, *, *
|
p, *, *, POST, /api/send-verification-code, *, *
|
||||||
p, *, *, GET, /api/get-human-check, *, *
|
p, *, *, GET, /api/get-human-check, *, *
|
||||||
p, *, *, POST, /api/reset-email-or-phone, *, *
|
p, *, *, POST, /api/reset-email-or-phone, *, *
|
||||||
|
p, *, *, POST, /api/upload-resource, *, *
|
||||||
`
|
`
|
||||||
|
|
||||||
sa := stringadapter.NewAdapter(ruleText)
|
sa := stringadapter.NewAdapter(ruleText)
|
||||||
|
@ -148,6 +148,7 @@ func (c *ApiController) Signup() {
|
|||||||
Address: []string{},
|
Address: []string{},
|
||||||
Affiliation: form.Affiliation,
|
Affiliation: form.Affiliation,
|
||||||
Region: form.Region,
|
Region: form.Region,
|
||||||
|
Score: getInitScore(),
|
||||||
IsAdmin: false,
|
IsAdmin: false,
|
||||||
IsGlobalAdmin: false,
|
IsGlobalAdmin: false,
|
||||||
IsForbidden: false,
|
IsForbidden: false,
|
||||||
|
@ -277,12 +277,6 @@ func (c *ApiController) Login() {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
var score int
|
|
||||||
score, err = strconv.Atoi(beego.AppConfig.String("initScore"))
|
|
||||||
if err != nil {
|
|
||||||
panic(err)
|
|
||||||
}
|
|
||||||
|
|
||||||
properties := map[string]string{}
|
properties := map[string]string{}
|
||||||
properties["no"] = strconv.Itoa(len(object.GetUsers(application.Organization)) + 2)
|
properties["no"] = strconv.Itoa(len(object.GetUsers(application.Organization)) + 2)
|
||||||
user := &object.User{
|
user := &object.User{
|
||||||
@ -295,7 +289,7 @@ func (c *ApiController) Login() {
|
|||||||
Avatar: userInfo.AvatarUrl,
|
Avatar: userInfo.AvatarUrl,
|
||||||
Address: []string{},
|
Address: []string{},
|
||||||
Email: userInfo.Email,
|
Email: userInfo.Email,
|
||||||
Score: score,
|
Score: getInitScore(),
|
||||||
IsAdmin: false,
|
IsAdmin: false,
|
||||||
IsGlobalAdmin: false,
|
IsGlobalAdmin: false,
|
||||||
IsForbidden: false,
|
IsForbidden: false,
|
||||||
|
@ -14,6 +14,12 @@
|
|||||||
|
|
||||||
package controllers
|
package controllers
|
||||||
|
|
||||||
|
import (
|
||||||
|
"strconv"
|
||||||
|
|
||||||
|
"github.com/astaxie/beego"
|
||||||
|
)
|
||||||
|
|
||||||
// ResponseOk ...
|
// ResponseOk ...
|
||||||
func (c *ApiController) ResponseOk(data ...interface{}) {
|
func (c *ApiController) ResponseOk(data ...interface{}) {
|
||||||
resp := Response{Status: "ok"}
|
resp := Response{Status: "ok"}
|
||||||
@ -51,3 +57,12 @@ func (c *ApiController) RequireSignedIn() (string, bool) {
|
|||||||
}
|
}
|
||||||
return userId, true
|
return userId, true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func getInitScore() int {
|
||||||
|
score, err := strconv.Atoi(beego.AppConfig.String("initScore"))
|
||||||
|
if err != nil {
|
||||||
|
panic(err)
|
||||||
|
}
|
||||||
|
|
||||||
|
return score
|
||||||
|
}
|
||||||
|
@ -63,6 +63,7 @@ func initBuiltInUser() {
|
|||||||
Address: []string{},
|
Address: []string{},
|
||||||
Affiliation: "Example Inc.",
|
Affiliation: "Example Inc.",
|
||||||
Tag: "staff",
|
Tag: "staff",
|
||||||
|
Score: 2000,
|
||||||
IsAdmin: true,
|
IsAdmin: true,
|
||||||
IsGlobalAdmin: true,
|
IsGlobalAdmin: true,
|
||||||
IsForbidden: false,
|
IsForbidden: false,
|
||||||
|
@ -305,6 +305,7 @@ func SyncLdapUsers(owner string, users []LdapRespUser) (*[]LdapRespUser, *[]Ldap
|
|||||||
Address: []string{user.Address},
|
Address: []string{user.Address},
|
||||||
Affiliation: "Example Inc.",
|
Affiliation: "Example Inc.",
|
||||||
Tag: "staff",
|
Tag: "staff",
|
||||||
|
Score: 2000,
|
||||||
Ldap: user.Uuid,
|
Ldap: user.Uuid,
|
||||||
}) {
|
}) {
|
||||||
failedUsers = append(failedUsers, user)
|
failedUsers = append(failedUsers, user)
|
||||||
|
Reference in New Issue
Block a user