mirror of
https://github.com/casdoor/casdoor.git
synced 2025-08-04 03:50:30 +08:00
Compare commits
15 Commits
Author | SHA1 | Date | |
---|---|---|---|
![]() |
28297e06f7 | ||
![]() |
f3aed0b6a8 | ||
![]() |
35e1f8538e | ||
![]() |
30a14ff54a | ||
![]() |
1ab7a54133 | ||
![]() |
0e2dad35f3 | ||
![]() |
d31077a510 | ||
![]() |
eee9b8b9fe | ||
![]() |
91cb5f393a | ||
![]() |
807aea5ec7 | ||
![]() |
1c42b6e395 | ||
![]() |
49a73f8138 | ||
![]() |
55784c68a3 | ||
![]() |
8080b10b3b | ||
![]() |
cd7589775c |
@@ -50,7 +50,8 @@ func (c *ApiController) GetApplications() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
panic(err)
|
c.ResponseError(err.Error())
|
||||||
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
c.Data["json"] = object.GetMaskedApplications(applications, userId)
|
c.Data["json"] = object.GetMaskedApplications(applications, userId)
|
||||||
@@ -59,13 +60,15 @@ func (c *ApiController) GetApplications() {
|
|||||||
limit := util.ParseInt(limit)
|
limit := util.ParseInt(limit)
|
||||||
count, err := object.GetApplicationCount(owner, field, value)
|
count, err := object.GetApplicationCount(owner, field, value)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
panic(err)
|
c.ResponseError(err.Error())
|
||||||
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
paginator := pagination.SetPaginator(c.Ctx, limit, count)
|
paginator := pagination.SetPaginator(c.Ctx, limit, count)
|
||||||
app, err := object.GetPaginationApplications(owner, paginator.Offset(), limit, field, value, sortField, sortOrder)
|
app, err := object.GetPaginationApplications(owner, paginator.Offset(), limit, field, value, sortField, sortOrder)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
panic(err)
|
c.ResponseError(err.Error())
|
||||||
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
applications := object.GetMaskedApplications(app, userId)
|
applications := object.GetMaskedApplications(app, userId)
|
||||||
@@ -85,7 +88,8 @@ func (c *ApiController) GetApplication() {
|
|||||||
id := c.Input().Get("id")
|
id := c.Input().Get("id")
|
||||||
app, err := object.GetApplication(id)
|
app, err := object.GetApplication(id)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
panic(err)
|
c.ResponseError(err.Error())
|
||||||
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
c.Data["json"] = object.GetMaskedApplication(app, userId)
|
c.Data["json"] = object.GetMaskedApplication(app, userId)
|
||||||
@@ -104,7 +108,8 @@ func (c *ApiController) GetUserApplication() {
|
|||||||
id := c.Input().Get("id")
|
id := c.Input().Get("id")
|
||||||
user, err := object.GetUser(id)
|
user, err := object.GetUser(id)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
panic(err)
|
c.ResponseError(err.Error())
|
||||||
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
if user == nil {
|
if user == nil {
|
||||||
@@ -114,7 +119,8 @@ func (c *ApiController) GetUserApplication() {
|
|||||||
|
|
||||||
app, err := object.GetApplicationByUser(user)
|
app, err := object.GetApplicationByUser(user)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
panic(err)
|
c.ResponseError(err.Error())
|
||||||
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
c.Data["json"] = object.GetMaskedApplication(app, userId)
|
c.Data["json"] = object.GetMaskedApplication(app, userId)
|
||||||
@@ -147,7 +153,8 @@ func (c *ApiController) GetOrganizationApplications() {
|
|||||||
if limit == "" || page == "" {
|
if limit == "" || page == "" {
|
||||||
applications, err := object.GetOrganizationApplications(owner, organization)
|
applications, err := object.GetOrganizationApplications(owner, organization)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
panic(err)
|
c.ResponseError(err.Error())
|
||||||
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
c.Data["json"] = object.GetMaskedApplications(applications, userId)
|
c.Data["json"] = object.GetMaskedApplications(applications, userId)
|
||||||
|
@@ -69,6 +69,15 @@ func (c *ApiController) HandleLoggedIn(application *object.Application, user *ob
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// check user's tag
|
||||||
|
if !user.IsGlobalAdmin && !user.IsAdmin && len(application.Tags) > 0 {
|
||||||
|
// only users with the tag that is listed in the application tags can login
|
||||||
|
if !util.InSlice(application.Tags, user.Tag) {
|
||||||
|
c.ResponseError(fmt.Sprintf(c.T("auth:User's tag: %s is not listed in the application's tags"), user.Tag))
|
||||||
|
return
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if form.Password != "" && user.IsMfaEnabled() {
|
if form.Password != "" && user.IsMfaEnabled() {
|
||||||
c.setMfaSessionData(&object.MfaSessionData{UserId: userId})
|
c.setMfaSessionData(&object.MfaSessionData{UserId: userId})
|
||||||
resp = &Response{Status: object.NextMfa, Data: user.GetPreferredMfaProps(true)}
|
resp = &Response{Status: object.NextMfa, Data: user.GetPreferredMfaProps(true)}
|
||||||
@@ -238,7 +247,7 @@ func isProxyProviderType(providerType string) bool {
|
|||||||
// @Param code_challenge_method query string false code_challenge_method
|
// @Param code_challenge_method query string false code_challenge_method
|
||||||
// @Param code_challenge query string false code_challenge
|
// @Param code_challenge query string false code_challenge
|
||||||
// @Param form body controllers.AuthForm true "Login information"
|
// @Param form body controllers.AuthForm true "Login information"
|
||||||
// @Success 200 {object} Response The Response object
|
// @Success 200 {object} controllers.Response The Response object
|
||||||
// @router /login [post]
|
// @router /login [post]
|
||||||
func (c *ApiController) Login() {
|
func (c *ApiController) Login() {
|
||||||
resp := &Response{}
|
resp := &Response{}
|
||||||
@@ -756,7 +765,8 @@ func (c *ApiController) HandleSamlLogin() {
|
|||||||
func (c *ApiController) HandleOfficialAccountEvent() {
|
func (c *ApiController) HandleOfficialAccountEvent() {
|
||||||
respBytes, err := ioutil.ReadAll(c.Ctx.Request.Body)
|
respBytes, err := ioutil.ReadAll(c.Ctx.Request.Body)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
panic(err)
|
c.ResponseError(err.Error())
|
||||||
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
var data struct {
|
var data struct {
|
||||||
@@ -766,7 +776,8 @@ func (c *ApiController) HandleOfficialAccountEvent() {
|
|||||||
}
|
}
|
||||||
err = xml.Unmarshal(respBytes, &data)
|
err = xml.Unmarshal(respBytes, &data)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
panic(err)
|
c.ResponseError(err.Error())
|
||||||
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
lock.Lock()
|
lock.Lock()
|
||||||
|
@@ -79,7 +79,8 @@ func (c *ApiController) getCurrentUser() *object.User {
|
|||||||
} else {
|
} else {
|
||||||
user, err = object.GetUser(userId)
|
user, err = object.GetUser(userId)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
panic(err)
|
c.ResponseError(err.Error())
|
||||||
|
return nil
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return user
|
return user
|
||||||
@@ -112,7 +113,8 @@ func (c *ApiController) GetSessionApplication() *object.Application {
|
|||||||
}
|
}
|
||||||
application, err := object.GetApplicationByClientId(clientId.(string))
|
application, err := object.GetApplicationByClientId(clientId.(string))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
panic(err)
|
c.ResponseError(err.Error())
|
||||||
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
return application
|
return application
|
||||||
|
@@ -41,7 +41,8 @@ func (c *ApiController) GetCerts() {
|
|||||||
if limit == "" || page == "" {
|
if limit == "" || page == "" {
|
||||||
maskedCerts, err := object.GetMaskedCerts(object.GetCerts(owner))
|
maskedCerts, err := object.GetMaskedCerts(object.GetCerts(owner))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
panic(err)
|
c.ResponseError(err.Error())
|
||||||
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
c.Data["json"] = maskedCerts
|
c.Data["json"] = maskedCerts
|
||||||
@@ -50,13 +51,15 @@ func (c *ApiController) GetCerts() {
|
|||||||
limit := util.ParseInt(limit)
|
limit := util.ParseInt(limit)
|
||||||
count, err := object.GetCertCount(owner, field, value)
|
count, err := object.GetCertCount(owner, field, value)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
panic(err)
|
c.ResponseError(err.Error())
|
||||||
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
paginator := pagination.SetPaginator(c.Ctx, limit, count)
|
paginator := pagination.SetPaginator(c.Ctx, limit, count)
|
||||||
certs, err := object.GetMaskedCerts(object.GetPaginationCerts(owner, paginator.Offset(), limit, field, value, sortField, sortOrder))
|
certs, err := object.GetMaskedCerts(object.GetPaginationCerts(owner, paginator.Offset(), limit, field, value, sortField, sortOrder))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
panic(err)
|
c.ResponseError(err.Error())
|
||||||
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
c.ResponseOk(certs, paginator.Nums())
|
c.ResponseOk(certs, paginator.Nums())
|
||||||
@@ -80,7 +83,8 @@ func (c *ApiController) GetGlobleCerts() {
|
|||||||
if limit == "" || page == "" {
|
if limit == "" || page == "" {
|
||||||
maskedCerts, err := object.GetMaskedCerts(object.GetGlobleCerts())
|
maskedCerts, err := object.GetMaskedCerts(object.GetGlobleCerts())
|
||||||
if err != nil {
|
if err != nil {
|
||||||
panic(err)
|
c.ResponseError(err.Error())
|
||||||
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
c.Data["json"] = maskedCerts
|
c.Data["json"] = maskedCerts
|
||||||
@@ -89,13 +93,15 @@ func (c *ApiController) GetGlobleCerts() {
|
|||||||
limit := util.ParseInt(limit)
|
limit := util.ParseInt(limit)
|
||||||
count, err := object.GetGlobalCertsCount(field, value)
|
count, err := object.GetGlobalCertsCount(field, value)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
panic(err)
|
c.ResponseError(err.Error())
|
||||||
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
paginator := pagination.SetPaginator(c.Ctx, limit, count)
|
paginator := pagination.SetPaginator(c.Ctx, limit, count)
|
||||||
certs, err := object.GetMaskedCerts(object.GetPaginationGlobalCerts(paginator.Offset(), limit, field, value, sortField, sortOrder))
|
certs, err := object.GetMaskedCerts(object.GetPaginationGlobalCerts(paginator.Offset(), limit, field, value, sortField, sortOrder))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
panic(err)
|
c.ResponseError(err.Error())
|
||||||
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
c.ResponseOk(certs, paginator.Nums())
|
c.ResponseOk(certs, paginator.Nums())
|
||||||
@@ -113,7 +119,8 @@ func (c *ApiController) GetCert() {
|
|||||||
id := c.Input().Get("id")
|
id := c.Input().Get("id")
|
||||||
cert, err := object.GetCert(id)
|
cert, err := object.GetCert(id)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
panic(err)
|
c.ResponseError(err.Error())
|
||||||
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
c.Data["json"] = object.GetMaskedCert(cert)
|
c.Data["json"] = object.GetMaskedCert(cert)
|
||||||
|
@@ -41,7 +41,8 @@ func (c *ApiController) GetChats() {
|
|||||||
if limit == "" || page == "" {
|
if limit == "" || page == "" {
|
||||||
maskedChats, err := object.GetMaskedChats(object.GetChats(owner))
|
maskedChats, err := object.GetMaskedChats(object.GetChats(owner))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
panic(err)
|
c.ResponseError(err.Error())
|
||||||
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
c.Data["json"] = maskedChats
|
c.Data["json"] = maskedChats
|
||||||
@@ -77,7 +78,8 @@ func (c *ApiController) GetChat() {
|
|||||||
|
|
||||||
maskedChat, err := object.GetMaskedChat(object.GetChat(id))
|
maskedChat, err := object.GetMaskedChat(object.GetChat(id))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
panic(err)
|
c.ResponseError(err.Error())
|
||||||
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
c.Data["json"] = maskedChat
|
c.Data["json"] = maskedChat
|
||||||
|
@@ -53,7 +53,8 @@ func (c *ApiController) GetMessages() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
panic(err)
|
c.ResponseError(err.Error())
|
||||||
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
c.Data["json"] = object.GetMaskedMessages(messages)
|
c.Data["json"] = object.GetMaskedMessages(messages)
|
||||||
@@ -89,7 +90,8 @@ func (c *ApiController) GetMessage() {
|
|||||||
id := c.Input().Get("id")
|
id := c.Input().Get("id")
|
||||||
message, err := object.GetMessage(id)
|
message, err := object.GetMessage(id)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
panic(err)
|
c.ResponseError(err.Error())
|
||||||
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
c.Data["json"] = object.GetMaskedMessage(message)
|
c.Data["json"] = object.GetMaskedMessage(message)
|
||||||
@@ -100,7 +102,8 @@ func (c *ApiController) ResponseErrorStream(errorText string) {
|
|||||||
event := fmt.Sprintf("event: myerror\ndata: %s\n\n", errorText)
|
event := fmt.Sprintf("event: myerror\ndata: %s\n\n", errorText)
|
||||||
_, err := c.Ctx.ResponseWriter.Write([]byte(event))
|
_, err := c.Ctx.ResponseWriter.Write([]byte(event))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
panic(err)
|
c.ResponseError(err.Error())
|
||||||
|
return
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -196,7 +199,8 @@ func (c *ApiController) GetMessageAnswer() {
|
|||||||
event := fmt.Sprintf("event: end\ndata: %s\n\n", "end")
|
event := fmt.Sprintf("event: end\ndata: %s\n\n", "end")
|
||||||
_, err = c.Ctx.ResponseWriter.Write([]byte(event))
|
_, err = c.Ctx.ResponseWriter.Write([]byte(event))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
panic(err)
|
c.ResponseError(err.Error())
|
||||||
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
answer := stringBuilder.String()
|
answer := stringBuilder.String()
|
||||||
@@ -204,7 +208,8 @@ func (c *ApiController) GetMessageAnswer() {
|
|||||||
message.Text = answer
|
message.Text = answer
|
||||||
_, err = object.UpdateMessage(message.GetId(), message)
|
_, err = object.UpdateMessage(message.GetId(), message)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
panic(err)
|
c.ResponseError(err.Error())
|
||||||
|
return
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -28,7 +28,7 @@ import (
|
|||||||
// @param owner form string true "owner of user"
|
// @param owner form string true "owner of user"
|
||||||
// @param name form string true "name of user"
|
// @param name form string true "name of user"
|
||||||
// @param type form string true "MFA auth type"
|
// @param type form string true "MFA auth type"
|
||||||
// @Success 200 {object} The Response object
|
// @Success 200 {object} controllers.Response The Response object
|
||||||
// @router /mfa/setup/initiate [post]
|
// @router /mfa/setup/initiate [post]
|
||||||
func (c *ApiController) MfaSetupInitiate() {
|
func (c *ApiController) MfaSetupInitiate() {
|
||||||
owner := c.Ctx.Request.Form.Get("owner")
|
owner := c.Ctx.Request.Form.Get("owner")
|
||||||
|
@@ -41,7 +41,8 @@ func (c *ApiController) GetModels() {
|
|||||||
if limit == "" || page == "" {
|
if limit == "" || page == "" {
|
||||||
models, err := object.GetModels(owner)
|
models, err := object.GetModels(owner)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
panic(err)
|
c.ResponseError(err.Error())
|
||||||
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
c.Data["json"] = models
|
c.Data["json"] = models
|
||||||
@@ -77,7 +78,8 @@ func (c *ApiController) GetModel() {
|
|||||||
|
|
||||||
model, err := object.GetModel(id)
|
model, err := object.GetModel(id)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
panic(err)
|
c.ResponseError(err.Error())
|
||||||
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
c.Data["json"] = model
|
c.Data["json"] = model
|
||||||
|
@@ -37,17 +37,27 @@ func (c *ApiController) GetOrganizations() {
|
|||||||
value := c.Input().Get("value")
|
value := c.Input().Get("value")
|
||||||
sortField := c.Input().Get("sortField")
|
sortField := c.Input().Get("sortField")
|
||||||
sortOrder := c.Input().Get("sortOrder")
|
sortOrder := c.Input().Get("sortOrder")
|
||||||
|
organizationName := c.Input().Get("organizationName")
|
||||||
|
|
||||||
|
isGlobalAdmin := c.IsGlobalAdmin()
|
||||||
if limit == "" || page == "" {
|
if limit == "" || page == "" {
|
||||||
maskedOrganizations, err := object.GetMaskedOrganizations(object.GetOrganizations(owner))
|
var maskedOrganizations []*object.Organization
|
||||||
|
var err error
|
||||||
|
|
||||||
|
if isGlobalAdmin {
|
||||||
|
maskedOrganizations, err = object.GetMaskedOrganizations(object.GetOrganizations(owner))
|
||||||
|
} else {
|
||||||
|
maskedOrganizations, err = object.GetMaskedOrganizations(object.GetOrganizations(owner, c.getCurrentUser().Owner))
|
||||||
|
}
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
panic(err)
|
c.ResponseError(err.Error())
|
||||||
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
c.Data["json"] = maskedOrganizations
|
c.Data["json"] = maskedOrganizations
|
||||||
c.ServeJSON()
|
c.ServeJSON()
|
||||||
} else {
|
} else {
|
||||||
isGlobalAdmin := c.IsGlobalAdmin()
|
|
||||||
if !isGlobalAdmin {
|
if !isGlobalAdmin {
|
||||||
maskedOrganizations, err := object.GetMaskedOrganizations(object.GetOrganizations(owner, c.getCurrentUser().Owner))
|
maskedOrganizations, err := object.GetMaskedOrganizations(object.GetOrganizations(owner, c.getCurrentUser().Owner))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@@ -64,7 +74,7 @@ func (c *ApiController) GetOrganizations() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
paginator := pagination.SetPaginator(c.Ctx, limit, count)
|
paginator := pagination.SetPaginator(c.Ctx, limit, count)
|
||||||
organizations, err := object.GetMaskedOrganizations(object.GetPaginationOrganizations(owner, paginator.Offset(), limit, field, value, sortField, sortOrder))
|
organizations, err := object.GetMaskedOrganizations(object.GetPaginationOrganizations(owner, organizationName, paginator.Offset(), limit, field, value, sortField, sortOrder))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
c.ResponseError(err.Error())
|
c.ResponseError(err.Error())
|
||||||
return
|
return
|
||||||
|
@@ -42,7 +42,8 @@ func (c *ApiController) GetPayments() {
|
|||||||
if limit == "" || page == "" {
|
if limit == "" || page == "" {
|
||||||
payments, err := object.GetPayments(owner)
|
payments, err := object.GetPayments(owner)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
panic(err)
|
c.ResponseError(err.Error())
|
||||||
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
c.Data["json"] = payments
|
c.Data["json"] = payments
|
||||||
@@ -51,13 +52,15 @@ func (c *ApiController) GetPayments() {
|
|||||||
limit := util.ParseInt(limit)
|
limit := util.ParseInt(limit)
|
||||||
count, err := object.GetPaymentCount(owner, organization, field, value)
|
count, err := object.GetPaymentCount(owner, organization, field, value)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
panic(err)
|
c.ResponseError(err.Error())
|
||||||
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
paginator := pagination.SetPaginator(c.Ctx, limit, count)
|
paginator := pagination.SetPaginator(c.Ctx, limit, count)
|
||||||
payments, err := object.GetPaginationPayments(owner, organization, paginator.Offset(), limit, field, value, sortField, sortOrder)
|
payments, err := object.GetPaginationPayments(owner, organization, paginator.Offset(), limit, field, value, sortField, sortOrder)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
panic(err)
|
c.ResponseError(err.Error())
|
||||||
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
c.ResponseOk(payments, paginator.Nums())
|
c.ResponseOk(payments, paginator.Nums())
|
||||||
@@ -99,7 +102,8 @@ func (c *ApiController) GetPayment() {
|
|||||||
|
|
||||||
payment, err := object.GetPayment(id)
|
payment, err := object.GetPayment(id)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
panic(err)
|
c.ResponseError(err.Error())
|
||||||
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
c.Data["json"] = payment
|
c.Data["json"] = payment
|
||||||
@@ -190,7 +194,8 @@ func (c *ApiController) NotifyPayment() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
panic(err)
|
c.ResponseError(err.Error())
|
||||||
|
return
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -41,7 +41,8 @@ func (c *ApiController) GetPermissions() {
|
|||||||
if limit == "" || page == "" {
|
if limit == "" || page == "" {
|
||||||
permissions, err := object.GetPermissions(owner)
|
permissions, err := object.GetPermissions(owner)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
panic(err)
|
c.ResponseError(err.Error())
|
||||||
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
c.Data["json"] = permissions
|
c.Data["json"] = permissions
|
||||||
@@ -50,13 +51,15 @@ func (c *ApiController) GetPermissions() {
|
|||||||
limit := util.ParseInt(limit)
|
limit := util.ParseInt(limit)
|
||||||
count, err := object.GetPermissionCount(owner, field, value)
|
count, err := object.GetPermissionCount(owner, field, value)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
panic(err)
|
c.ResponseError(err.Error())
|
||||||
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
paginator := pagination.SetPaginator(c.Ctx, limit, count)
|
paginator := pagination.SetPaginator(c.Ctx, limit, count)
|
||||||
permissions, err := object.GetPaginationPermissions(owner, paginator.Offset(), limit, field, value, sortField, sortOrder)
|
permissions, err := object.GetPaginationPermissions(owner, paginator.Offset(), limit, field, value, sortField, sortOrder)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
panic(err)
|
c.ResponseError(err.Error())
|
||||||
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
c.ResponseOk(permissions, paginator.Nums())
|
c.ResponseOk(permissions, paginator.Nums())
|
||||||
@@ -116,7 +119,8 @@ func (c *ApiController) GetPermission() {
|
|||||||
|
|
||||||
permission, err := object.GetPermission(id)
|
permission, err := object.GetPermission(id)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
panic(err)
|
c.ResponseError(err.Error())
|
||||||
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
c.Data["json"] = permission
|
c.Data["json"] = permission
|
||||||
|
@@ -41,7 +41,8 @@ func (c *ApiController) GetPlans() {
|
|||||||
if limit == "" || page == "" {
|
if limit == "" || page == "" {
|
||||||
plans, err := object.GetPlans(owner)
|
plans, err := object.GetPlans(owner)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
panic(err)
|
c.ResponseError(err.Error())
|
||||||
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
c.Data["json"] = plans
|
c.Data["json"] = plans
|
||||||
@@ -79,13 +80,15 @@ func (c *ApiController) GetPlan() {
|
|||||||
|
|
||||||
plan, err := object.GetPlan(id)
|
plan, err := object.GetPlan(id)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
panic(err)
|
c.ResponseError(err.Error())
|
||||||
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
if includeOption {
|
if includeOption {
|
||||||
options, err := object.GetPermissionsByRole(plan.Role)
|
options, err := object.GetPermissionsByRole(plan.Role)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
panic(err)
|
c.ResponseError(err.Error())
|
||||||
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, option := range options {
|
for _, option := range options {
|
||||||
|
@@ -41,7 +41,8 @@ func (c *ApiController) GetPricings() {
|
|||||||
if limit == "" || page == "" {
|
if limit == "" || page == "" {
|
||||||
pricings, err := object.GetPricings(owner)
|
pricings, err := object.GetPricings(owner)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
panic(err)
|
c.ResponseError(err.Error())
|
||||||
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
c.Data["json"] = pricings
|
c.Data["json"] = pricings
|
||||||
@@ -70,14 +71,15 @@ func (c *ApiController) GetPricings() {
|
|||||||
// @Tag Pricing API
|
// @Tag Pricing API
|
||||||
// @Description get pricing
|
// @Description get pricing
|
||||||
// @Param id query string true "The id ( owner/name ) of the pricing"
|
// @Param id query string true "The id ( owner/name ) of the pricing"
|
||||||
// @Success 200 {object} object.pricing The Response object
|
// @Success 200 {object} object.Pricing The Response object
|
||||||
// @router /get-pricing [get]
|
// @router /get-pricing [get]
|
||||||
func (c *ApiController) GetPricing() {
|
func (c *ApiController) GetPricing() {
|
||||||
id := c.Input().Get("id")
|
id := c.Input().Get("id")
|
||||||
|
|
||||||
pricing, err := object.GetPricing(id)
|
pricing, err := object.GetPricing(id)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
panic(err)
|
c.ResponseError(err.Error())
|
||||||
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
c.Data["json"] = pricing
|
c.Data["json"] = pricing
|
||||||
|
@@ -42,7 +42,8 @@ func (c *ApiController) GetProducts() {
|
|||||||
if limit == "" || page == "" {
|
if limit == "" || page == "" {
|
||||||
products, err := object.GetProducts(owner)
|
products, err := object.GetProducts(owner)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
panic(err)
|
c.ResponseError(err.Error())
|
||||||
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
c.Data["json"] = products
|
c.Data["json"] = products
|
||||||
@@ -78,12 +79,14 @@ func (c *ApiController) GetProduct() {
|
|||||||
|
|
||||||
product, err := object.GetProduct(id)
|
product, err := object.GetProduct(id)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
panic(err)
|
c.ResponseError(err.Error())
|
||||||
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
err = object.ExtendProductWithProviders(product)
|
err = object.ExtendProductWithProviders(product)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
panic(err)
|
c.ResponseError(err.Error())
|
||||||
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
c.Data["json"] = product
|
c.Data["json"] = product
|
||||||
|
@@ -46,7 +46,8 @@ func (c *ApiController) GetProviders() {
|
|||||||
if limit == "" || page == "" {
|
if limit == "" || page == "" {
|
||||||
providers, err := object.GetProviders(owner)
|
providers, err := object.GetProviders(owner)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
panic(err)
|
c.ResponseError(err.Error())
|
||||||
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
c.ResponseOk(object.GetMaskedProviders(providers, isMaskEnabled))
|
c.ResponseOk(object.GetMaskedProviders(providers, isMaskEnabled))
|
||||||
@@ -92,7 +93,8 @@ func (c *ApiController) GetGlobalProviders() {
|
|||||||
if limit == "" || page == "" {
|
if limit == "" || page == "" {
|
||||||
globalProviders, err := object.GetGlobalProviders()
|
globalProviders, err := object.GetGlobalProviders()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
panic(err)
|
c.ResponseError(err.Error())
|
||||||
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
c.ResponseOk(object.GetMaskedProviders(globalProviders, isMaskEnabled))
|
c.ResponseOk(object.GetMaskedProviders(globalProviders, isMaskEnabled))
|
||||||
|
@@ -42,17 +42,22 @@ func (c *ApiController) GetRecords() {
|
|||||||
value := c.Input().Get("value")
|
value := c.Input().Get("value")
|
||||||
sortField := c.Input().Get("sortField")
|
sortField := c.Input().Get("sortField")
|
||||||
sortOrder := c.Input().Get("sortOrder")
|
sortOrder := c.Input().Get("sortOrder")
|
||||||
|
organizationName := c.Input().Get("organizationName")
|
||||||
|
|
||||||
if limit == "" || page == "" {
|
if limit == "" || page == "" {
|
||||||
records, err := object.GetRecords()
|
records, err := object.GetRecords()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
panic(err)
|
c.ResponseError(err.Error())
|
||||||
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
c.Data["json"] = records
|
c.Data["json"] = records
|
||||||
c.ServeJSON()
|
c.ServeJSON()
|
||||||
} else {
|
} else {
|
||||||
limit := util.ParseInt(limit)
|
limit := util.ParseInt(limit)
|
||||||
|
if c.IsGlobalAdmin() && organizationName != "" {
|
||||||
|
organization = organizationName
|
||||||
|
}
|
||||||
filterRecord := &object.Record{Organization: organization}
|
filterRecord := &object.Record{Organization: organization}
|
||||||
count, err := object.GetRecordCount(field, value, filterRecord)
|
count, err := object.GetRecordCount(field, value, filterRecord)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@@ -84,12 +89,14 @@ func (c *ApiController) GetRecordsByFilter() {
|
|||||||
record := &object.Record{}
|
record := &object.Record{}
|
||||||
err := util.JsonToStruct(body, record)
|
err := util.JsonToStruct(body, record)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
panic(err)
|
c.ResponseError(err.Error())
|
||||||
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
records, err := object.GetRecordsByField(record)
|
records, err := object.GetRecordsByField(record)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
panic(err)
|
c.ResponseError(err.Error())
|
||||||
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
c.Data["json"] = records
|
c.Data["json"] = records
|
||||||
|
@@ -53,7 +53,8 @@ func (c *ApiController) GetResources() {
|
|||||||
if limit == "" || page == "" {
|
if limit == "" || page == "" {
|
||||||
resources, err := object.GetResources(owner, user)
|
resources, err := object.GetResources(owner, user)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
panic(err)
|
c.ResponseError(err.Error())
|
||||||
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
c.Data["json"] = resources
|
c.Data["json"] = resources
|
||||||
@@ -86,7 +87,8 @@ func (c *ApiController) GetResource() {
|
|||||||
|
|
||||||
resource, err := object.GetResource(id)
|
resource, err := object.GetResource(id)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
panic(err)
|
c.ResponseError(err.Error())
|
||||||
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
c.Data["json"] = resource
|
c.Data["json"] = resource
|
||||||
|
@@ -41,7 +41,8 @@ func (c *ApiController) GetRoles() {
|
|||||||
if limit == "" || page == "" {
|
if limit == "" || page == "" {
|
||||||
roles, err := object.GetRoles(owner)
|
roles, err := object.GetRoles(owner)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
panic(err)
|
c.ResponseError(err.Error())
|
||||||
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
c.Data["json"] = roles
|
c.Data["json"] = roles
|
||||||
@@ -77,7 +78,8 @@ func (c *ApiController) GetRole() {
|
|||||||
|
|
||||||
role, err := object.GetRole(id)
|
role, err := object.GetRole(id)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
panic(err)
|
c.ResponseError(err.Error())
|
||||||
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
c.Data["json"] = role
|
c.Data["json"] = role
|
||||||
|
@@ -41,7 +41,8 @@ func (c *ApiController) GetSessions() {
|
|||||||
if limit == "" || page == "" {
|
if limit == "" || page == "" {
|
||||||
sessions, err := object.GetSessions(owner)
|
sessions, err := object.GetSessions(owner)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
panic(err)
|
c.ResponseError(err.Error())
|
||||||
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
c.Data["json"] = sessions
|
c.Data["json"] = sessions
|
||||||
@@ -76,7 +77,8 @@ func (c *ApiController) GetSingleSession() {
|
|||||||
|
|
||||||
session, err := object.GetSingleSession(id)
|
session, err := object.GetSingleSession(id)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
panic(err)
|
c.ResponseError(err.Error())
|
||||||
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
c.Data["json"] = session
|
c.Data["json"] = session
|
||||||
@@ -155,7 +157,8 @@ func (c *ApiController) IsSessionDuplicated() {
|
|||||||
|
|
||||||
isUserSessionDuplicated, err := object.IsSessionDuplicated(id, sessionId)
|
isUserSessionDuplicated, err := object.IsSessionDuplicated(id, sessionId)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
panic(err)
|
c.ResponseError(err.Error())
|
||||||
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
c.Data["json"] = &Response{Status: "ok", Msg: "", Data: isUserSessionDuplicated}
|
c.Data["json"] = &Response{Status: "ok", Msg: "", Data: isUserSessionDuplicated}
|
||||||
|
@@ -41,7 +41,8 @@ func (c *ApiController) GetSubscriptions() {
|
|||||||
if limit == "" || page == "" {
|
if limit == "" || page == "" {
|
||||||
subscriptions, err := object.GetSubscriptions(owner)
|
subscriptions, err := object.GetSubscriptions(owner)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
panic(err)
|
c.ResponseError(err.Error())
|
||||||
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
c.Data["json"] = subscriptions
|
c.Data["json"] = subscriptions
|
||||||
@@ -70,14 +71,15 @@ func (c *ApiController) GetSubscriptions() {
|
|||||||
// @Tag Subscription API
|
// @Tag Subscription API
|
||||||
// @Description get subscription
|
// @Description get subscription
|
||||||
// @Param id query string true "The id ( owner/name ) of the subscription"
|
// @Param id query string true "The id ( owner/name ) of the subscription"
|
||||||
// @Success 200 {object} object.subscription The Response object
|
// @Success 200 {object} object.Subscription The Response object
|
||||||
// @router /get-subscription [get]
|
// @router /get-subscription [get]
|
||||||
func (c *ApiController) GetSubscription() {
|
func (c *ApiController) GetSubscription() {
|
||||||
id := c.Input().Get("id")
|
id := c.Input().Get("id")
|
||||||
|
|
||||||
subscription, err := object.GetSubscription(id)
|
subscription, err := object.GetSubscription(id)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
panic(err)
|
c.ResponseError(err.Error())
|
||||||
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
c.Data["json"] = subscription
|
c.Data["json"] = subscription
|
||||||
|
@@ -42,7 +42,8 @@ func (c *ApiController) GetSyncers() {
|
|||||||
if limit == "" || page == "" {
|
if limit == "" || page == "" {
|
||||||
organizationSyncers, err := object.GetOrganizationSyncers(owner, organization)
|
organizationSyncers, err := object.GetOrganizationSyncers(owner, organization)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
panic(err)
|
c.ResponseError(err.Error())
|
||||||
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
c.Data["json"] = organizationSyncers
|
c.Data["json"] = organizationSyncers
|
||||||
@@ -78,7 +79,8 @@ func (c *ApiController) GetSyncer() {
|
|||||||
|
|
||||||
syncer, err := object.GetSyncer(id)
|
syncer, err := object.GetSyncer(id)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
panic(err)
|
c.ResponseError(err.Error())
|
||||||
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
c.Data["json"] = syncer
|
c.Data["json"] = syncer
|
||||||
|
@@ -43,7 +43,8 @@ func (c *ApiController) GetTokens() {
|
|||||||
if limit == "" || page == "" {
|
if limit == "" || page == "" {
|
||||||
token, err := object.GetTokens(owner, organization)
|
token, err := object.GetTokens(owner, organization)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
panic(err)
|
c.ResponseError(err.Error())
|
||||||
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
c.Data["json"] = token
|
c.Data["json"] = token
|
||||||
@@ -78,7 +79,8 @@ func (c *ApiController) GetToken() {
|
|||||||
id := c.Input().Get("id")
|
id := c.Input().Get("id")
|
||||||
token, err := object.GetToken(id)
|
token, err := object.GetToken(id)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
panic(err)
|
c.ResponseError(err.Error())
|
||||||
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
c.Data["json"] = token
|
c.Data["json"] = token
|
||||||
@@ -193,7 +195,8 @@ func (c *ApiController) GetOAuthToken() {
|
|||||||
host := c.Ctx.Request.Host
|
host := c.Ctx.Request.Host
|
||||||
oAuthtoken, err := object.GetOAuthToken(grantType, clientId, clientSecret, code, verifier, scope, username, password, host, refreshToken, tag, avatar, c.GetAcceptLanguage())
|
oAuthtoken, err := object.GetOAuthToken(grantType, clientId, clientSecret, code, verifier, scope, username, password, host, refreshToken, tag, avatar, c.GetAcceptLanguage())
|
||||||
if err != nil {
|
if err != nil {
|
||||||
panic(err)
|
c.ResponseError(err.Error())
|
||||||
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
c.Data["json"] = oAuthtoken
|
c.Data["json"] = oAuthtoken
|
||||||
@@ -236,7 +239,8 @@ func (c *ApiController) RefreshToken() {
|
|||||||
|
|
||||||
refreshToken2, err := object.RefreshToken(grantType, refreshToken, scope, clientId, clientSecret, host)
|
refreshToken2, err := object.RefreshToken(grantType, refreshToken, scope, clientId, clientSecret, host)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
panic(err)
|
c.ResponseError(err.Error())
|
||||||
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
c.Data["json"] = refreshToken2
|
c.Data["json"] = refreshToken2
|
||||||
@@ -276,7 +280,8 @@ func (c *ApiController) IntrospectToken() {
|
|||||||
}
|
}
|
||||||
application, err := object.GetApplicationByClientId(clientId)
|
application, err := object.GetApplicationByClientId(clientId)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
panic(err)
|
c.ResponseError(err.Error())
|
||||||
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
if application == nil || application.ClientSecret != clientSecret {
|
if application == nil || application.ClientSecret != clientSecret {
|
||||||
@@ -289,7 +294,8 @@ func (c *ApiController) IntrospectToken() {
|
|||||||
}
|
}
|
||||||
token, err := object.GetTokenByTokenAndApplication(tokenValue, application.Name)
|
token, err := object.GetTokenByTokenAndApplication(tokenValue, application.Name)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
panic(err)
|
c.ResponseError(err.Error())
|
||||||
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
if token == nil {
|
if token == nil {
|
||||||
@@ -319,7 +325,7 @@ func (c *ApiController) IntrospectToken() {
|
|||||||
Sub: jwtToken.Subject,
|
Sub: jwtToken.Subject,
|
||||||
Aud: jwtToken.Audience,
|
Aud: jwtToken.Audience,
|
||||||
Iss: jwtToken.Issuer,
|
Iss: jwtToken.Issuer,
|
||||||
Jti: jwtToken.Id,
|
Jti: jwtToken.ID,
|
||||||
}
|
}
|
||||||
c.ServeJSON()
|
c.ServeJSON()
|
||||||
}
|
}
|
||||||
|
@@ -41,7 +41,8 @@ func (c *ApiController) GetGlobalUsers() {
|
|||||||
if limit == "" || page == "" {
|
if limit == "" || page == "" {
|
||||||
maskedUsers, err := object.GetMaskedUsers(object.GetGlobalUsers())
|
maskedUsers, err := object.GetMaskedUsers(object.GetGlobalUsers())
|
||||||
if err != nil {
|
if err != nil {
|
||||||
panic(err)
|
c.ResponseError(err.Error())
|
||||||
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
c.Data["json"] = maskedUsers
|
c.Data["json"] = maskedUsers
|
||||||
@@ -101,7 +102,8 @@ func (c *ApiController) GetUsers() {
|
|||||||
|
|
||||||
maskedUsers, err := object.GetMaskedUsers(object.GetUsers(owner))
|
maskedUsers, err := object.GetMaskedUsers(object.GetUsers(owner))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
panic(err)
|
c.ResponseError(err.Error())
|
||||||
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
c.Data["json"] = maskedUsers
|
c.Data["json"] = maskedUsers
|
||||||
@@ -153,7 +155,8 @@ func (c *ApiController) GetUser() {
|
|||||||
if userId != "" && owner != "" {
|
if userId != "" && owner != "" {
|
||||||
userFromUserId, err = object.GetUserByUserId(owner, userId)
|
userFromUserId, err = object.GetUserByUserId(owner, userId)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
panic(err)
|
c.ResponseError(err.Error())
|
||||||
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
id = util.GetId(userFromUserId.Owner, userFromUserId.Name)
|
id = util.GetId(userFromUserId.Owner, userFromUserId.Name)
|
||||||
@@ -165,7 +168,8 @@ func (c *ApiController) GetUser() {
|
|||||||
|
|
||||||
organization, err := object.GetOrganization(util.GetId("admin", owner))
|
organization, err := object.GetOrganization(util.GetId("admin", owner))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
panic(err)
|
c.ResponseError(err.Error())
|
||||||
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
if !organization.IsProfilePublic {
|
if !organization.IsProfilePublic {
|
||||||
@@ -190,18 +194,21 @@ func (c *ApiController) GetUser() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
panic(err)
|
c.ResponseError(err.Error())
|
||||||
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
user.MultiFactorAuths = object.GetAllMfaProps(user, true)
|
user.MultiFactorAuths = object.GetAllMfaProps(user, true)
|
||||||
err = object.ExtendUserWithRolesAndPermissions(user)
|
err = object.ExtendUserWithRolesAndPermissions(user)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
panic(err)
|
c.ResponseError(err.Error())
|
||||||
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
maskedUser, err := object.GetMaskedUser(user)
|
maskedUser, err := object.GetMaskedUser(user)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
panic(err)
|
c.ResponseError(err.Error())
|
||||||
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
c.Data["json"] = maskedUser
|
c.Data["json"] = maskedUser
|
||||||
@@ -498,7 +505,8 @@ func (c *ApiController) GetSortedUsers() {
|
|||||||
|
|
||||||
maskedUsers, err := object.GetMaskedUsers(object.GetSortedUsers(owner, sorter, limit))
|
maskedUsers, err := object.GetMaskedUsers(object.GetSortedUsers(owner, sorter, limit))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
panic(err)
|
c.ResponseError(err.Error())
|
||||||
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
c.Data["json"] = maskedUsers
|
c.Data["json"] = maskedUsers
|
||||||
|
@@ -97,7 +97,8 @@ func (c *ApiController) RequireSignedInUser() (*object.User, bool) {
|
|||||||
|
|
||||||
user, err := object.GetUser(userId)
|
user, err := object.GetUser(userId)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
panic(err)
|
c.ResponseError(err.Error())
|
||||||
|
return nil, false
|
||||||
}
|
}
|
||||||
|
|
||||||
if user == nil {
|
if user == nil {
|
||||||
|
@@ -66,7 +66,7 @@ func (c *ApiController) WebAuthnSignupBegin() {
|
|||||||
// @Tag User API
|
// @Tag User API
|
||||||
// @Description WebAuthn Registration Flow 2nd stage
|
// @Description WebAuthn Registration Flow 2nd stage
|
||||||
// @Param body body protocol.CredentialCreationResponse true "authenticator attestation Response"
|
// @Param body body protocol.CredentialCreationResponse true "authenticator attestation Response"
|
||||||
// @Success 200 {object} Response "The Response object"
|
// @Success 200 {object} controllers.Response "The Response object"
|
||||||
// @router /webauthn/signup/finish [post]
|
// @router /webauthn/signup/finish [post]
|
||||||
func (c *ApiController) WebAuthnSignupFinish() {
|
func (c *ApiController) WebAuthnSignupFinish() {
|
||||||
webauthnObj, err := object.GetWebAuthnObject(c.Ctx.Request.Host)
|
webauthnObj, err := object.GetWebAuthnObject(c.Ctx.Request.Host)
|
||||||
@@ -150,7 +150,7 @@ func (c *ApiController) WebAuthnSigninBegin() {
|
|||||||
// @Tag Login API
|
// @Tag Login API
|
||||||
// @Description WebAuthn Login Flow 2nd stage
|
// @Description WebAuthn Login Flow 2nd stage
|
||||||
// @Param body body protocol.CredentialAssertionResponse true "authenticator assertion Response"
|
// @Param body body protocol.CredentialAssertionResponse true "authenticator assertion Response"
|
||||||
// @Success 200 {object} Response "The Response object"
|
// @Success 200 {object} controllers.Response "The Response object"
|
||||||
// @router /webauthn/signin/finish [post]
|
// @router /webauthn/signin/finish [post]
|
||||||
func (c *ApiController) WebAuthnSigninFinish() {
|
func (c *ApiController) WebAuthnSigninFinish() {
|
||||||
responseType := c.Input().Get("responseType")
|
responseType := c.Input().Get("responseType")
|
||||||
|
@@ -42,7 +42,8 @@ func (c *ApiController) GetWebhooks() {
|
|||||||
if limit == "" || page == "" {
|
if limit == "" || page == "" {
|
||||||
webhooks, err := object.GetWebhooks(owner, organization)
|
webhooks, err := object.GetWebhooks(owner, organization)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
panic(err)
|
c.ResponseError(err.Error())
|
||||||
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
c.Data["json"] = webhooks
|
c.Data["json"] = webhooks
|
||||||
@@ -79,7 +80,8 @@ func (c *ApiController) GetWebhook() {
|
|||||||
|
|
||||||
webhook, err := object.GetWebhook(id)
|
webhook, err := object.GetWebhook(id)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
panic(err)
|
c.ResponseError(err.Error())
|
||||||
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
c.Data["json"] = webhook
|
c.Data["json"] = webhook
|
||||||
|
2
go.mod
2
go.mod
@@ -49,7 +49,7 @@ require (
|
|||||||
github.com/robfig/cron/v3 v3.0.1
|
github.com/robfig/cron/v3 v3.0.1
|
||||||
github.com/russellhaering/gosaml2 v0.9.0
|
github.com/russellhaering/gosaml2 v0.9.0
|
||||||
github.com/russellhaering/goxmldsig v1.2.0
|
github.com/russellhaering/goxmldsig v1.2.0
|
||||||
github.com/sashabaranov/go-openai v1.9.1
|
github.com/sashabaranov/go-openai v1.12.0
|
||||||
github.com/satori/go.uuid v1.2.0
|
github.com/satori/go.uuid v1.2.0
|
||||||
github.com/shiena/ansicolor v0.0.0-20200904210342-c7312218db18 // indirect
|
github.com/shiena/ansicolor v0.0.0-20200904210342-c7312218db18 // indirect
|
||||||
github.com/shirou/gopsutil v3.21.11+incompatible
|
github.com/shirou/gopsutil v3.21.11+incompatible
|
||||||
|
2
go.sum
2
go.sum
@@ -548,6 +548,8 @@ github.com/russross/blackfriday v1.5.2/go.mod h1:JO/DiYxRf+HjHt06OyowR9PTA263kcR
|
|||||||
github.com/russross/blackfriday/v2 v2.0.1/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM=
|
github.com/russross/blackfriday/v2 v2.0.1/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM=
|
||||||
github.com/sashabaranov/go-openai v1.9.1 h1:3N52HkJKo9Zlo/oe1AVv5ZkCOny0ra58/ACvAxkN3MM=
|
github.com/sashabaranov/go-openai v1.9.1 h1:3N52HkJKo9Zlo/oe1AVv5ZkCOny0ra58/ACvAxkN3MM=
|
||||||
github.com/sashabaranov/go-openai v1.9.1/go.mod h1:lj5b/K+zjTSFxVLijLSTDZuP7adOgerWeFyZLUhAKRg=
|
github.com/sashabaranov/go-openai v1.9.1/go.mod h1:lj5b/K+zjTSFxVLijLSTDZuP7adOgerWeFyZLUhAKRg=
|
||||||
|
github.com/sashabaranov/go-openai v1.12.0 h1:aRNHH0gtVfrpIaEolD0sWrLLRnYQNK4cH/bIAHwL8Rk=
|
||||||
|
github.com/sashabaranov/go-openai v1.12.0/go.mod h1:lj5b/K+zjTSFxVLijLSTDZuP7adOgerWeFyZLUhAKRg=
|
||||||
github.com/satori/go.uuid v1.2.0 h1:0uYX9dsZ2yD7q2RtLRtPSdGDWzjeM3TbMJP9utgA0ww=
|
github.com/satori/go.uuid v1.2.0 h1:0uYX9dsZ2yD7q2RtLRtPSdGDWzjeM3TbMJP9utgA0ww=
|
||||||
github.com/satori/go.uuid v1.2.0/go.mod h1:dA0hQrYB0VpLJoorglMZABFdXlWrHn1NEOzdhQKdks0=
|
github.com/satori/go.uuid v1.2.0/go.mod h1:dA0hQrYB0VpLJoorglMZABFdXlWrHn1NEOzdhQKdks0=
|
||||||
github.com/sergi/go-diff v1.1.0 h1:we8PVUC3FE2uYfodKH/nBHMSetSfHDR6scGdBi+erh0=
|
github.com/sergi/go-diff v1.1.0 h1:we8PVUC3FE2uYfodKH/nBHMSetSfHDR6scGdBi+erh0=
|
||||||
|
@@ -18,7 +18,8 @@
|
|||||||
"The login method: login with password is not enabled for the application": "Die Anmeldeart \"Anmeldung mit Passwort\" ist für die Anwendung nicht aktiviert",
|
"The login method: login with password is not enabled for the application": "Die Anmeldeart \"Anmeldung mit Passwort\" ist für die Anwendung nicht aktiviert",
|
||||||
"The provider: %s is not enabled for the application": "Der Anbieter: %s ist nicht für die Anwendung aktiviert",
|
"The provider: %s is not enabled for the application": "Der Anbieter: %s ist nicht für die Anwendung aktiviert",
|
||||||
"Unauthorized operation": "Nicht autorisierte Operation",
|
"Unauthorized operation": "Nicht autorisierte Operation",
|
||||||
"Unknown authentication type (not password or provider), form = %s": "Unbekannter Authentifizierungstyp (nicht Passwort oder Anbieter), Formular = %s"
|
"Unknown authentication type (not password or provider), form = %s": "Unbekannter Authentifizierungstyp (nicht Passwort oder Anbieter), Formular = %s",
|
||||||
|
"User's tag: %s is not listed in the application's tags": "User's tag: %s is not listed in the application's tags"
|
||||||
},
|
},
|
||||||
"cas": {
|
"cas": {
|
||||||
"Service %s and %s do not match": "Service %s und %s stimmen nicht überein"
|
"Service %s and %s do not match": "Service %s und %s stimmen nicht überein"
|
||||||
|
@@ -18,7 +18,8 @@
|
|||||||
"The login method: login with password is not enabled for the application": "The login method: login with password is not enabled for the application",
|
"The login method: login with password is not enabled for the application": "The login method: login with password is not enabled for the application",
|
||||||
"The provider: %s is not enabled for the application": "The provider: %s is not enabled for the application",
|
"The provider: %s is not enabled for the application": "The provider: %s is not enabled for the application",
|
||||||
"Unauthorized operation": "Unauthorized operation",
|
"Unauthorized operation": "Unauthorized operation",
|
||||||
"Unknown authentication type (not password or provider), form = %s": "Unknown authentication type (not password or provider), form = %s"
|
"Unknown authentication type (not password or provider), form = %s": "Unknown authentication type (not password or provider), form = %s",
|
||||||
|
"User's tag: %s is not listed in the application's tags": "User's tag: %s is not listed in the application's tags"
|
||||||
},
|
},
|
||||||
"cas": {
|
"cas": {
|
||||||
"Service %s and %s do not match": "Service %s and %s do not match"
|
"Service %s and %s do not match": "Service %s and %s do not match"
|
||||||
|
@@ -18,7 +18,8 @@
|
|||||||
"The login method: login with password is not enabled for the application": "El método de inicio de sesión: inicio de sesión con contraseña no está habilitado para la aplicación",
|
"The login method: login with password is not enabled for the application": "El método de inicio de sesión: inicio de sesión con contraseña no está habilitado para la aplicación",
|
||||||
"The provider: %s is not enabled for the application": "El proveedor: %s no está habilitado para la aplicación",
|
"The provider: %s is not enabled for the application": "El proveedor: %s no está habilitado para la aplicación",
|
||||||
"Unauthorized operation": "Operación no autorizada",
|
"Unauthorized operation": "Operación no autorizada",
|
||||||
"Unknown authentication type (not password or provider), form = %s": "Tipo de autenticación desconocido (no es contraseña o proveedor), formulario = %s"
|
"Unknown authentication type (not password or provider), form = %s": "Tipo de autenticación desconocido (no es contraseña o proveedor), formulario = %s",
|
||||||
|
"User's tag: %s is not listed in the application's tags": "User's tag: %s is not listed in the application's tags"
|
||||||
},
|
},
|
||||||
"cas": {
|
"cas": {
|
||||||
"Service %s and %s do not match": "Los servicios %s y %s no coinciden"
|
"Service %s and %s do not match": "Los servicios %s y %s no coinciden"
|
||||||
|
@@ -18,7 +18,8 @@
|
|||||||
"The login method: login with password is not enabled for the application": "La méthode de connexion : connexion avec mot de passe n'est pas activée pour l'application",
|
"The login method: login with password is not enabled for the application": "La méthode de connexion : connexion avec mot de passe n'est pas activée pour l'application",
|
||||||
"The provider: %s is not enabled for the application": "Le fournisseur :%s n'est pas activé pour l'application",
|
"The provider: %s is not enabled for the application": "Le fournisseur :%s n'est pas activé pour l'application",
|
||||||
"Unauthorized operation": "Opération non autorisée",
|
"Unauthorized operation": "Opération non autorisée",
|
||||||
"Unknown authentication type (not password or provider), form = %s": "Type d'authentification inconnu (pas de mot de passe ou de fournisseur), formulaire = %s"
|
"Unknown authentication type (not password or provider), form = %s": "Type d'authentification inconnu (pas de mot de passe ou de fournisseur), formulaire = %s",
|
||||||
|
"User's tag: %s is not listed in the application's tags": "User's tag: %s is not listed in the application's tags"
|
||||||
},
|
},
|
||||||
"cas": {
|
"cas": {
|
||||||
"Service %s and %s do not match": "Les services %s et %s ne correspondent pas"
|
"Service %s and %s do not match": "Les services %s et %s ne correspondent pas"
|
||||||
|
@@ -18,7 +18,8 @@
|
|||||||
"The login method: login with password is not enabled for the application": "Metode login: login dengan kata sandi tidak diaktifkan untuk aplikasi tersebut",
|
"The login method: login with password is not enabled for the application": "Metode login: login dengan kata sandi tidak diaktifkan untuk aplikasi tersebut",
|
||||||
"The provider: %s is not enabled for the application": "Penyedia: %s tidak diaktifkan untuk aplikasi ini",
|
"The provider: %s is not enabled for the application": "Penyedia: %s tidak diaktifkan untuk aplikasi ini",
|
||||||
"Unauthorized operation": "Operasi tidak sah",
|
"Unauthorized operation": "Operasi tidak sah",
|
||||||
"Unknown authentication type (not password or provider), form = %s": "Jenis otentikasi tidak diketahui (bukan kata sandi atau pemberi), formulir = %s"
|
"Unknown authentication type (not password or provider), form = %s": "Jenis otentikasi tidak diketahui (bukan kata sandi atau pemberi), formulir = %s",
|
||||||
|
"User's tag: %s is not listed in the application's tags": "User's tag: %s is not listed in the application's tags"
|
||||||
},
|
},
|
||||||
"cas": {
|
"cas": {
|
||||||
"Service %s and %s do not match": "Layanan %s dan %s tidak cocok"
|
"Service %s and %s do not match": "Layanan %s dan %s tidak cocok"
|
||||||
|
@@ -18,7 +18,8 @@
|
|||||||
"The login method: login with password is not enabled for the application": "ログイン方法:パスワードでのログインはアプリケーションで有効になっていません",
|
"The login method: login with password is not enabled for the application": "ログイン方法:パスワードでのログインはアプリケーションで有効になっていません",
|
||||||
"The provider: %s is not enabled for the application": "プロバイダー:%sはアプリケーションでは有効化されていません",
|
"The provider: %s is not enabled for the application": "プロバイダー:%sはアプリケーションでは有効化されていません",
|
||||||
"Unauthorized operation": "不正操作",
|
"Unauthorized operation": "不正操作",
|
||||||
"Unknown authentication type (not password or provider), form = %s": "不明な認証タイプ(パスワードまたはプロバイダーではない)フォーム=%s"
|
"Unknown authentication type (not password or provider), form = %s": "不明な認証タイプ(パスワードまたはプロバイダーではない)フォーム=%s",
|
||||||
|
"User's tag: %s is not listed in the application's tags": "User's tag: %s is not listed in the application's tags"
|
||||||
},
|
},
|
||||||
"cas": {
|
"cas": {
|
||||||
"Service %s and %s do not match": "サービス%sと%sは一致しません"
|
"Service %s and %s do not match": "サービス%sと%sは一致しません"
|
||||||
|
@@ -18,7 +18,8 @@
|
|||||||
"The login method: login with password is not enabled for the application": "어플리케이션에서는 암호를 사용한 로그인 방법이 활성화되어 있지 않습니다",
|
"The login method: login with password is not enabled for the application": "어플리케이션에서는 암호를 사용한 로그인 방법이 활성화되어 있지 않습니다",
|
||||||
"The provider: %s is not enabled for the application": "제공자 %s은(는) 응용 프로그램에서 활성화되어 있지 않습니다",
|
"The provider: %s is not enabled for the application": "제공자 %s은(는) 응용 프로그램에서 활성화되어 있지 않습니다",
|
||||||
"Unauthorized operation": "무단 조작",
|
"Unauthorized operation": "무단 조작",
|
||||||
"Unknown authentication type (not password or provider), form = %s": "알 수 없는 인증 유형(암호 또는 공급자가 아님), 폼 = %s"
|
"Unknown authentication type (not password or provider), form = %s": "알 수 없는 인증 유형(암호 또는 공급자가 아님), 폼 = %s",
|
||||||
|
"User's tag: %s is not listed in the application's tags": "User's tag: %s is not listed in the application's tags"
|
||||||
},
|
},
|
||||||
"cas": {
|
"cas": {
|
||||||
"Service %s and %s do not match": "서비스 %s와 %s는 일치하지 않습니다"
|
"Service %s and %s do not match": "서비스 %s와 %s는 일치하지 않습니다"
|
||||||
|
@@ -18,7 +18,8 @@
|
|||||||
"The login method: login with password is not enabled for the application": "The login method: login with password is not enabled for the application",
|
"The login method: login with password is not enabled for the application": "The login method: login with password is not enabled for the application",
|
||||||
"The provider: %s is not enabled for the application": "The provider: %s is not enabled for the application",
|
"The provider: %s is not enabled for the application": "The provider: %s is not enabled for the application",
|
||||||
"Unauthorized operation": "Unauthorized operation",
|
"Unauthorized operation": "Unauthorized operation",
|
||||||
"Unknown authentication type (not password or provider), form = %s": "Unknown authentication type (not password or provider), form = %s"
|
"Unknown authentication type (not password or provider), form = %s": "Unknown authentication type (not password or provider), form = %s",
|
||||||
|
"User's tag: %s is not listed in the application's tags": "User's tag: %s is not listed in the application's tags"
|
||||||
},
|
},
|
||||||
"cas": {
|
"cas": {
|
||||||
"Service %s and %s do not match": "Service %s and %s do not match"
|
"Service %s and %s do not match": "Service %s and %s do not match"
|
||||||
|
@@ -18,7 +18,8 @@
|
|||||||
"The login method: login with password is not enabled for the application": "Метод входа: вход с паролем не включен для приложения",
|
"The login method: login with password is not enabled for the application": "Метод входа: вход с паролем не включен для приложения",
|
||||||
"The provider: %s is not enabled for the application": "Провайдер: %s не включен для приложения",
|
"The provider: %s is not enabled for the application": "Провайдер: %s не включен для приложения",
|
||||||
"Unauthorized operation": "Несанкционированная операция",
|
"Unauthorized operation": "Несанкционированная операция",
|
||||||
"Unknown authentication type (not password or provider), form = %s": "Неизвестный тип аутентификации (не пароль и не провайдер), форма = %s"
|
"Unknown authentication type (not password or provider), form = %s": "Неизвестный тип аутентификации (не пароль и не провайдер), форма = %s",
|
||||||
|
"User's tag: %s is not listed in the application's tags": "User's tag: %s is not listed in the application's tags"
|
||||||
},
|
},
|
||||||
"cas": {
|
"cas": {
|
||||||
"Service %s and %s do not match": "Сервисы %s и %s не совпадают"
|
"Service %s and %s do not match": "Сервисы %s и %s не совпадают"
|
||||||
|
@@ -18,7 +18,8 @@
|
|||||||
"The login method: login with password is not enabled for the application": "Phương thức đăng nhập: đăng nhập bằng mật khẩu không được kích hoạt cho ứng dụng",
|
"The login method: login with password is not enabled for the application": "Phương thức đăng nhập: đăng nhập bằng mật khẩu không được kích hoạt cho ứng dụng",
|
||||||
"The provider: %s is not enabled for the application": "Nhà cung cấp: %s không được kích hoạt cho ứng dụng",
|
"The provider: %s is not enabled for the application": "Nhà cung cấp: %s không được kích hoạt cho ứng dụng",
|
||||||
"Unauthorized operation": "Hoạt động không được ủy quyền",
|
"Unauthorized operation": "Hoạt động không được ủy quyền",
|
||||||
"Unknown authentication type (not password or provider), form = %s": "Loại xác thực không xác định (không phải mật khẩu hoặc nhà cung cấp), biểu mẫu = %s"
|
"Unknown authentication type (not password or provider), form = %s": "Loại xác thực không xác định (không phải mật khẩu hoặc nhà cung cấp), biểu mẫu = %s",
|
||||||
|
"User's tag: %s is not listed in the application's tags": "User's tag: %s is not listed in the application's tags"
|
||||||
},
|
},
|
||||||
"cas": {
|
"cas": {
|
||||||
"Service %s and %s do not match": "Dịch sang tiếng Việt: Dịch vụ %s và %s không khớp"
|
"Service %s and %s do not match": "Dịch sang tiếng Việt: Dịch vụ %s và %s không khớp"
|
||||||
|
@@ -18,7 +18,8 @@
|
|||||||
"The login method: login with password is not enabled for the application": "该应用禁止采用密码登录方式",
|
"The login method: login with password is not enabled for the application": "该应用禁止采用密码登录方式",
|
||||||
"The provider: %s is not enabled for the application": "该应用的提供商: %s未被启用",
|
"The provider: %s is not enabled for the application": "该应用的提供商: %s未被启用",
|
||||||
"Unauthorized operation": "未授权的操作",
|
"Unauthorized operation": "未授权的操作",
|
||||||
"Unknown authentication type (not password or provider), form = %s": "未知的认证类型(非密码或第三方提供商):%s"
|
"Unknown authentication type (not password or provider), form = %s": "未知的认证类型(非密码或第三方提供商):%s",
|
||||||
|
"User's tag: %s is not listed in the application's tags": "用户的标签: %s不在该应用的标签列表中"
|
||||||
},
|
},
|
||||||
"cas": {
|
"cas": {
|
||||||
"Service %s and %s do not match": "服务%s与%s不匹配"
|
"Service %s and %s do not match": "服务%s与%s不匹配"
|
||||||
|
@@ -198,12 +198,22 @@ func (idp *WeChatIdProvider) GetUserInfo(token *oauth2.Token) (*UserInfo, error)
|
|||||||
func GetWechatOfficialAccountAccessToken(clientId string, clientSecret string) (string, error) {
|
func GetWechatOfficialAccountAccessToken(clientId string, clientSecret string) (string, error) {
|
||||||
accessTokenUrl := fmt.Sprintf("https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid=%s&secret=%s", clientId, clientSecret)
|
accessTokenUrl := fmt.Sprintf("https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid=%s&secret=%s", clientId, clientSecret)
|
||||||
request, err := http.NewRequest("GET", accessTokenUrl, nil)
|
request, err := http.NewRequest("GET", accessTokenUrl, nil)
|
||||||
|
if err != nil {
|
||||||
|
return "", err
|
||||||
|
}
|
||||||
|
|
||||||
client := new(http.Client)
|
client := new(http.Client)
|
||||||
resp, err := client.Do(request)
|
resp, err := client.Do(request)
|
||||||
|
if err != nil {
|
||||||
|
return "", err
|
||||||
|
}
|
||||||
|
defer resp.Body.Close()
|
||||||
|
|
||||||
respBytes, err := ioutil.ReadAll(resp.Body)
|
respBytes, err := ioutil.ReadAll(resp.Body)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return "", err
|
return "", err
|
||||||
}
|
}
|
||||||
|
|
||||||
var data struct {
|
var data struct {
|
||||||
ExpireIn int `json:"expires_in"`
|
ExpireIn int `json:"expires_in"`
|
||||||
AccessToken string `json:"access_token"`
|
AccessToken string `json:"access_token"`
|
||||||
@@ -212,20 +222,30 @@ func GetWechatOfficialAccountAccessToken(clientId string, clientSecret string) (
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return "", err
|
return "", err
|
||||||
}
|
}
|
||||||
|
|
||||||
return data.AccessToken, nil
|
return data.AccessToken, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func GetWechatOfficialAccountQRCode(clientId string, clientSecret string) (string, error) {
|
func GetWechatOfficialAccountQRCode(clientId string, clientSecret string) (string, error) {
|
||||||
accessToken, err := GetWechatOfficialAccountAccessToken(clientId, clientSecret)
|
accessToken, err := GetWechatOfficialAccountAccessToken(clientId, clientSecret)
|
||||||
client := new(http.Client)
|
client := new(http.Client)
|
||||||
params := "{\"action_name\": \"QR_LIMIT_STR_SCENE\", \"action_info\": {\"scene\": {\"scene_str\": \"test\"}}}"
|
|
||||||
|
weChatEndpoint := "https://api.weixin.qq.com/cgi-bin/qrcode/create"
|
||||||
|
qrCodeUrl := fmt.Sprintf("%s?access_token=%s", weChatEndpoint, accessToken)
|
||||||
|
params := `{"action_name": "QR_LIMIT_STR_SCENE", "action_info": {"scene": {"scene_str": "test"}}}`
|
||||||
|
|
||||||
bodyData := bytes.NewReader([]byte(params))
|
bodyData := bytes.NewReader([]byte(params))
|
||||||
qrCodeUrl := fmt.Sprintf("https://api.weixin.qq.com/cgi-bin/qrcode/create?access_token=%s", accessToken)
|
|
||||||
requeset, err := http.NewRequest("POST", qrCodeUrl, bodyData)
|
requeset, err := http.NewRequest("POST", qrCodeUrl, bodyData)
|
||||||
|
if err != nil {
|
||||||
|
return "", err
|
||||||
|
}
|
||||||
|
|
||||||
resp, err := client.Do(requeset)
|
resp, err := client.Do(requeset)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return "", err
|
return "", err
|
||||||
}
|
}
|
||||||
|
defer resp.Body.Close()
|
||||||
|
|
||||||
respBytes, err := ioutil.ReadAll(resp.Body)
|
respBytes, err := ioutil.ReadAll(resp.Body)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return "", err
|
return "", err
|
||||||
|
@@ -275,7 +275,7 @@ func GetSession(owner string, offset, limit int, field, value, sortField, sortOr
|
|||||||
session = session.And("owner=?", owner)
|
session = session.And("owner=?", owner)
|
||||||
}
|
}
|
||||||
if field != "" && value != "" {
|
if field != "" && value != "" {
|
||||||
if filterField(field) {
|
if util.FilterField(field) {
|
||||||
session = session.And(fmt.Sprintf("%s like ?", util.SnakeString(field)), fmt.Sprintf("%%%s%%", value))
|
session = session.And(fmt.Sprintf("%s like ?", util.SnakeString(field)), fmt.Sprintf("%%%s%%", value))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -303,7 +303,7 @@ func GetSessionForUser(owner string, offset, limit int, field, value, sortField,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if field != "" && value != "" {
|
if field != "" && value != "" {
|
||||||
if filterField(field) {
|
if util.FilterField(field) {
|
||||||
if offset != -1 {
|
if offset != -1 {
|
||||||
field = fmt.Sprintf("a.%s", field)
|
field = fmt.Sprintf("a.%s", field)
|
||||||
}
|
}
|
||||||
|
@@ -57,6 +57,7 @@ type Application struct {
|
|||||||
SignupItems []*SignupItem `xorm:"varchar(1000)" json:"signupItems"`
|
SignupItems []*SignupItem `xorm:"varchar(1000)" json:"signupItems"`
|
||||||
GrantTypes []string `xorm:"varchar(1000)" json:"grantTypes"`
|
GrantTypes []string `xorm:"varchar(1000)" json:"grantTypes"`
|
||||||
OrganizationObj *Organization `xorm:"-" json:"organizationObj"`
|
OrganizationObj *Organization `xorm:"-" json:"organizationObj"`
|
||||||
|
Tags []string `xorm:"mediumtext" json:"tags"`
|
||||||
|
|
||||||
ClientId string `xorm:"varchar(100)" json:"clientId"`
|
ClientId string `xorm:"varchar(100)" json:"clientId"`
|
||||||
ClientSecret string `xorm:"varchar(100)" json:"clientSecret"`
|
ClientSecret string `xorm:"varchar(100)" json:"clientSecret"`
|
||||||
|
@@ -16,7 +16,6 @@ package object
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"regexp"
|
|
||||||
"strings"
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
"unicode"
|
"unicode"
|
||||||
@@ -28,21 +27,11 @@ import (
|
|||||||
goldap "github.com/go-ldap/ldap/v3"
|
goldap "github.com/go-ldap/ldap/v3"
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
|
||||||
reWhiteSpace *regexp.Regexp
|
|
||||||
reFieldWhiteList *regexp.Regexp
|
|
||||||
)
|
|
||||||
|
|
||||||
const (
|
const (
|
||||||
SigninWrongTimesLimit = 5
|
SigninWrongTimesLimit = 5
|
||||||
LastSignWrongTimeDuration = time.Minute * 15
|
LastSignWrongTimeDuration = time.Minute * 15
|
||||||
)
|
)
|
||||||
|
|
||||||
func init() {
|
|
||||||
reWhiteSpace, _ = regexp.Compile(`\s`)
|
|
||||||
reFieldWhiteList, _ = regexp.Compile(`^[A-Za-z0-9]+$`)
|
|
||||||
}
|
|
||||||
|
|
||||||
func CheckUserSignup(application *Application, organization *Organization, form *form.AuthForm, lang string) string {
|
func CheckUserSignup(application *Application, organization *Organization, form *form.AuthForm, lang string) string {
|
||||||
if organization == nil {
|
if organization == nil {
|
||||||
return i18n.Translate(lang, "check:Organization does not exist")
|
return i18n.Translate(lang, "check:Organization does not exist")
|
||||||
@@ -58,7 +47,7 @@ func CheckUserSignup(application *Application, organization *Organization, form
|
|||||||
if util.IsEmailValid(form.Username) {
|
if util.IsEmailValid(form.Username) {
|
||||||
return i18n.Translate(lang, "check:Username cannot be an email address")
|
return i18n.Translate(lang, "check:Username cannot be an email address")
|
||||||
}
|
}
|
||||||
if reWhiteSpace.MatchString(form.Username) {
|
if util.ReWhiteSpace.MatchString(form.Username) {
|
||||||
return i18n.Translate(lang, "check:Username cannot contain white spaces")
|
return i18n.Translate(lang, "check:Username cannot contain white spaces")
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -294,10 +283,6 @@ func CheckUserPassword(organization string, username string, password string, la
|
|||||||
return user, ""
|
return user, ""
|
||||||
}
|
}
|
||||||
|
|
||||||
func filterField(field string) bool {
|
|
||||||
return reFieldWhiteList.MatchString(field)
|
|
||||||
}
|
|
||||||
|
|
||||||
func CheckUserPermission(requestUserId, userId string, strict bool, lang string) (bool, error) {
|
func CheckUserPermission(requestUserId, userId string, strict bool, lang string) (bool, error) {
|
||||||
if requestUserId == "" {
|
if requestUserId == "" {
|
||||||
return false, fmt.Errorf(i18n.Translate(lang, "general:Please login first"))
|
return false, fmt.Errorf(i18n.Translate(lang, "general:Please login first"))
|
||||||
@@ -397,8 +382,8 @@ func CheckUsername(username string, lang string) string {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// https://stackoverflow.com/questions/58726546/github-username-convention-using-regex
|
// https://stackoverflow.com/questions/58726546/github-username-convention-using-regex
|
||||||
re, _ := regexp.Compile("^[a-zA-Z0-9]+((?:-[a-zA-Z0-9]+)|(?:_[a-zA-Z0-9]+))*$")
|
|
||||||
if !re.MatchString(username) {
|
if !util.ReUserName.MatchString(username) {
|
||||||
return i18n.Translate(lang, "check:The username may only contain alphanumeric characters, underlines or hyphens, cannot have consecutive hyphens or underlines, and cannot begin or end with a hyphen or underline.")
|
return i18n.Translate(lang, "check:The username may only contain alphanumeric characters, underlines or hyphens, cannot have consecutive hyphens or underlines, and cannot begin or end with a hyphen or underline.")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -184,6 +184,7 @@ func initBuiltInApplication() {
|
|||||||
{Name: "Phone", Visible: true, Required: true, Prompted: false, Rule: "None"},
|
{Name: "Phone", Visible: true, Required: true, Prompted: false, Rule: "None"},
|
||||||
{Name: "Agreement", Visible: true, Required: true, Prompted: false, Rule: "None"},
|
{Name: "Agreement", Visible: true, Required: true, Prompted: false, Rule: "None"},
|
||||||
},
|
},
|
||||||
|
Tags: []string{},
|
||||||
RedirectUris: []string{},
|
RedirectUris: []string{},
|
||||||
ExpireInHours: 168,
|
ExpireInHours: 168,
|
||||||
FormOffset: 2,
|
FormOffset: 2,
|
||||||
|
@@ -145,6 +145,9 @@ func readInitDataFromFile(filePath string) (*InitData, error) {
|
|||||||
if application.RedirectUris == nil {
|
if application.RedirectUris == nil {
|
||||||
application.RedirectUris = []string{}
|
application.RedirectUris = []string{}
|
||||||
}
|
}
|
||||||
|
if application.Tags == nil {
|
||||||
|
application.Tags = []string{}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
for _, permission := range data.Permissions {
|
for _, permission := range data.Permissions {
|
||||||
if permission.Actions == nil {
|
if permission.Actions == nil {
|
||||||
|
@@ -104,10 +104,15 @@ func GetOrganizationsByFields(owner string, fields ...string) ([]*Organization,
|
|||||||
return organizations, nil
|
return organizations, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func GetPaginationOrganizations(owner string, offset, limit int, field, value, sortField, sortOrder string) ([]*Organization, error) {
|
func GetPaginationOrganizations(owner string, name string, offset, limit int, field, value, sortField, sortOrder string) ([]*Organization, error) {
|
||||||
organizations := []*Organization{}
|
organizations := []*Organization{}
|
||||||
session := GetSession(owner, offset, limit, field, value, sortField, sortOrder)
|
session := GetSession(owner, offset, limit, field, value, sortField, sortOrder)
|
||||||
err := session.Find(&organizations)
|
var err error
|
||||||
|
if name != "" {
|
||||||
|
err = session.Find(&organizations, &Organization{Name: name})
|
||||||
|
} else {
|
||||||
|
err = session.Find(&organizations)
|
||||||
|
}
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
@@ -231,6 +236,10 @@ func DeleteOrganization(organization *Organization) (bool, error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func GetOrganizationByUser(user *User) (*Organization, error) {
|
func GetOrganizationByUser(user *User) (*Organization, error) {
|
||||||
|
if user == nil {
|
||||||
|
return nil, nil
|
||||||
|
}
|
||||||
|
|
||||||
return getOrganization("admin", user.Owner)
|
return getOrganization("admin", user.Owner)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -43,6 +43,34 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"/api/add-adapter": {
|
||||||
|
"post": {
|
||||||
|
"tags": [
|
||||||
|
"Adapter API"
|
||||||
|
],
|
||||||
|
"description": "add adapter",
|
||||||
|
"operationId": "ApiController.AddCasbinAdapter",
|
||||||
|
"parameters": [
|
||||||
|
{
|
||||||
|
"in": "body",
|
||||||
|
"name": "body",
|
||||||
|
"description": "The details of the adapter",
|
||||||
|
"required": true,
|
||||||
|
"schema": {
|
||||||
|
"$ref": "#/definitions/object.Adapter"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"responses": {
|
||||||
|
"200": {
|
||||||
|
"description": "The Response object",
|
||||||
|
"schema": {
|
||||||
|
"$ref": "#/definitions/controllers.Response"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
"/api/add-application": {
|
"/api/add-application": {
|
||||||
"post": {
|
"post": {
|
||||||
"tags": [
|
"tags": [
|
||||||
@@ -127,6 +155,34 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"/api/add-group": {
|
||||||
|
"post": {
|
||||||
|
"tags": [
|
||||||
|
"Group API"
|
||||||
|
],
|
||||||
|
"description": "add group",
|
||||||
|
"operationId": "ApiController.AddGroup",
|
||||||
|
"parameters": [
|
||||||
|
{
|
||||||
|
"in": "body",
|
||||||
|
"name": "body",
|
||||||
|
"description": "The details of the group",
|
||||||
|
"required": true,
|
||||||
|
"schema": {
|
||||||
|
"$ref": "#/definitions/object.Group"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"responses": {
|
||||||
|
"200": {
|
||||||
|
"description": "The Response object",
|
||||||
|
"schema": {
|
||||||
|
"$ref": "#/definitions/controllers.Response"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
"/api/add-ldap": {
|
"/api/add-ldap": {
|
||||||
"post": {
|
"post": {
|
||||||
"tags": [
|
"tags": [
|
||||||
@@ -599,6 +655,14 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"/api/add-user-keys": {
|
||||||
|
"post": {
|
||||||
|
"tags": [
|
||||||
|
"User API"
|
||||||
|
],
|
||||||
|
"operationId": "ApiController.AddUserkeys"
|
||||||
|
}
|
||||||
|
},
|
||||||
"/api/add-webhook": {
|
"/api/add-webhook": {
|
||||||
"post": {
|
"post": {
|
||||||
"tags": [
|
"tags": [
|
||||||
@@ -782,13 +846,13 @@
|
|||||||
"tags": [
|
"tags": [
|
||||||
"Enforce API"
|
"Enforce API"
|
||||||
],
|
],
|
||||||
"description": "perform enforce",
|
"description": "Call Casbin BatchEnforce API",
|
||||||
"operationId": "ApiController.BatchEnforce",
|
"operationId": "ApiController.BatchEnforce",
|
||||||
"parameters": [
|
"parameters": [
|
||||||
{
|
{
|
||||||
"in": "body",
|
"in": "body",
|
||||||
"name": "body",
|
"name": "body",
|
||||||
"description": "casbin request array",
|
"description": "array of casbin requests",
|
||||||
"required": true,
|
"required": true,
|
||||||
"schema": {
|
"schema": {
|
||||||
"$ref": "#/definitions/object.CasbinRequest"
|
"$ref": "#/definitions/object.CasbinRequest"
|
||||||
@@ -858,6 +922,34 @@
|
|||||||
"operationId": "ApiController.CheckUserPassword"
|
"operationId": "ApiController.CheckUserPassword"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"/api/delete-adapter": {
|
||||||
|
"post": {
|
||||||
|
"tags": [
|
||||||
|
"Adapter API"
|
||||||
|
],
|
||||||
|
"description": "delete adapter",
|
||||||
|
"operationId": "ApiController.DeleteCasbinAdapter",
|
||||||
|
"parameters": [
|
||||||
|
{
|
||||||
|
"in": "body",
|
||||||
|
"name": "body",
|
||||||
|
"description": "The details of the adapter",
|
||||||
|
"required": true,
|
||||||
|
"schema": {
|
||||||
|
"$ref": "#/definitions/object.Adapter"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"responses": {
|
||||||
|
"200": {
|
||||||
|
"description": "The Response object",
|
||||||
|
"schema": {
|
||||||
|
"$ref": "#/definitions/controllers.Response"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
"/api/delete-application": {
|
"/api/delete-application": {
|
||||||
"post": {
|
"post": {
|
||||||
"tags": [
|
"tags": [
|
||||||
@@ -942,6 +1034,34 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"/api/delete-group": {
|
||||||
|
"post": {
|
||||||
|
"tags": [
|
||||||
|
"Group API"
|
||||||
|
],
|
||||||
|
"description": "delete group",
|
||||||
|
"operationId": "ApiController.DeleteGroup",
|
||||||
|
"parameters": [
|
||||||
|
{
|
||||||
|
"in": "body",
|
||||||
|
"name": "body",
|
||||||
|
"description": "The details of the group",
|
||||||
|
"required": true,
|
||||||
|
"schema": {
|
||||||
|
"$ref": "#/definitions/object.Group"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"responses": {
|
||||||
|
"200": {
|
||||||
|
"description": "The Response object",
|
||||||
|
"schema": {
|
||||||
|
"$ref": "#/definitions/controllers.Response"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
"/api/delete-ldap": {
|
"/api/delete-ldap": {
|
||||||
"post": {
|
"post": {
|
||||||
"tags": [
|
"tags": [
|
||||||
@@ -1429,13 +1549,13 @@
|
|||||||
"tags": [
|
"tags": [
|
||||||
"Enforce API"
|
"Enforce API"
|
||||||
],
|
],
|
||||||
"description": "perform enforce",
|
"description": "Call Casbin Enforce API",
|
||||||
"operationId": "ApiController.Enforce",
|
"operationId": "ApiController.Enforce",
|
||||||
"parameters": [
|
"parameters": [
|
||||||
{
|
{
|
||||||
"in": "body",
|
"in": "body",
|
||||||
"name": "body",
|
"name": "body",
|
||||||
"description": "casbin request",
|
"description": "Casbin request",
|
||||||
"required": true,
|
"required": true,
|
||||||
"schema": {
|
"schema": {
|
||||||
"$ref": "#/definitions/object.CasbinRequest"
|
"$ref": "#/definitions/object.CasbinRequest"
|
||||||
@@ -1487,6 +1607,61 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"/api/get-adapter": {
|
||||||
|
"get": {
|
||||||
|
"tags": [
|
||||||
|
"Adapter API"
|
||||||
|
],
|
||||||
|
"description": "get adapter",
|
||||||
|
"operationId": "ApiController.GetCasbinAdapter",
|
||||||
|
"parameters": [
|
||||||
|
{
|
||||||
|
"in": "query",
|
||||||
|
"name": "id",
|
||||||
|
"description": "The id ( owner/name ) of the adapter",
|
||||||
|
"required": true,
|
||||||
|
"type": "string"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"responses": {
|
||||||
|
"200": {
|
||||||
|
"description": "The Response object",
|
||||||
|
"schema": {
|
||||||
|
"$ref": "#/definitions/object.Adapter"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"/api/get-adapters": {
|
||||||
|
"get": {
|
||||||
|
"tags": [
|
||||||
|
"Adapter API"
|
||||||
|
],
|
||||||
|
"description": "get adapters",
|
||||||
|
"operationId": "ApiController.GetCasbinAdapters",
|
||||||
|
"parameters": [
|
||||||
|
{
|
||||||
|
"in": "query",
|
||||||
|
"name": "owner",
|
||||||
|
"description": "The owner of adapters",
|
||||||
|
"required": true,
|
||||||
|
"type": "string"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"responses": {
|
||||||
|
"200": {
|
||||||
|
"description": "The Response object",
|
||||||
|
"schema": {
|
||||||
|
"type": "array",
|
||||||
|
"items": {
|
||||||
|
"$ref": "#/definitions/object.Adapter"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
"/api/get-app-login": {
|
"/api/get-app-login": {
|
||||||
"get": {
|
"get": {
|
||||||
"tags": [
|
"tags": [
|
||||||
@@ -1825,6 +2000,61 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"/api/get-group": {
|
||||||
|
"get": {
|
||||||
|
"tags": [
|
||||||
|
"Group API"
|
||||||
|
],
|
||||||
|
"description": "get group",
|
||||||
|
"operationId": "ApiController.GetGroup",
|
||||||
|
"parameters": [
|
||||||
|
{
|
||||||
|
"in": "query",
|
||||||
|
"name": "id",
|
||||||
|
"description": "The id ( owner/name ) of the group",
|
||||||
|
"required": true,
|
||||||
|
"type": "string"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"responses": {
|
||||||
|
"200": {
|
||||||
|
"description": "The Response object",
|
||||||
|
"schema": {
|
||||||
|
"$ref": "#/definitions/object.Group"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"/api/get-groups": {
|
||||||
|
"get": {
|
||||||
|
"tags": [
|
||||||
|
"Group API"
|
||||||
|
],
|
||||||
|
"description": "get groups",
|
||||||
|
"operationId": "ApiController.GetGroups",
|
||||||
|
"parameters": [
|
||||||
|
{
|
||||||
|
"in": "query",
|
||||||
|
"name": "owner",
|
||||||
|
"description": "The owner of groups",
|
||||||
|
"required": true,
|
||||||
|
"type": "string"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"responses": {
|
||||||
|
"200": {
|
||||||
|
"description": "The Response object",
|
||||||
|
"schema": {
|
||||||
|
"type": "array",
|
||||||
|
"items": {
|
||||||
|
"$ref": "#/definitions/object.Group"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
"/api/get-ldap": {
|
"/api/get-ldap": {
|
||||||
"get": {
|
"get": {
|
||||||
"tags": [
|
"tags": [
|
||||||
@@ -2045,7 +2275,7 @@
|
|||||||
"tags": [
|
"tags": [
|
||||||
"Organization API"
|
"Organization API"
|
||||||
],
|
],
|
||||||
"description": "get all organization names",
|
"description": "get all organization name and displayName",
|
||||||
"operationId": "ApiController.GetOrganizationNames",
|
"operationId": "ApiController.GetOrganizationNames",
|
||||||
"parameters": [
|
"parameters": [
|
||||||
{
|
{
|
||||||
@@ -2338,7 +2568,7 @@
|
|||||||
"200": {
|
"200": {
|
||||||
"description": "The Response object",
|
"description": "The Response object",
|
||||||
"schema": {
|
"schema": {
|
||||||
"$ref": "#/definitions/object.pricing"
|
"$ref": "#/definitions/object.Pricing"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -2753,7 +2983,7 @@
|
|||||||
"200": {
|
"200": {
|
||||||
"description": "The Response object",
|
"description": "The Response object",
|
||||||
"schema": {
|
"schema": {
|
||||||
"$ref": "#/definitions/object.subscription"
|
"$ref": "#/definitions/object.Subscription"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -3328,7 +3558,7 @@
|
|||||||
"200": {
|
"200": {
|
||||||
"description": "The Response object",
|
"description": "The Response object",
|
||||||
"schema": {
|
"schema": {
|
||||||
"$ref": "#/definitions/Response"
|
"$ref": "#/definitions/controllers.Response"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -3598,9 +3828,9 @@
|
|||||||
"operationId": "ApiController.MfaSetupInitiate",
|
"operationId": "ApiController.MfaSetupInitiate",
|
||||||
"responses": {
|
"responses": {
|
||||||
"200": {
|
"200": {
|
||||||
"description": "Response object",
|
"description": "The Response object",
|
||||||
"schema": {
|
"schema": {
|
||||||
"$ref": "#/definitions/The"
|
"$ref": "#/definitions/controllers.Response"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -3799,6 +4029,41 @@
|
|||||||
]
|
]
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"/api/update-adapter": {
|
||||||
|
"post": {
|
||||||
|
"tags": [
|
||||||
|
"Adapter API"
|
||||||
|
],
|
||||||
|
"description": "update adapter",
|
||||||
|
"operationId": "ApiController.UpdateCasbinAdapter",
|
||||||
|
"parameters": [
|
||||||
|
{
|
||||||
|
"in": "query",
|
||||||
|
"name": "id",
|
||||||
|
"description": "The id ( owner/name ) of the adapter",
|
||||||
|
"required": true,
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"in": "body",
|
||||||
|
"name": "body",
|
||||||
|
"description": "The details of the adapter",
|
||||||
|
"required": true,
|
||||||
|
"schema": {
|
||||||
|
"$ref": "#/definitions/object.Adapter"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"responses": {
|
||||||
|
"200": {
|
||||||
|
"description": "The Response object",
|
||||||
|
"schema": {
|
||||||
|
"$ref": "#/definitions/controllers.Response"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
"/api/update-application": {
|
"/api/update-application": {
|
||||||
"post": {
|
"post": {
|
||||||
"tags": [
|
"tags": [
|
||||||
@@ -3904,6 +4169,41 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"/api/update-group": {
|
||||||
|
"post": {
|
||||||
|
"tags": [
|
||||||
|
"Group API"
|
||||||
|
],
|
||||||
|
"description": "update group",
|
||||||
|
"operationId": "ApiController.UpdateGroup",
|
||||||
|
"parameters": [
|
||||||
|
{
|
||||||
|
"in": "query",
|
||||||
|
"name": "id",
|
||||||
|
"description": "The id ( owner/name ) of the group",
|
||||||
|
"required": true,
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"in": "body",
|
||||||
|
"name": "body",
|
||||||
|
"description": "The details of the group",
|
||||||
|
"required": true,
|
||||||
|
"schema": {
|
||||||
|
"$ref": "#/definitions/object.Group"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"responses": {
|
||||||
|
"200": {
|
||||||
|
"description": "The Response object",
|
||||||
|
"schema": {
|
||||||
|
"$ref": "#/definitions/controllers.Response"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
"/api/update-ldap": {
|
"/api/update-ldap": {
|
||||||
"post": {
|
"post": {
|
||||||
"tags": [
|
"tags": [
|
||||||
@@ -4579,7 +4879,7 @@
|
|||||||
"200": {
|
"200": {
|
||||||
"description": "\"The Response object\"",
|
"description": "\"The Response object\"",
|
||||||
"schema": {
|
"schema": {
|
||||||
"$ref": "#/definitions/Response"
|
"$ref": "#/definitions/controllers.Response"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -4624,7 +4924,7 @@
|
|||||||
"200": {
|
"200": {
|
||||||
"description": "\"The Response object\"",
|
"description": "\"The Response object\"",
|
||||||
"schema": {
|
"schema": {
|
||||||
"$ref": "#/definitions/Response"
|
"$ref": "#/definitions/controllers.Response"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -4632,14 +4932,6 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"definitions": {
|
"definitions": {
|
||||||
"1225.0xc0002e2ae0.false": {
|
|
||||||
"title": "false",
|
|
||||||
"type": "object"
|
|
||||||
},
|
|
||||||
"1260.0xc0002e2b10.false": {
|
|
||||||
"title": "false",
|
|
||||||
"type": "object"
|
|
||||||
},
|
|
||||||
"LaravelResponse": {
|
"LaravelResponse": {
|
||||||
"title": "LaravelResponse",
|
"title": "LaravelResponse",
|
||||||
"type": "object"
|
"type": "object"
|
||||||
@@ -4648,10 +4940,6 @@
|
|||||||
"title": "Response",
|
"title": "Response",
|
||||||
"type": "object"
|
"type": "object"
|
||||||
},
|
},
|
||||||
"The": {
|
|
||||||
"title": "The",
|
|
||||||
"type": "object"
|
|
||||||
},
|
|
||||||
"controllers.AuthForm": {
|
"controllers.AuthForm": {
|
||||||
"title": "AuthForm",
|
"title": "AuthForm",
|
||||||
"type": "object"
|
"type": "object"
|
||||||
@@ -4685,10 +4973,16 @@
|
|||||||
"type": "object",
|
"type": "object",
|
||||||
"properties": {
|
"properties": {
|
||||||
"data": {
|
"data": {
|
||||||
"$ref": "#/definitions/1225.0xc0002e2ae0.false"
|
"additionalProperties": {
|
||||||
|
"description": "support string | class | List\u003cclass\u003e and os on",
|
||||||
|
"type": "string"
|
||||||
|
}
|
||||||
},
|
},
|
||||||
"data2": {
|
"data2": {
|
||||||
"$ref": "#/definitions/1260.0xc0002e2b10.false"
|
"additionalProperties": {
|
||||||
|
"description": "support string | class | List\u003cclass\u003e and os on",
|
||||||
|
"type": "string"
|
||||||
|
}
|
||||||
},
|
},
|
||||||
"msg": {
|
"msg": {
|
||||||
"type": "string"
|
"type": "string"
|
||||||
@@ -4726,8 +5020,8 @@
|
|||||||
"title": "JSONWebKey",
|
"title": "JSONWebKey",
|
||||||
"type": "object"
|
"type": "object"
|
||||||
},
|
},
|
||||||
"object.\u0026{179844 0xc000a02f90 false}": {
|
"object": {
|
||||||
"title": "\u0026{179844 0xc000a02f90 false}",
|
"title": "object",
|
||||||
"type": "object"
|
"type": "object"
|
||||||
},
|
},
|
||||||
"object.AccountItem": {
|
"object.AccountItem": {
|
||||||
@@ -4917,7 +5211,7 @@
|
|||||||
"title": "CasbinRequest",
|
"title": "CasbinRequest",
|
||||||
"type": "array",
|
"type": "array",
|
||||||
"items": {
|
"items": {
|
||||||
"$ref": "#/definitions/object.\u0026{179844 0xc000a02f90 false}"
|
"$ref": "#/definitions/object.CasbinRequest"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"object.Cert": {
|
"object.Cert": {
|
||||||
@@ -5029,6 +5323,63 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"object.Group": {
|
||||||
|
"title": "Group",
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"children": {
|
||||||
|
"type": "array",
|
||||||
|
"items": {
|
||||||
|
"$ref": "#/definitions/object.Group"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"contactEmail": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"createdTime": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"displayName": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"isEnabled": {
|
||||||
|
"type": "boolean"
|
||||||
|
},
|
||||||
|
"isTopGroup": {
|
||||||
|
"type": "boolean"
|
||||||
|
},
|
||||||
|
"key": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"manager": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"name": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"owner": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"parentId": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"title": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"type": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"updatedTime": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"users": {
|
||||||
|
"type": "array",
|
||||||
|
"items": {
|
||||||
|
"$ref": "#/definitions/object.User"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
"object.Header": {
|
"object.Header": {
|
||||||
"title": "Header",
|
"title": "Header",
|
||||||
"type": "object",
|
"type": "object",
|
||||||
@@ -5175,12 +5526,15 @@
|
|||||||
"countryCode": {
|
"countryCode": {
|
||||||
"type": "string"
|
"type": "string"
|
||||||
},
|
},
|
||||||
"id": {
|
"enabled": {
|
||||||
"type": "string"
|
"type": "boolean"
|
||||||
},
|
},
|
||||||
"isPreferred": {
|
"isPreferred": {
|
||||||
"type": "boolean"
|
"type": "boolean"
|
||||||
},
|
},
|
||||||
|
"mfaType": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
"recoveryCodes": {
|
"recoveryCodes": {
|
||||||
"type": "array",
|
"type": "array",
|
||||||
"items": {
|
"items": {
|
||||||
@@ -5190,9 +5544,6 @@
|
|||||||
"secret": {
|
"secret": {
|
||||||
"type": "string"
|
"type": "string"
|
||||||
},
|
},
|
||||||
"type": {
|
|
||||||
"type": "string"
|
|
||||||
},
|
|
||||||
"url": {
|
"url": {
|
||||||
"type": "string"
|
"type": "string"
|
||||||
}
|
}
|
||||||
@@ -5205,6 +5556,9 @@
|
|||||||
"createdTime": {
|
"createdTime": {
|
||||||
"type": "string"
|
"type": "string"
|
||||||
},
|
},
|
||||||
|
"description": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
"displayName": {
|
"displayName": {
|
||||||
"type": "string"
|
"type": "string"
|
||||||
},
|
},
|
||||||
@@ -5362,6 +5716,12 @@
|
|||||||
"owner": {
|
"owner": {
|
||||||
"type": "string"
|
"type": "string"
|
||||||
},
|
},
|
||||||
|
"passwordOptions": {
|
||||||
|
"type": "array",
|
||||||
|
"items": {
|
||||||
|
"type": "string"
|
||||||
|
}
|
||||||
|
},
|
||||||
"passwordSalt": {
|
"passwordSalt": {
|
||||||
"type": "string"
|
"type": "string"
|
||||||
},
|
},
|
||||||
@@ -5492,6 +5852,9 @@
|
|||||||
"createdTime": {
|
"createdTime": {
|
||||||
"type": "string"
|
"type": "string"
|
||||||
},
|
},
|
||||||
|
"description": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
"displayName": {
|
"displayName": {
|
||||||
"type": "string"
|
"type": "string"
|
||||||
},
|
},
|
||||||
@@ -5611,9 +5974,6 @@
|
|||||||
"displayName": {
|
"displayName": {
|
||||||
"type": "string"
|
"type": "string"
|
||||||
},
|
},
|
||||||
"hasTrial": {
|
|
||||||
"type": "boolean"
|
|
||||||
},
|
|
||||||
"isEnabled": {
|
"isEnabled": {
|
||||||
"type": "boolean"
|
"type": "boolean"
|
||||||
},
|
},
|
||||||
@@ -5933,6 +6293,9 @@
|
|||||||
"createdTime": {
|
"createdTime": {
|
||||||
"type": "string"
|
"type": "string"
|
||||||
},
|
},
|
||||||
|
"description": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
"displayName": {
|
"displayName": {
|
||||||
"type": "string"
|
"type": "string"
|
||||||
},
|
},
|
||||||
@@ -6068,6 +6431,9 @@
|
|||||||
"isEnabled": {
|
"isEnabled": {
|
||||||
"type": "boolean"
|
"type": "boolean"
|
||||||
},
|
},
|
||||||
|
"isReadOnly": {
|
||||||
|
"type": "boolean"
|
||||||
|
},
|
||||||
"name": {
|
"name": {
|
||||||
"type": "string"
|
"type": "string"
|
||||||
},
|
},
|
||||||
@@ -6248,6 +6614,12 @@
|
|||||||
"title": "User",
|
"title": "User",
|
||||||
"type": "object",
|
"type": "object",
|
||||||
"properties": {
|
"properties": {
|
||||||
|
"accessKey": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"accessSecret": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
"address": {
|
"address": {
|
||||||
"type": "array",
|
"type": "array",
|
||||||
"items": {
|
"items": {
|
||||||
@@ -6275,6 +6647,9 @@
|
|||||||
"avatar": {
|
"avatar": {
|
||||||
"type": "string"
|
"type": "string"
|
||||||
},
|
},
|
||||||
|
"avatarType": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
"azuread": {
|
"azuread": {
|
||||||
"type": "string"
|
"type": "string"
|
||||||
},
|
},
|
||||||
@@ -6380,6 +6755,12 @@
|
|||||||
"google": {
|
"google": {
|
||||||
"type": "string"
|
"type": "string"
|
||||||
},
|
},
|
||||||
|
"groups": {
|
||||||
|
"type": "array",
|
||||||
|
"items": {
|
||||||
|
"type": "string"
|
||||||
|
}
|
||||||
|
},
|
||||||
"hash": {
|
"hash": {
|
||||||
"type": "string"
|
"type": "string"
|
||||||
},
|
},
|
||||||
@@ -6480,6 +6861,12 @@
|
|||||||
"meetup": {
|
"meetup": {
|
||||||
"type": "string"
|
"type": "string"
|
||||||
},
|
},
|
||||||
|
"mfaEmailEnabled": {
|
||||||
|
"type": "boolean"
|
||||||
|
},
|
||||||
|
"mfaPhoneEnabled": {
|
||||||
|
"type": "boolean"
|
||||||
|
},
|
||||||
"microsoftonline": {
|
"microsoftonline": {
|
||||||
"type": "string"
|
"type": "string"
|
||||||
},
|
},
|
||||||
@@ -6540,6 +6927,9 @@
|
|||||||
"preHash": {
|
"preHash": {
|
||||||
"type": "string"
|
"type": "string"
|
||||||
},
|
},
|
||||||
|
"preferredMfaType": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
"properties": {
|
"properties": {
|
||||||
"additionalProperties": {
|
"additionalProperties": {
|
||||||
"type": "string"
|
"type": "string"
|
||||||
@@ -6552,6 +6942,12 @@
|
|||||||
"type": "integer",
|
"type": "integer",
|
||||||
"format": "int64"
|
"format": "int64"
|
||||||
},
|
},
|
||||||
|
"recoveryCodes": {
|
||||||
|
"type": "array",
|
||||||
|
"items": {
|
||||||
|
"type": "string"
|
||||||
|
}
|
||||||
|
},
|
||||||
"region": {
|
"region": {
|
||||||
"type": "string"
|
"type": "string"
|
||||||
},
|
},
|
||||||
@@ -6605,6 +7001,9 @@
|
|||||||
"title": {
|
"title": {
|
||||||
"type": "string"
|
"type": "string"
|
||||||
},
|
},
|
||||||
|
"totpSecret": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
"tumblr": {
|
"tumblr": {
|
||||||
"type": "string"
|
"type": "string"
|
||||||
},
|
},
|
||||||
@@ -6677,15 +7076,18 @@
|
|||||||
"email": {
|
"email": {
|
||||||
"type": "string"
|
"type": "string"
|
||||||
},
|
},
|
||||||
|
"groups": {
|
||||||
|
"type": "array",
|
||||||
|
"items": {
|
||||||
|
"type": "string"
|
||||||
|
}
|
||||||
|
},
|
||||||
"iss": {
|
"iss": {
|
||||||
"type": "string"
|
"type": "string"
|
||||||
},
|
},
|
||||||
"name": {
|
"name": {
|
||||||
"type": "string"
|
"type": "string"
|
||||||
},
|
},
|
||||||
"organization": {
|
|
||||||
"type": "string"
|
|
||||||
},
|
|
||||||
"phone": {
|
"phone": {
|
||||||
"type": "string"
|
"type": "string"
|
||||||
},
|
},
|
||||||
@@ -6745,14 +7147,6 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"object.pricing": {
|
|
||||||
"title": "pricing",
|
|
||||||
"type": "object"
|
|
||||||
},
|
|
||||||
"object.subscription": {
|
|
||||||
"title": "subscription",
|
|
||||||
"type": "object"
|
|
||||||
},
|
|
||||||
"protocol.CredentialAssertion": {
|
"protocol.CredentialAssertion": {
|
||||||
"title": "CredentialAssertion",
|
"title": "CredentialAssertion",
|
||||||
"type": "object"
|
"type": "object"
|
||||||
|
@@ -28,6 +28,24 @@ paths:
|
|||||||
description: ""
|
description: ""
|
||||||
schema:
|
schema:
|
||||||
$ref: '#/definitions/object.OidcDiscovery'
|
$ref: '#/definitions/object.OidcDiscovery'
|
||||||
|
/api/add-adapter:
|
||||||
|
post:
|
||||||
|
tags:
|
||||||
|
- Adapter API
|
||||||
|
description: add adapter
|
||||||
|
operationId: ApiController.AddCasbinAdapter
|
||||||
|
parameters:
|
||||||
|
- in: body
|
||||||
|
name: body
|
||||||
|
description: The details of the adapter
|
||||||
|
required: true
|
||||||
|
schema:
|
||||||
|
$ref: '#/definitions/object.Adapter'
|
||||||
|
responses:
|
||||||
|
"200":
|
||||||
|
description: The Response object
|
||||||
|
schema:
|
||||||
|
$ref: '#/definitions/controllers.Response'
|
||||||
/api/add-application:
|
/api/add-application:
|
||||||
post:
|
post:
|
||||||
tags:
|
tags:
|
||||||
@@ -82,6 +100,24 @@ paths:
|
|||||||
description: The Response object
|
description: The Response object
|
||||||
schema:
|
schema:
|
||||||
$ref: '#/definitions/controllers.Response'
|
$ref: '#/definitions/controllers.Response'
|
||||||
|
/api/add-group:
|
||||||
|
post:
|
||||||
|
tags:
|
||||||
|
- Group API
|
||||||
|
description: add group
|
||||||
|
operationId: ApiController.AddGroup
|
||||||
|
parameters:
|
||||||
|
- in: body
|
||||||
|
name: body
|
||||||
|
description: The details of the group
|
||||||
|
required: true
|
||||||
|
schema:
|
||||||
|
$ref: '#/definitions/object.Group'
|
||||||
|
responses:
|
||||||
|
"200":
|
||||||
|
description: The Response object
|
||||||
|
schema:
|
||||||
|
$ref: '#/definitions/controllers.Response'
|
||||||
/api/add-ldap:
|
/api/add-ldap:
|
||||||
post:
|
post:
|
||||||
tags:
|
tags:
|
||||||
@@ -386,6 +422,11 @@ paths:
|
|||||||
description: The Response object
|
description: The Response object
|
||||||
schema:
|
schema:
|
||||||
$ref: '#/definitions/controllers.Response'
|
$ref: '#/definitions/controllers.Response'
|
||||||
|
/api/add-user-keys:
|
||||||
|
post:
|
||||||
|
tags:
|
||||||
|
- User API
|
||||||
|
operationId: ApiController.AddUserkeys
|
||||||
/api/add-webhook:
|
/api/add-webhook:
|
||||||
post:
|
post:
|
||||||
tags:
|
tags:
|
||||||
@@ -506,12 +547,12 @@ paths:
|
|||||||
post:
|
post:
|
||||||
tags:
|
tags:
|
||||||
- Enforce API
|
- Enforce API
|
||||||
description: perform enforce
|
description: Call Casbin BatchEnforce API
|
||||||
operationId: ApiController.BatchEnforce
|
operationId: ApiController.BatchEnforce
|
||||||
parameters:
|
parameters:
|
||||||
- in: body
|
- in: body
|
||||||
name: body
|
name: body
|
||||||
description: casbin request array
|
description: array of casbin requests
|
||||||
required: true
|
required: true
|
||||||
schema:
|
schema:
|
||||||
$ref: '#/definitions/object.CasbinRequest'
|
$ref: '#/definitions/object.CasbinRequest'
|
||||||
@@ -555,6 +596,24 @@ paths:
|
|||||||
tags:
|
tags:
|
||||||
- User API
|
- User API
|
||||||
operationId: ApiController.CheckUserPassword
|
operationId: ApiController.CheckUserPassword
|
||||||
|
/api/delete-adapter:
|
||||||
|
post:
|
||||||
|
tags:
|
||||||
|
- Adapter API
|
||||||
|
description: delete adapter
|
||||||
|
operationId: ApiController.DeleteCasbinAdapter
|
||||||
|
parameters:
|
||||||
|
- in: body
|
||||||
|
name: body
|
||||||
|
description: The details of the adapter
|
||||||
|
required: true
|
||||||
|
schema:
|
||||||
|
$ref: '#/definitions/object.Adapter'
|
||||||
|
responses:
|
||||||
|
"200":
|
||||||
|
description: The Response object
|
||||||
|
schema:
|
||||||
|
$ref: '#/definitions/controllers.Response'
|
||||||
/api/delete-application:
|
/api/delete-application:
|
||||||
post:
|
post:
|
||||||
tags:
|
tags:
|
||||||
@@ -609,6 +668,24 @@ paths:
|
|||||||
description: The Response object
|
description: The Response object
|
||||||
schema:
|
schema:
|
||||||
$ref: '#/definitions/controllers.Response'
|
$ref: '#/definitions/controllers.Response'
|
||||||
|
/api/delete-group:
|
||||||
|
post:
|
||||||
|
tags:
|
||||||
|
- Group API
|
||||||
|
description: delete group
|
||||||
|
operationId: ApiController.DeleteGroup
|
||||||
|
parameters:
|
||||||
|
- in: body
|
||||||
|
name: body
|
||||||
|
description: The details of the group
|
||||||
|
required: true
|
||||||
|
schema:
|
||||||
|
$ref: '#/definitions/object.Group'
|
||||||
|
responses:
|
||||||
|
"200":
|
||||||
|
description: The Response object
|
||||||
|
schema:
|
||||||
|
$ref: '#/definitions/controllers.Response'
|
||||||
/api/delete-ldap:
|
/api/delete-ldap:
|
||||||
post:
|
post:
|
||||||
tags:
|
tags:
|
||||||
@@ -923,12 +1000,12 @@ paths:
|
|||||||
post:
|
post:
|
||||||
tags:
|
tags:
|
||||||
- Enforce API
|
- Enforce API
|
||||||
description: perform enforce
|
description: Call Casbin Enforce API
|
||||||
operationId: ApiController.Enforce
|
operationId: ApiController.Enforce
|
||||||
parameters:
|
parameters:
|
||||||
- in: body
|
- in: body
|
||||||
name: body
|
name: body
|
||||||
description: casbin request
|
description: Casbin request
|
||||||
required: true
|
required: true
|
||||||
schema:
|
schema:
|
||||||
$ref: '#/definitions/object.CasbinRequest'
|
$ref: '#/definitions/object.CasbinRequest'
|
||||||
@@ -960,6 +1037,42 @@ paths:
|
|||||||
description: The Response object
|
description: The Response object
|
||||||
schema:
|
schema:
|
||||||
$ref: '#/definitions/controllers.Response'
|
$ref: '#/definitions/controllers.Response'
|
||||||
|
/api/get-adapter:
|
||||||
|
get:
|
||||||
|
tags:
|
||||||
|
- Adapter API
|
||||||
|
description: get adapter
|
||||||
|
operationId: ApiController.GetCasbinAdapter
|
||||||
|
parameters:
|
||||||
|
- in: query
|
||||||
|
name: id
|
||||||
|
description: The id ( owner/name ) of the adapter
|
||||||
|
required: true
|
||||||
|
type: string
|
||||||
|
responses:
|
||||||
|
"200":
|
||||||
|
description: The Response object
|
||||||
|
schema:
|
||||||
|
$ref: '#/definitions/object.Adapter'
|
||||||
|
/api/get-adapters:
|
||||||
|
get:
|
||||||
|
tags:
|
||||||
|
- Adapter API
|
||||||
|
description: get adapters
|
||||||
|
operationId: ApiController.GetCasbinAdapters
|
||||||
|
parameters:
|
||||||
|
- in: query
|
||||||
|
name: owner
|
||||||
|
description: The owner of adapters
|
||||||
|
required: true
|
||||||
|
type: string
|
||||||
|
responses:
|
||||||
|
"200":
|
||||||
|
description: The Response object
|
||||||
|
schema:
|
||||||
|
type: array
|
||||||
|
items:
|
||||||
|
$ref: '#/definitions/object.Adapter'
|
||||||
/api/get-app-login:
|
/api/get-app-login:
|
||||||
get:
|
get:
|
||||||
tags:
|
tags:
|
||||||
@@ -1183,6 +1296,42 @@ paths:
|
|||||||
type: array
|
type: array
|
||||||
items:
|
items:
|
||||||
$ref: '#/definitions/object.Cert'
|
$ref: '#/definitions/object.Cert'
|
||||||
|
/api/get-group:
|
||||||
|
get:
|
||||||
|
tags:
|
||||||
|
- Group API
|
||||||
|
description: get group
|
||||||
|
operationId: ApiController.GetGroup
|
||||||
|
parameters:
|
||||||
|
- in: query
|
||||||
|
name: id
|
||||||
|
description: The id ( owner/name ) of the group
|
||||||
|
required: true
|
||||||
|
type: string
|
||||||
|
responses:
|
||||||
|
"200":
|
||||||
|
description: The Response object
|
||||||
|
schema:
|
||||||
|
$ref: '#/definitions/object.Group'
|
||||||
|
/api/get-groups:
|
||||||
|
get:
|
||||||
|
tags:
|
||||||
|
- Group API
|
||||||
|
description: get groups
|
||||||
|
operationId: ApiController.GetGroups
|
||||||
|
parameters:
|
||||||
|
- in: query
|
||||||
|
name: owner
|
||||||
|
description: The owner of groups
|
||||||
|
required: true
|
||||||
|
type: string
|
||||||
|
responses:
|
||||||
|
"200":
|
||||||
|
description: The Response object
|
||||||
|
schema:
|
||||||
|
type: array
|
||||||
|
items:
|
||||||
|
$ref: '#/definitions/object.Group'
|
||||||
/api/get-ldap:
|
/api/get-ldap:
|
||||||
get:
|
get:
|
||||||
tags:
|
tags:
|
||||||
@@ -1327,7 +1476,7 @@ paths:
|
|||||||
get:
|
get:
|
||||||
tags:
|
tags:
|
||||||
- Organization API
|
- Organization API
|
||||||
description: get all organization names
|
description: get all organization name and displayName
|
||||||
operationId: ApiController.GetOrganizationNames
|
operationId: ApiController.GetOrganizationNames
|
||||||
parameters:
|
parameters:
|
||||||
- in: query
|
- in: query
|
||||||
@@ -1521,7 +1670,7 @@ paths:
|
|||||||
"200":
|
"200":
|
||||||
description: The Response object
|
description: The Response object
|
||||||
schema:
|
schema:
|
||||||
$ref: '#/definitions/object.pricing'
|
$ref: '#/definitions/object.Pricing'
|
||||||
/api/get-pricings:
|
/api/get-pricings:
|
||||||
get:
|
get:
|
||||||
tags:
|
tags:
|
||||||
@@ -1793,7 +1942,7 @@ paths:
|
|||||||
"200":
|
"200":
|
||||||
description: The Response object
|
description: The Response object
|
||||||
schema:
|
schema:
|
||||||
$ref: '#/definitions/object.subscription'
|
$ref: '#/definitions/object.Subscription'
|
||||||
/api/get-subscriptions:
|
/api/get-subscriptions:
|
||||||
get:
|
get:
|
||||||
tags:
|
tags:
|
||||||
@@ -2172,7 +2321,7 @@ paths:
|
|||||||
"200":
|
"200":
|
||||||
description: The Response object
|
description: The Response object
|
||||||
schema:
|
schema:
|
||||||
$ref: '#/definitions/Response'
|
$ref: '#/definitions/controllers.Response'
|
||||||
/api/login/oauth/access_token:
|
/api/login/oauth/access_token:
|
||||||
post:
|
post:
|
||||||
tags:
|
tags:
|
||||||
@@ -2351,9 +2500,9 @@ paths:
|
|||||||
operationId: ApiController.MfaSetupInitiate
|
operationId: ApiController.MfaSetupInitiate
|
||||||
responses:
|
responses:
|
||||||
"200":
|
"200":
|
||||||
description: Response object
|
description: The Response object
|
||||||
schema:
|
schema:
|
||||||
$ref: '#/definitions/The'
|
$ref: '#/definitions/controllers.Response'
|
||||||
/api/mfa/setup/verify:
|
/api/mfa/setup/verify:
|
||||||
post:
|
post:
|
||||||
tags:
|
tags:
|
||||||
@@ -2480,6 +2629,29 @@ paths:
|
|||||||
post:
|
post:
|
||||||
tags:
|
tags:
|
||||||
- Login API
|
- Login API
|
||||||
|
/api/update-adapter:
|
||||||
|
post:
|
||||||
|
tags:
|
||||||
|
- Adapter API
|
||||||
|
description: update adapter
|
||||||
|
operationId: ApiController.UpdateCasbinAdapter
|
||||||
|
parameters:
|
||||||
|
- in: query
|
||||||
|
name: id
|
||||||
|
description: The id ( owner/name ) of the adapter
|
||||||
|
required: true
|
||||||
|
type: string
|
||||||
|
- in: body
|
||||||
|
name: body
|
||||||
|
description: The details of the adapter
|
||||||
|
required: true
|
||||||
|
schema:
|
||||||
|
$ref: '#/definitions/object.Adapter'
|
||||||
|
responses:
|
||||||
|
"200":
|
||||||
|
description: The Response object
|
||||||
|
schema:
|
||||||
|
$ref: '#/definitions/controllers.Response'
|
||||||
/api/update-application:
|
/api/update-application:
|
||||||
post:
|
post:
|
||||||
tags:
|
tags:
|
||||||
@@ -2549,6 +2721,29 @@ paths:
|
|||||||
description: The Response object
|
description: The Response object
|
||||||
schema:
|
schema:
|
||||||
$ref: '#/definitions/controllers.Response'
|
$ref: '#/definitions/controllers.Response'
|
||||||
|
/api/update-group:
|
||||||
|
post:
|
||||||
|
tags:
|
||||||
|
- Group API
|
||||||
|
description: update group
|
||||||
|
operationId: ApiController.UpdateGroup
|
||||||
|
parameters:
|
||||||
|
- in: query
|
||||||
|
name: id
|
||||||
|
description: The id ( owner/name ) of the group
|
||||||
|
required: true
|
||||||
|
type: string
|
||||||
|
- in: body
|
||||||
|
name: body
|
||||||
|
description: The details of the group
|
||||||
|
required: true
|
||||||
|
schema:
|
||||||
|
$ref: '#/definitions/object.Group'
|
||||||
|
responses:
|
||||||
|
"200":
|
||||||
|
description: The Response object
|
||||||
|
schema:
|
||||||
|
$ref: '#/definitions/controllers.Response'
|
||||||
/api/update-ldap:
|
/api/update-ldap:
|
||||||
post:
|
post:
|
||||||
tags:
|
tags:
|
||||||
@@ -2994,7 +3189,7 @@ paths:
|
|||||||
"200":
|
"200":
|
||||||
description: '"The Response object"'
|
description: '"The Response object"'
|
||||||
schema:
|
schema:
|
||||||
$ref: '#/definitions/Response'
|
$ref: '#/definitions/controllers.Response'
|
||||||
/api/webauthn/signup/begin:
|
/api/webauthn/signup/begin:
|
||||||
get:
|
get:
|
||||||
tags:
|
tags:
|
||||||
@@ -3023,23 +3218,14 @@ paths:
|
|||||||
"200":
|
"200":
|
||||||
description: '"The Response object"'
|
description: '"The Response object"'
|
||||||
schema:
|
schema:
|
||||||
$ref: '#/definitions/Response'
|
$ref: '#/definitions/controllers.Response'
|
||||||
definitions:
|
definitions:
|
||||||
1225.0xc0002e2ae0.false:
|
|
||||||
title: "false"
|
|
||||||
type: object
|
|
||||||
1260.0xc0002e2b10.false:
|
|
||||||
title: "false"
|
|
||||||
type: object
|
|
||||||
LaravelResponse:
|
LaravelResponse:
|
||||||
title: LaravelResponse
|
title: LaravelResponse
|
||||||
type: object
|
type: object
|
||||||
Response:
|
Response:
|
||||||
title: Response
|
title: Response
|
||||||
type: object
|
type: object
|
||||||
The:
|
|
||||||
title: The
|
|
||||||
type: object
|
|
||||||
controllers.AuthForm:
|
controllers.AuthForm:
|
||||||
title: AuthForm
|
title: AuthForm
|
||||||
type: object
|
type: object
|
||||||
@@ -3064,9 +3250,13 @@ definitions:
|
|||||||
type: object
|
type: object
|
||||||
properties:
|
properties:
|
||||||
data:
|
data:
|
||||||
$ref: '#/definitions/1225.0xc0002e2ae0.false'
|
additionalProperties:
|
||||||
|
description: support string | class | List<class> and os on
|
||||||
|
type: string
|
||||||
data2:
|
data2:
|
||||||
$ref: '#/definitions/1260.0xc0002e2b10.false'
|
additionalProperties:
|
||||||
|
description: support string | class | List<class> and os on
|
||||||
|
type: string
|
||||||
msg:
|
msg:
|
||||||
type: string
|
type: string
|
||||||
name:
|
name:
|
||||||
@@ -3090,8 +3280,8 @@ definitions:
|
|||||||
jose.JSONWebKey:
|
jose.JSONWebKey:
|
||||||
title: JSONWebKey
|
title: JSONWebKey
|
||||||
type: object
|
type: object
|
||||||
object.&{179844 0xc000a02f90 false}:
|
object:
|
||||||
title: '&{179844 0xc000a02f90 false}'
|
title: object
|
||||||
type: object
|
type: object
|
||||||
object.AccountItem:
|
object.AccountItem:
|
||||||
title: AccountItem
|
title: AccountItem
|
||||||
@@ -3220,7 +3410,7 @@ definitions:
|
|||||||
title: CasbinRequest
|
title: CasbinRequest
|
||||||
type: array
|
type: array
|
||||||
items:
|
items:
|
||||||
$ref: '#/definitions/object.&{179844 0xc000a02f90 false}'
|
$ref: '#/definitions/object.CasbinRequest'
|
||||||
object.Cert:
|
object.Cert:
|
||||||
title: Cert
|
title: Cert
|
||||||
type: object
|
type: object
|
||||||
@@ -3295,6 +3485,44 @@ definitions:
|
|||||||
throughput:
|
throughput:
|
||||||
type: number
|
type: number
|
||||||
format: double
|
format: double
|
||||||
|
object.Group:
|
||||||
|
title: Group
|
||||||
|
type: object
|
||||||
|
properties:
|
||||||
|
children:
|
||||||
|
type: array
|
||||||
|
items:
|
||||||
|
$ref: '#/definitions/object.Group'
|
||||||
|
contactEmail:
|
||||||
|
type: string
|
||||||
|
createdTime:
|
||||||
|
type: string
|
||||||
|
displayName:
|
||||||
|
type: string
|
||||||
|
isEnabled:
|
||||||
|
type: boolean
|
||||||
|
isTopGroup:
|
||||||
|
type: boolean
|
||||||
|
key:
|
||||||
|
type: string
|
||||||
|
manager:
|
||||||
|
type: string
|
||||||
|
name:
|
||||||
|
type: string
|
||||||
|
owner:
|
||||||
|
type: string
|
||||||
|
parentId:
|
||||||
|
type: string
|
||||||
|
title:
|
||||||
|
type: string
|
||||||
|
type:
|
||||||
|
type: string
|
||||||
|
updatedTime:
|
||||||
|
type: string
|
||||||
|
users:
|
||||||
|
type: array
|
||||||
|
items:
|
||||||
|
$ref: '#/definitions/object.User'
|
||||||
object.Header:
|
object.Header:
|
||||||
title: Header
|
title: Header
|
||||||
type: object
|
type: object
|
||||||
@@ -3395,18 +3623,18 @@ definitions:
|
|||||||
properties:
|
properties:
|
||||||
countryCode:
|
countryCode:
|
||||||
type: string
|
type: string
|
||||||
id:
|
enabled:
|
||||||
type: string
|
type: boolean
|
||||||
isPreferred:
|
isPreferred:
|
||||||
type: boolean
|
type: boolean
|
||||||
|
mfaType:
|
||||||
|
type: string
|
||||||
recoveryCodes:
|
recoveryCodes:
|
||||||
type: array
|
type: array
|
||||||
items:
|
items:
|
||||||
type: string
|
type: string
|
||||||
secret:
|
secret:
|
||||||
type: string
|
type: string
|
||||||
type:
|
|
||||||
type: string
|
|
||||||
url:
|
url:
|
||||||
type: string
|
type: string
|
||||||
object.Model:
|
object.Model:
|
||||||
@@ -3415,6 +3643,8 @@ definitions:
|
|||||||
properties:
|
properties:
|
||||||
createdTime:
|
createdTime:
|
||||||
type: string
|
type: string
|
||||||
|
description:
|
||||||
|
type: string
|
||||||
displayName:
|
displayName:
|
||||||
type: string
|
type: string
|
||||||
isEnabled:
|
isEnabled:
|
||||||
@@ -3520,6 +3750,10 @@ definitions:
|
|||||||
type: string
|
type: string
|
||||||
owner:
|
owner:
|
||||||
type: string
|
type: string
|
||||||
|
passwordOptions:
|
||||||
|
type: array
|
||||||
|
items:
|
||||||
|
type: string
|
||||||
passwordSalt:
|
passwordSalt:
|
||||||
type: string
|
type: string
|
||||||
passwordType:
|
passwordType:
|
||||||
@@ -3607,6 +3841,8 @@ definitions:
|
|||||||
type: string
|
type: string
|
||||||
createdTime:
|
createdTime:
|
||||||
type: string
|
type: string
|
||||||
|
description:
|
||||||
|
type: string
|
||||||
displayName:
|
displayName:
|
||||||
type: string
|
type: string
|
||||||
domains:
|
domains:
|
||||||
@@ -3687,8 +3923,6 @@ definitions:
|
|||||||
type: string
|
type: string
|
||||||
displayName:
|
displayName:
|
||||||
type: string
|
type: string
|
||||||
hasTrial:
|
|
||||||
type: boolean
|
|
||||||
isEnabled:
|
isEnabled:
|
||||||
type: boolean
|
type: boolean
|
||||||
name:
|
name:
|
||||||
@@ -3904,6 +4138,8 @@ definitions:
|
|||||||
properties:
|
properties:
|
||||||
createdTime:
|
createdTime:
|
||||||
type: string
|
type: string
|
||||||
|
description:
|
||||||
|
type: string
|
||||||
displayName:
|
displayName:
|
||||||
type: string
|
type: string
|
||||||
domains:
|
domains:
|
||||||
@@ -3995,6 +4231,8 @@ definitions:
|
|||||||
type: string
|
type: string
|
||||||
isEnabled:
|
isEnabled:
|
||||||
type: boolean
|
type: boolean
|
||||||
|
isReadOnly:
|
||||||
|
type: boolean
|
||||||
name:
|
name:
|
||||||
type: string
|
type: string
|
||||||
organization:
|
organization:
|
||||||
@@ -4117,6 +4355,10 @@ definitions:
|
|||||||
title: User
|
title: User
|
||||||
type: object
|
type: object
|
||||||
properties:
|
properties:
|
||||||
|
accessKey:
|
||||||
|
type: string
|
||||||
|
accessSecret:
|
||||||
|
type: string
|
||||||
address:
|
address:
|
||||||
type: array
|
type: array
|
||||||
items:
|
items:
|
||||||
@@ -4135,6 +4377,8 @@ definitions:
|
|||||||
type: string
|
type: string
|
||||||
avatar:
|
avatar:
|
||||||
type: string
|
type: string
|
||||||
|
avatarType:
|
||||||
|
type: string
|
||||||
azuread:
|
azuread:
|
||||||
type: string
|
type: string
|
||||||
baidu:
|
baidu:
|
||||||
@@ -4205,6 +4449,10 @@ definitions:
|
|||||||
type: string
|
type: string
|
||||||
google:
|
google:
|
||||||
type: string
|
type: string
|
||||||
|
groups:
|
||||||
|
type: array
|
||||||
|
items:
|
||||||
|
type: string
|
||||||
hash:
|
hash:
|
||||||
type: string
|
type: string
|
||||||
heroku:
|
heroku:
|
||||||
@@ -4272,6 +4520,10 @@ definitions:
|
|||||||
$ref: '#/definitions/object.ManagedAccount'
|
$ref: '#/definitions/object.ManagedAccount'
|
||||||
meetup:
|
meetup:
|
||||||
type: string
|
type: string
|
||||||
|
mfaEmailEnabled:
|
||||||
|
type: boolean
|
||||||
|
mfaPhoneEnabled:
|
||||||
|
type: boolean
|
||||||
microsoftonline:
|
microsoftonline:
|
||||||
type: string
|
type: string
|
||||||
multiFactorAuths:
|
multiFactorAuths:
|
||||||
@@ -4312,6 +4564,8 @@ definitions:
|
|||||||
type: string
|
type: string
|
||||||
preHash:
|
preHash:
|
||||||
type: string
|
type: string
|
||||||
|
preferredMfaType:
|
||||||
|
type: string
|
||||||
properties:
|
properties:
|
||||||
additionalProperties:
|
additionalProperties:
|
||||||
type: string
|
type: string
|
||||||
@@ -4320,6 +4574,10 @@ definitions:
|
|||||||
ranking:
|
ranking:
|
||||||
type: integer
|
type: integer
|
||||||
format: int64
|
format: int64
|
||||||
|
recoveryCodes:
|
||||||
|
type: array
|
||||||
|
items:
|
||||||
|
type: string
|
||||||
region:
|
region:
|
||||||
type: string
|
type: string
|
||||||
roles:
|
roles:
|
||||||
@@ -4356,6 +4614,8 @@ definitions:
|
|||||||
type: string
|
type: string
|
||||||
title:
|
title:
|
||||||
type: string
|
type: string
|
||||||
|
totpSecret:
|
||||||
|
type: string
|
||||||
tumblr:
|
tumblr:
|
||||||
type: string
|
type: string
|
||||||
twitch:
|
twitch:
|
||||||
@@ -4404,12 +4664,14 @@ definitions:
|
|||||||
type: string
|
type: string
|
||||||
email:
|
email:
|
||||||
type: string
|
type: string
|
||||||
|
groups:
|
||||||
|
type: array
|
||||||
|
items:
|
||||||
|
type: string
|
||||||
iss:
|
iss:
|
||||||
type: string
|
type: string
|
||||||
name:
|
name:
|
||||||
type: string
|
type: string
|
||||||
organization:
|
|
||||||
type: string
|
|
||||||
phone:
|
phone:
|
||||||
type: string
|
type: string
|
||||||
picture:
|
picture:
|
||||||
@@ -4448,12 +4710,6 @@ definitions:
|
|||||||
type: string
|
type: string
|
||||||
url:
|
url:
|
||||||
type: string
|
type: string
|
||||||
object.pricing:
|
|
||||||
title: pricing
|
|
||||||
type: object
|
|
||||||
object.subscription:
|
|
||||||
title: subscription
|
|
||||||
type: object
|
|
||||||
protocol.CredentialAssertion:
|
protocol.CredentialAssertion:
|
||||||
title: CredentialAssertion
|
title: CredentialAssertion
|
||||||
type: object
|
type: object
|
||||||
|
@@ -72,6 +72,9 @@ func UrlJoin(base string, path string) string {
|
|||||||
|
|
||||||
func GetUrlPath(urlString string) string {
|
func GetUrlPath(urlString string) string {
|
||||||
u, _ := url.Parse(urlString)
|
u, _ := url.Parse(urlString)
|
||||||
|
if u == nil {
|
||||||
|
return ""
|
||||||
|
}
|
||||||
return u.Path
|
return u.Path
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -43,6 +43,15 @@ func ContainsString(values []string, val string) bool {
|
|||||||
return sort.SearchStrings(values, val) != len(values)
|
return sort.SearchStrings(values, val) != len(values)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func InSlice(slice []string, elem string) bool {
|
||||||
|
for _, val := range slice {
|
||||||
|
if val == elem {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
func ReturnAnyNotEmpty(strs ...string) string {
|
func ReturnAnyNotEmpty(strs ...string) string {
|
||||||
for _, str := range strs {
|
for _, str := range strs {
|
||||||
if str != "" {
|
if str != "" {
|
||||||
|
@@ -22,10 +22,18 @@ import (
|
|||||||
"github.com/nyaruka/phonenumbers"
|
"github.com/nyaruka/phonenumbers"
|
||||||
)
|
)
|
||||||
|
|
||||||
var rePhone *regexp.Regexp
|
var (
|
||||||
|
rePhone *regexp.Regexp
|
||||||
|
ReWhiteSpace *regexp.Regexp
|
||||||
|
ReFieldWhiteList *regexp.Regexp
|
||||||
|
ReUserName *regexp.Regexp
|
||||||
|
)
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
rePhone, _ = regexp.Compile(`(\d{3})\d*(\d{4})`)
|
rePhone, _ = regexp.Compile(`(\d{3})\d*(\d{4})`)
|
||||||
|
ReWhiteSpace, _ = regexp.Compile(`\s`)
|
||||||
|
ReFieldWhiteList, _ = regexp.Compile(`^[A-Za-z0-9]+$`)
|
||||||
|
ReUserName, _ = regexp.Compile("^[a-zA-Z0-9]+((?:-[a-zA-Z0-9]+)|(?:_[a-zA-Z0-9]+))*$")
|
||||||
}
|
}
|
||||||
|
|
||||||
func IsEmailValid(email string) bool {
|
func IsEmailValid(email string) bool {
|
||||||
@@ -70,3 +78,7 @@ func GetCountryCode(prefix string, phone string) (string, error) {
|
|||||||
|
|
||||||
return countryCode, nil
|
return countryCode, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func FilterField(field string) bool {
|
||||||
|
return ReFieldWhiteList.MatchString(field)
|
||||||
|
}
|
||||||
|
@@ -76,6 +76,10 @@ class AdapterEditPage extends React.Component {
|
|||||||
getModels(organizationName) {
|
getModels(organizationName) {
|
||||||
ModelBackend.getModels(organizationName)
|
ModelBackend.getModels(organizationName)
|
||||||
.then((res) => {
|
.then((res) => {
|
||||||
|
if (res.status === "error") {
|
||||||
|
Setting.showMessage("error", res.msg);
|
||||||
|
return;
|
||||||
|
}
|
||||||
this.setState({
|
this.setState({
|
||||||
models: res,
|
models: res,
|
||||||
});
|
});
|
||||||
|
@@ -25,8 +25,9 @@ import PopconfirmModal from "./common/modal/PopconfirmModal";
|
|||||||
class AdapterListPage extends BaseListPage {
|
class AdapterListPage extends BaseListPage {
|
||||||
newAdapter() {
|
newAdapter() {
|
||||||
const randomName = Setting.getRandomName();
|
const randomName = Setting.getRandomName();
|
||||||
|
const owner = Setting.getRequestOrganization(this.props.account);
|
||||||
return {
|
return {
|
||||||
owner: this.props.account.owner,
|
owner: owner,
|
||||||
name: `adapter_${randomName}`,
|
name: `adapter_${randomName}`,
|
||||||
createdTime: moment().format(),
|
createdTime: moment().format(),
|
||||||
type: "Database",
|
type: "Database",
|
||||||
@@ -87,7 +88,7 @@ class AdapterListPage extends BaseListPage {
|
|||||||
...this.getColumnSearchProps("name"),
|
...this.getColumnSearchProps("name"),
|
||||||
render: (text, record, index) => {
|
render: (text, record, index) => {
|
||||||
return (
|
return (
|
||||||
<Link to={`/adapters/${record.organization}/${text}`}>
|
<Link to={`/adapters/${record.owner}/${text}`}>
|
||||||
{text}
|
{text}
|
||||||
</Link>
|
</Link>
|
||||||
);
|
);
|
||||||
@@ -246,7 +247,7 @@ class AdapterListPage extends BaseListPage {
|
|||||||
value = params.type;
|
value = params.type;
|
||||||
}
|
}
|
||||||
this.setState({loading: true});
|
this.setState({loading: true});
|
||||||
AdapterBackend.getAdapters(Setting.isAdminUser(this.props.account) ? "" : this.props.account.owner, params.pagination.current, params.pagination.pageSize, field, value, sortField, sortOrder)
|
AdapterBackend.getAdapters(Setting.isDefaultOrganizationSelected(this.props.account) ? "" : Setting.getRequestOrganization(this.props.account), params.pagination.current, params.pagination.pageSize, field, value, sortField, sortOrder)
|
||||||
.then((res) => {
|
.then((res) => {
|
||||||
this.setState({
|
this.setState({
|
||||||
loading: false,
|
loading: false,
|
||||||
|
@@ -86,6 +86,7 @@ import {withTranslation} from "react-i18next";
|
|||||||
import ThemeSelect from "./common/select/ThemeSelect";
|
import ThemeSelect from "./common/select/ThemeSelect";
|
||||||
import SessionListPage from "./SessionListPage";
|
import SessionListPage from "./SessionListPage";
|
||||||
import MfaSetupPage from "./auth/MfaSetupPage";
|
import MfaSetupPage from "./auth/MfaSetupPage";
|
||||||
|
import OrganizationSelect from "./common/select/OrganizationSelect";
|
||||||
|
|
||||||
const {Header, Footer, Content} = Layout;
|
const {Header, Footer, Content} = Layout;
|
||||||
|
|
||||||
@@ -106,7 +107,7 @@ class App extends Component {
|
|||||||
Setting.initServerUrl();
|
Setting.initServerUrl();
|
||||||
Auth.initAuthWithConfig({
|
Auth.initAuthWithConfig({
|
||||||
serverUrl: Setting.ServerUrl,
|
serverUrl: Setting.ServerUrl,
|
||||||
appName: "app-built-in", // the application name of Casdoor itself, do not change it
|
appName: Conf.DefaultApplication, // the application used in Casdoor root path: "/"
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -398,6 +399,17 @@ class App extends Component {
|
|||||||
});
|
});
|
||||||
}} />
|
}} />
|
||||||
<LanguageSelect languages={this.state.account.organization.languages} />
|
<LanguageSelect languages={this.state.account.organization.languages} />
|
||||||
|
{Setting.isAdminUser(this.state.account) && !Setting.isMobile() &&
|
||||||
|
<OrganizationSelect
|
||||||
|
initValue={Setting.getOrganization()}
|
||||||
|
withAll={true}
|
||||||
|
style={{marginRight: "20px", width: "180px", display: "flex"}}
|
||||||
|
onChange={(value) => {
|
||||||
|
Setting.setOrganization(value);
|
||||||
|
}}
|
||||||
|
className="select-box"
|
||||||
|
/>
|
||||||
|
}
|
||||||
</React.Fragment>
|
</React.Fragment>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@@ -611,7 +623,7 @@ class App extends Component {
|
|||||||
<Route exact path="/subscriptions" render={(props) => this.renderLoginIfNotLoggedIn(<SubscriptionListPage account={this.state.account} {...props} />)} />
|
<Route exact path="/subscriptions" render={(props) => this.renderLoginIfNotLoggedIn(<SubscriptionListPage account={this.state.account} {...props} />)} />
|
||||||
<Route exact path="/subscriptions/:organizationName/:subscriptionName" render={(props) => this.renderLoginIfNotLoggedIn(<SubscriptionEditPage account={this.state.account} {...props} />)} />
|
<Route exact path="/subscriptions/:organizationName/:subscriptionName" render={(props) => this.renderLoginIfNotLoggedIn(<SubscriptionEditPage account={this.state.account} {...props} />)} />
|
||||||
<Route exact path="/products" render={(props) => this.renderLoginIfNotLoggedIn(<ProductListPage account={this.state.account} {...props} />)} />
|
<Route exact path="/products" render={(props) => this.renderLoginIfNotLoggedIn(<ProductListPage account={this.state.account} {...props} />)} />
|
||||||
<Route exact path="/products/:productName" render={(props) => this.renderLoginIfNotLoggedIn(<ProductEditPage account={this.state.account} {...props} />)} />
|
<Route exact path="/products/:organizationName/:productName" render={(props) => this.renderLoginIfNotLoggedIn(<ProductEditPage account={this.state.account} {...props} />)} />
|
||||||
<Route exact path="/products/:productName/buy" render={(props) => this.renderLoginIfNotLoggedIn(<ProductBuyPage account={this.state.account} {...props} />)} />
|
<Route exact path="/products/:productName/buy" render={(props) => this.renderLoginIfNotLoggedIn(<ProductBuyPage account={this.state.account} {...props} />)} />
|
||||||
<Route exact path="/payments" render={(props) => this.renderLoginIfNotLoggedIn(<PaymentListPage account={this.state.account} {...props} />)} />
|
<Route exact path="/payments" render={(props) => this.renderLoginIfNotLoggedIn(<PaymentListPage account={this.state.account} {...props} />)} />
|
||||||
<Route exact path="/payments/:paymentName" render={(props) => this.renderLoginIfNotLoggedIn(<PaymentEditPage account={this.state.account} {...props} />)} />
|
<Route exact path="/payments/:paymentName" render={(props) => this.renderLoginIfNotLoggedIn(<PaymentEditPage account={this.state.account} {...props} />)} />
|
||||||
@@ -651,6 +663,7 @@ class App extends Component {
|
|||||||
this.props.history.push(key);
|
this.props.history.push(key);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
const menuStyleRight = Setting.isAdminUser(this.state.account) && !Setting.isMobile() ? "calc(180px + 260px)" : "260px";
|
||||||
return (
|
return (
|
||||||
<Layout id="parent-area">
|
<Layout id="parent-area">
|
||||||
<Header style={{padding: "0", marginBottom: "3px", backgroundColor: this.state.themeAlgorithm.includes("dark") ? "black" : "white"}}>
|
<Header style={{padding: "0", marginBottom: "3px", backgroundColor: this.state.themeAlgorithm.includes("dark") ? "black" : "white"}}>
|
||||||
@@ -680,7 +693,7 @@ class App extends Component {
|
|||||||
items={this.getMenuItems()}
|
items={this.getMenuItems()}
|
||||||
mode={"horizontal"}
|
mode={"horizontal"}
|
||||||
selectedKeys={[this.state.selectedMenuKey]}
|
selectedKeys={[this.state.selectedMenuKey]}
|
||||||
style={{position: "absolute", left: "145px", right: "260px"}}
|
style={{position: "absolute", left: "145px", right: menuStyleRight}}
|
||||||
/>
|
/>
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
|
@@ -118,20 +118,30 @@ class ApplicationEditPage extends React.Component {
|
|||||||
|
|
||||||
getApplication() {
|
getApplication() {
|
||||||
ApplicationBackend.getApplication("admin", this.state.applicationName)
|
ApplicationBackend.getApplication("admin", this.state.applicationName)
|
||||||
.then((application) => {
|
.then((res) => {
|
||||||
if (application === null) {
|
if (res === null) {
|
||||||
this.props.history.push("/404");
|
this.props.history.push("/404");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (application.grantTypes === null || application.grantTypes === undefined || application.grantTypes.length === 0) {
|
if (res.status === "error") {
|
||||||
application.grantTypes = ["authorization_code"];
|
Setting.showMessage("error", res.msg);
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (res.grantTypes === null || res.grantTypes === undefined || res.grantTypes.length === 0) {
|
||||||
|
res.grantTypes = ["authorization_code"];
|
||||||
|
}
|
||||||
|
|
||||||
|
if (res.tags === null || res.tags === undefined) {
|
||||||
|
res.tags = [];
|
||||||
|
}
|
||||||
|
|
||||||
this.setState({
|
this.setState({
|
||||||
application: application,
|
application: res,
|
||||||
});
|
});
|
||||||
|
|
||||||
this.getCerts(application.organization);
|
this.getCerts(res.organization);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -307,6 +317,18 @@ class ApplicationEditPage extends React.Component {
|
|||||||
</Select>
|
</Select>
|
||||||
</Col>
|
</Col>
|
||||||
</Row>
|
</Row>
|
||||||
|
<Row style={{marginTop: "20px"}} >
|
||||||
|
<Col style={{marginTop: "5px"}} span={(Setting.isMobile()) ? 22 : 2}>
|
||||||
|
{Setting.getLabel(i18next.t("organization:Tags"), i18next.t("application:Tags - Tooltip"))} :
|
||||||
|
</Col>
|
||||||
|
<Col span={22} >
|
||||||
|
<Select virtual={false} mode="tags" style={{width: "100%"}} value={this.state.application.tags} onChange={(value => {this.updateApplicationField("tags", value);})}>
|
||||||
|
{
|
||||||
|
this.state.application.tags?.map((item, index) => <Option key={index} value={item}>{item}</Option>)
|
||||||
|
}
|
||||||
|
</Select>
|
||||||
|
</Col>
|
||||||
|
</Row>
|
||||||
<Row style={{marginTop: "20px"}} >
|
<Row style={{marginTop: "20px"}} >
|
||||||
<Col style={{marginTop: "5px"}} span={(Setting.isMobile()) ? 22 : 2}>
|
<Col style={{marginTop: "5px"}} span={(Setting.isMobile()) ? 22 : 2}>
|
||||||
{Setting.getLabel(i18next.t("provider:Client ID"), i18next.t("provider:Client ID - Tooltip"))} :
|
{Setting.getLabel(i18next.t("provider:Client ID"), i18next.t("provider:Client ID - Tooltip"))} :
|
||||||
|
@@ -28,18 +28,13 @@ class ApplicationListPage extends BaseListPage {
|
|||||||
super(props);
|
super(props);
|
||||||
}
|
}
|
||||||
|
|
||||||
componentDidMount() {
|
|
||||||
this.setState({
|
|
||||||
organizationName: this.props.account.owner,
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
newApplication() {
|
newApplication() {
|
||||||
const randomName = Setting.getRandomName();
|
const randomName = Setting.getRandomName();
|
||||||
|
const organizationName = Setting.getRequestOrganization(this.props.account);
|
||||||
return {
|
return {
|
||||||
owner: "admin", // this.props.account.applicationName,
|
owner: "admin", // this.props.account.applicationName,
|
||||||
name: `application_${randomName}`,
|
name: `application_${randomName}`,
|
||||||
organization: this.state.organizationName,
|
organization: organizationName,
|
||||||
createdTime: moment().format(),
|
createdTime: moment().format(),
|
||||||
displayName: `New Application - ${randomName}`,
|
displayName: `New Application - ${randomName}`,
|
||||||
logo: `${Setting.StaticBaseUrl}/img/casdoor-logo_1185x256.png`,
|
logo: `${Setting.StaticBaseUrl}/img/casdoor-logo_1185x256.png`,
|
||||||
@@ -273,8 +268,8 @@ class ApplicationListPage extends BaseListPage {
|
|||||||
const field = params.searchedColumn, value = params.searchText;
|
const field = params.searchedColumn, value = params.searchText;
|
||||||
const sortField = params.sortField, sortOrder = params.sortOrder;
|
const sortField = params.sortField, sortOrder = params.sortOrder;
|
||||||
this.setState({loading: true});
|
this.setState({loading: true});
|
||||||
(Setting.isAdminUser(this.props.account) ? ApplicationBackend.getApplications("admin", params.pagination.current, params.pagination.pageSize, field, value, sortField, sortOrder) :
|
(Setting.isDefaultOrganizationSelected(this.props.account) ? ApplicationBackend.getApplications("admin", params.pagination.current, params.pagination.pageSize, field, value, sortField, sortOrder) :
|
||||||
ApplicationBackend.getApplicationsByOrganization("admin", this.props.account.organization.name, params.pagination.current, params.pagination.pageSize, field, value, sortField, sortOrder))
|
ApplicationBackend.getApplicationsByOrganization("admin", Setting.getRequestOrganization(this.props.account), params.pagination.current, params.pagination.pageSize, field, value, sortField, sortOrder))
|
||||||
.then((res) => {
|
.then((res) => {
|
||||||
this.setState({
|
this.setState({
|
||||||
loading: false,
|
loading: false,
|
||||||
|
@@ -17,6 +17,7 @@ import {Button, Input, Result, Space} from "antd";
|
|||||||
import {SearchOutlined} from "@ant-design/icons";
|
import {SearchOutlined} from "@ant-design/icons";
|
||||||
import Highlighter from "react-highlight-words";
|
import Highlighter from "react-highlight-words";
|
||||||
import i18next from "i18next";
|
import i18next from "i18next";
|
||||||
|
import * as Setting from "./Setting";
|
||||||
|
|
||||||
class BaseListPage extends React.Component {
|
class BaseListPage extends React.Component {
|
||||||
constructor(props) {
|
constructor(props) {
|
||||||
@@ -35,6 +36,22 @@ class BaseListPage extends React.Component {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
handleOrganizationChange = () => {
|
||||||
|
const {pagination} = this.state;
|
||||||
|
this.fetch({pagination});
|
||||||
|
};
|
||||||
|
|
||||||
|
componentDidMount() {
|
||||||
|
window.addEventListener("storageOrganizationChanged", this.handleOrganizationChange);
|
||||||
|
if (!Setting.isAdminUser(this.props.account)) {
|
||||||
|
Setting.setOrganization("All");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
componentWillUnmount() {
|
||||||
|
window.removeEventListener("storageOrganizationChanged", this.handleOrganizationChange);
|
||||||
|
}
|
||||||
|
|
||||||
UNSAFE_componentWillMount() {
|
UNSAFE_componentWillMount() {
|
||||||
const {pagination} = this.state;
|
const {pagination} = this.state;
|
||||||
this.fetch({pagination});
|
this.fetch({pagination});
|
||||||
|
@@ -44,14 +44,19 @@ class CertEditPage extends React.Component {
|
|||||||
|
|
||||||
getCert() {
|
getCert() {
|
||||||
CertBackend.getCert(this.state.owner, this.state.certName)
|
CertBackend.getCert(this.state.owner, this.state.certName)
|
||||||
.then((cert) => {
|
.then((res) => {
|
||||||
if (cert === null) {
|
if (res === null) {
|
||||||
this.props.history.push("/404");
|
this.props.history.push("/404");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (res.status === "error") {
|
||||||
|
Setting.showMessage("error", res.msg);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
this.setState({
|
this.setState({
|
||||||
cert: cert,
|
cert: res,
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@@ -28,6 +28,7 @@ class CertListPage extends BaseListPage {
|
|||||||
}
|
}
|
||||||
|
|
||||||
componentDidMount() {
|
componentDidMount() {
|
||||||
|
super.componentDidMount();
|
||||||
this.setState({
|
this.setState({
|
||||||
owner: Setting.isAdminUser(this.props.account) ? "admin" : this.props.account.owner,
|
owner: Setting.isAdminUser(this.props.account) ? "admin" : this.props.account.owner,
|
||||||
});
|
});
|
||||||
@@ -35,8 +36,9 @@ class CertListPage extends BaseListPage {
|
|||||||
|
|
||||||
newCert() {
|
newCert() {
|
||||||
const randomName = Setting.getRandomName();
|
const randomName = Setting.getRandomName();
|
||||||
|
const owner = Setting.isDefaultOrganizationSelected(this.props.account) ? this.state.owner : Setting.getRequestOrganization(this.props.account);
|
||||||
return {
|
return {
|
||||||
owner: this.state.owner,
|
owner: owner,
|
||||||
name: `cert_${randomName}`,
|
name: `cert_${randomName}`,
|
||||||
createdTime: moment().format(),
|
createdTime: moment().format(),
|
||||||
displayName: `New Cert - ${randomName}`,
|
displayName: `New Cert - ${randomName}`,
|
||||||
@@ -236,8 +238,8 @@ class CertListPage extends BaseListPage {
|
|||||||
value = params.type;
|
value = params.type;
|
||||||
}
|
}
|
||||||
this.setState({loading: true});
|
this.setState({loading: true});
|
||||||
(Setting.isAdminUser(this.props.account) ? CertBackend.getGlobleCerts(params.pagination.current, params.pagination.pageSize, field, value, sortField, sortOrder)
|
(Setting.isDefaultOrganizationSelected(this.props.account) ? CertBackend.getGlobleCerts(params.pagination.current, params.pagination.pageSize, field, value, sortField, sortOrder)
|
||||||
: CertBackend.getCerts(this.props.account.owner, params.pagination.current, params.pagination.pageSize, field, value, sortField, sortOrder))
|
: CertBackend.getCerts(Setting.getRequestOrganization(this.props.account), params.pagination.current, params.pagination.pageSize, field, value, sortField, sortOrder))
|
||||||
.then((res) => {
|
.then((res) => {
|
||||||
this.setState({
|
this.setState({
|
||||||
loading: false,
|
loading: false,
|
||||||
|
@@ -40,17 +40,21 @@ class ChatEditPage extends React.Component {
|
|||||||
|
|
||||||
getChat() {
|
getChat() {
|
||||||
ChatBackend.getChat("admin", this.state.chatName)
|
ChatBackend.getChat("admin", this.state.chatName)
|
||||||
.then((chat) => {
|
.then((res) => {
|
||||||
if (chat === null) {
|
if (res === null) {
|
||||||
this.props.history.push("/404");
|
this.props.history.push("/404");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (res.status === "error") {
|
||||||
|
Setting.showMessage("error", res.msg);
|
||||||
|
return;
|
||||||
|
}
|
||||||
this.setState({
|
this.setState({
|
||||||
chat: chat,
|
chat: res,
|
||||||
});
|
});
|
||||||
|
|
||||||
this.getUsers(chat.organization);
|
this.getUsers(res.organization);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -66,6 +70,11 @@ class ChatEditPage extends React.Component {
|
|||||||
getUsers(organizationName) {
|
getUsers(organizationName) {
|
||||||
UserBackend.getUsers(organizationName)
|
UserBackend.getUsers(organizationName)
|
||||||
.then((res) => {
|
.then((res) => {
|
||||||
|
if (res.status === "error") {
|
||||||
|
Setting.showMessage("error", res.msg);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
this.setState({
|
this.setState({
|
||||||
users: res,
|
users: res,
|
||||||
});
|
});
|
||||||
|
@@ -25,12 +25,13 @@ import PopconfirmModal from "./common/modal/PopconfirmModal";
|
|||||||
class ChatListPage extends BaseListPage {
|
class ChatListPage extends BaseListPage {
|
||||||
newChat() {
|
newChat() {
|
||||||
const randomName = Setting.getRandomName();
|
const randomName = Setting.getRandomName();
|
||||||
|
const organizationName = Setting.getRequestOrganization(this.props.account);
|
||||||
return {
|
return {
|
||||||
owner: "admin", // this.props.account.applicationName,
|
owner: "admin", // this.props.account.applicationName,
|
||||||
name: `chat_${randomName}`,
|
name: `chat_${randomName}`,
|
||||||
createdTime: moment().format(),
|
createdTime: moment().format(),
|
||||||
updatedTime: moment().format(),
|
updatedTime: moment().format(),
|
||||||
organization: this.props.account.owner,
|
organization: organizationName,
|
||||||
displayName: `New Chat - ${randomName}`,
|
displayName: `New Chat - ${randomName}`,
|
||||||
type: "Single",
|
type: "Single",
|
||||||
category: "Chat Category - 1",
|
category: "Chat Category - 1",
|
||||||
|
@@ -1,34 +1,34 @@
|
|||||||
// Copyright 2021 The Casdoor Authors. All Rights Reserved.
|
// Copyright 2021 The Casdoor Authors. All Rights Reserved.
|
||||||
//
|
//
|
||||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
// you may not use this file except in compliance with the License.
|
// you may not use this file except in compliance with the License.
|
||||||
// You may obtain a copy of the License at
|
// You may obtain a copy of the License at
|
||||||
//
|
//
|
||||||
// http://www.apache.org/licenses/LICENSE-2.0
|
// http://www.apache.org/licenses/LICENSE-2.0
|
||||||
//
|
//
|
||||||
// Unless required by applicable law or agreed to in writing, software
|
// Unless required by applicable law or agreed to in writing, software
|
||||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
// See the License for the specific language governing permissions and
|
// See the License for the specific language governing permissions and
|
||||||
// limitations under the License.
|
// limitations under the License.
|
||||||
|
|
||||||
export const ShowGithubCorner = false;
|
export const DefaultApplication = "app-built-in";
|
||||||
export const GithubRepo = "https://github.com/casdoor/casdoor";
|
|
||||||
export const IsDemoMode = false;
|
export const ShowGithubCorner = false;
|
||||||
|
export const IsDemoMode = false;
|
||||||
export const ForceLanguage = "";
|
|
||||||
export const DefaultLanguage = "en";
|
export const ForceLanguage = "";
|
||||||
|
export const DefaultLanguage = "en";
|
||||||
export const EnableExtraPages = true;
|
|
||||||
|
export const EnableExtraPages = true;
|
||||||
export const EnableChatPages = true;
|
export const EnableChatPages = true;
|
||||||
|
|
||||||
export const InitThemeAlgorithm = true;
|
export const InitThemeAlgorithm = true;
|
||||||
export const ThemeDefault = {
|
export const ThemeDefault = {
|
||||||
themeType: "default",
|
themeType: "default",
|
||||||
colorPrimary: "#5734d3",
|
colorPrimary: "#5734d3",
|
||||||
borderRadius: 6,
|
borderRadius: 6,
|
||||||
isCompact: false,
|
isCompact: false,
|
||||||
};
|
};
|
||||||
|
|
||||||
export const CustomFooter = null;
|
export const CustomFooter = null;
|
||||||
|
@@ -74,8 +74,12 @@ class EntryPage extends React.Component {
|
|||||||
});
|
});
|
||||||
|
|
||||||
ApplicationBackend.getApplication("admin", pricing.application)
|
ApplicationBackend.getApplication("admin", pricing.application)
|
||||||
.then((application) => {
|
.then((res) => {
|
||||||
const themeData = application !== null ? Setting.getThemeData(application.organizationObj, application) : Conf.ThemeDefault;
|
if (res.status === "error") {
|
||||||
|
Setting.showMessage("error", res.msg);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
const themeData = res !== null ? Setting.getThemeData(res.organizationObj, res) : Conf.ThemeDefault;
|
||||||
this.props.updataThemeData(themeData);
|
this.props.updataThemeData(themeData);
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
@@ -49,8 +49,9 @@ class GroupListPage extends BaseListPage {
|
|||||||
|
|
||||||
newGroup() {
|
newGroup() {
|
||||||
const randomName = Setting.getRandomName();
|
const randomName = Setting.getRandomName();
|
||||||
|
const owner = Setting.getRequestOrganization(this.props.account);
|
||||||
return {
|
return {
|
||||||
owner: this.props.account.owner,
|
owner: owner,
|
||||||
name: `group_${randomName}`,
|
name: `group_${randomName}`,
|
||||||
createdTime: moment().format(),
|
createdTime: moment().format(),
|
||||||
updatedTime: moment().format(),
|
updatedTime: moment().format(),
|
||||||
@@ -251,7 +252,7 @@ class GroupListPage extends BaseListPage {
|
|||||||
value = params.type;
|
value = params.type;
|
||||||
}
|
}
|
||||||
this.setState({loading: true});
|
this.setState({loading: true});
|
||||||
GroupBackend.getGroups(this.state.owner, false, params.pagination.current, params.pagination.pageSize, field, value, sortField, sortOrder)
|
GroupBackend.getGroups(Setting.isDefaultOrganizationSelected(this.props.account) ? "" : Setting.getRequestOrganization(this.props.account), false, params.pagination.current, params.pagination.pageSize, field, value, sortField, sortOrder)
|
||||||
.then((res) => {
|
.then((res) => {
|
||||||
this.setState({
|
this.setState({
|
||||||
loading: false,
|
loading: false,
|
||||||
|
@@ -45,17 +45,20 @@ class MessageEditPage extends React.Component {
|
|||||||
|
|
||||||
getMessage() {
|
getMessage() {
|
||||||
MessageBackend.getMessage("admin", this.state.messageName)
|
MessageBackend.getMessage("admin", this.state.messageName)
|
||||||
.then((message) => {
|
.then((res) => {
|
||||||
if (message === null) {
|
if (res === null) {
|
||||||
this.props.history.push("/404");
|
this.props.history.push("/404");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
if (res.status === "error") {
|
||||||
|
Setting.showMessage("error", res.msg);
|
||||||
|
return;
|
||||||
|
}
|
||||||
this.setState({
|
this.setState({
|
||||||
message: message,
|
message: res,
|
||||||
});
|
});
|
||||||
|
|
||||||
this.getUsers(message.organization);
|
this.getUsers(res.organization);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -80,6 +83,10 @@ class MessageEditPage extends React.Component {
|
|||||||
getUsers(organizationName) {
|
getUsers(organizationName) {
|
||||||
UserBackend.getUsers(organizationName)
|
UserBackend.getUsers(organizationName)
|
||||||
.then((res) => {
|
.then((res) => {
|
||||||
|
if (res.status === "error") {
|
||||||
|
Setting.showMessage("error", res.msg);
|
||||||
|
return;
|
||||||
|
}
|
||||||
this.setState({
|
this.setState({
|
||||||
users: res,
|
users: res,
|
||||||
});
|
});
|
||||||
|
@@ -25,11 +25,12 @@ import PopconfirmModal from "./common/modal/PopconfirmModal";
|
|||||||
class MessageListPage extends BaseListPage {
|
class MessageListPage extends BaseListPage {
|
||||||
newMessage() {
|
newMessage() {
|
||||||
const randomName = Setting.getRandomName();
|
const randomName = Setting.getRandomName();
|
||||||
|
const organizationName = Setting.getRequestOrganization(this.props.account);
|
||||||
return {
|
return {
|
||||||
owner: "admin", // this.props.account.messagename,
|
owner: "admin", // this.props.account.messagename,
|
||||||
name: `message_${randomName}`,
|
name: `message_${randomName}`,
|
||||||
createdTime: moment().format(),
|
createdTime: moment().format(),
|
||||||
organization: this.props.account.owner,
|
organization: organizationName,
|
||||||
chat: "",
|
chat: "",
|
||||||
replyTo: "",
|
replyTo: "",
|
||||||
author: `${this.props.account.owner}/${this.props.account.name}`,
|
author: `${this.props.account.owner}/${this.props.account.name}`,
|
||||||
@@ -208,7 +209,7 @@ class MessageListPage extends BaseListPage {
|
|||||||
value = params.type;
|
value = params.type;
|
||||||
}
|
}
|
||||||
this.setState({loading: true});
|
this.setState({loading: true});
|
||||||
MessageBackend.getMessages("admin", Setting.isAdminUser(this.props.account) ? "" : this.props.account.owner, params.pagination.current, params.pagination.pageSize, field, value, sortField, sortOrder)
|
MessageBackend.getMessages("admin", Setting.isDefaultOrganizationSelected(this.props.account) ? "" : Setting.getRequestOrganization(this.props.account), params.pagination.current, params.pagination.pageSize, field, value, sortField, sortOrder)
|
||||||
.then((res) => {
|
.then((res) => {
|
||||||
this.setState({
|
this.setState({
|
||||||
loading: false,
|
loading: false,
|
||||||
|
@@ -47,14 +47,19 @@ class ModelEditPage extends React.Component {
|
|||||||
|
|
||||||
getModel() {
|
getModel() {
|
||||||
ModelBackend.getModel(this.state.organizationName, this.state.modelName)
|
ModelBackend.getModel(this.state.organizationName, this.state.modelName)
|
||||||
.then((model) => {
|
.then((res) => {
|
||||||
if (model === null) {
|
if (res === null) {
|
||||||
this.props.history.push("/404");
|
this.props.history.push("/404");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (res.status === "error") {
|
||||||
|
Setting.showMessage("error", res.msg);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
this.setState({
|
this.setState({
|
||||||
model: model,
|
model: res,
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@@ -40,8 +40,9 @@ m = g(r.sub, p.sub) && r.obj == p.obj && r.act == p.act`;
|
|||||||
class ModelListPage extends BaseListPage {
|
class ModelListPage extends BaseListPage {
|
||||||
newModel() {
|
newModel() {
|
||||||
const randomName = Setting.getRandomName();
|
const randomName = Setting.getRandomName();
|
||||||
|
const owner = Setting.getRequestOrganization(this.props.account);
|
||||||
return {
|
return {
|
||||||
owner: this.props.account.owner,
|
owner: owner,
|
||||||
name: `model_${randomName}`,
|
name: `model_${randomName}`,
|
||||||
createdTime: moment().format(),
|
createdTime: moment().format(),
|
||||||
displayName: `New Model - ${randomName}`,
|
displayName: `New Model - ${randomName}`,
|
||||||
@@ -202,7 +203,7 @@ class ModelListPage extends BaseListPage {
|
|||||||
value = params.type;
|
value = params.type;
|
||||||
}
|
}
|
||||||
this.setState({loading: true});
|
this.setState({loading: true});
|
||||||
ModelBackend.getModels(Setting.isAdminUser(this.props.account) ? "" : this.props.account.owner, params.pagination.current, params.pagination.pageSize, field, value, sortField, sortOrder)
|
ModelBackend.getModels(Setting.isDefaultOrganizationSelected(this.props.account) ? "" : Setting.getRequestOrganization(this.props.account), params.pagination.current, params.pagination.pageSize, field, value, sortField, sortOrder)
|
||||||
.then((res) => {
|
.then((res) => {
|
||||||
this.setState({
|
this.setState({
|
||||||
loading: false,
|
loading: false,
|
||||||
|
@@ -68,9 +68,14 @@ class OrganizationEditPage extends React.Component {
|
|||||||
|
|
||||||
getApplications() {
|
getApplications() {
|
||||||
ApplicationBackend.getApplicationsByOrganization("admin", this.state.organizationName)
|
ApplicationBackend.getApplicationsByOrganization("admin", this.state.organizationName)
|
||||||
.then((applications) => {
|
.then((res) => {
|
||||||
|
if (res.status === "error") {
|
||||||
|
Setting.showMessage("error", res.msg);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
this.setState({
|
this.setState({
|
||||||
applications: applications,
|
applications: res,
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -422,6 +427,7 @@ class OrganizationEditPage extends React.Component {
|
|||||||
this.setState({
|
this.setState({
|
||||||
organizationName: this.state.organization.name,
|
organizationName: this.state.organization.name,
|
||||||
});
|
});
|
||||||
|
window.dispatchEvent(new Event("storageOrganizationsChanged"));
|
||||||
|
|
||||||
if (willExist) {
|
if (willExist) {
|
||||||
this.props.history.push("/organizations");
|
this.props.history.push("/organizations");
|
||||||
@@ -443,6 +449,7 @@ class OrganizationEditPage extends React.Component {
|
|||||||
.then((res) => {
|
.then((res) => {
|
||||||
if (res.status === "ok") {
|
if (res.status === "ok") {
|
||||||
this.props.history.push("/organizations");
|
this.props.history.push("/organizations");
|
||||||
|
window.dispatchEvent(new Event("storageOrganizationsChanged"));
|
||||||
} else {
|
} else {
|
||||||
Setting.showMessage("error", `${i18next.t("general:Failed to delete")}: ${res.msg}`);
|
Setting.showMessage("error", `${i18next.t("general:Failed to delete")}: ${res.msg}`);
|
||||||
}
|
}
|
||||||
|
@@ -83,6 +83,7 @@ class OrganizationListPage extends BaseListPage {
|
|||||||
if (res.status === "ok") {
|
if (res.status === "ok") {
|
||||||
this.props.history.push({pathname: `/organizations/${newOrganization.name}`, mode: "add"});
|
this.props.history.push({pathname: `/organizations/${newOrganization.name}`, mode: "add"});
|
||||||
Setting.showMessage("success", i18next.t("general:Successfully added"));
|
Setting.showMessage("success", i18next.t("general:Successfully added"));
|
||||||
|
window.dispatchEvent(new Event("storageOrganizationsChanged"));
|
||||||
} else {
|
} else {
|
||||||
Setting.showMessage("error", `${i18next.t("general:Failed to add")}: ${res.msg}`);
|
Setting.showMessage("error", `${i18next.t("general:Failed to add")}: ${res.msg}`);
|
||||||
}
|
}
|
||||||
@@ -99,8 +100,11 @@ class OrganizationListPage extends BaseListPage {
|
|||||||
Setting.showMessage("success", i18next.t("general:Successfully deleted"));
|
Setting.showMessage("success", i18next.t("general:Successfully deleted"));
|
||||||
this.setState({
|
this.setState({
|
||||||
data: Setting.deleteRow(this.state.data, i),
|
data: Setting.deleteRow(this.state.data, i),
|
||||||
pagination: {total: this.state.pagination.total - 1},
|
pagination: {
|
||||||
|
...this.state.pagination,
|
||||||
|
total: this.state.pagination.total - 1},
|
||||||
});
|
});
|
||||||
|
window.dispatchEvent(new Event("storageOrganizationsChanged"));
|
||||||
} else {
|
} else {
|
||||||
Setting.showMessage("error", `${i18next.t("general:Failed to delete")}: ${res.msg}`);
|
Setting.showMessage("error", `${i18next.t("general:Failed to delete")}: ${res.msg}`);
|
||||||
}
|
}
|
||||||
@@ -275,7 +279,7 @@ class OrganizationListPage extends BaseListPage {
|
|||||||
value = params.passwordType;
|
value = params.passwordType;
|
||||||
}
|
}
|
||||||
this.setState({loading: true});
|
this.setState({loading: true});
|
||||||
OrganizationBackend.getOrganizations("admin", params.pagination.current, params.pagination.pageSize, field, value, sortField, sortOrder)
|
OrganizationBackend.getOrganizations("admin", Setting.isDefaultOrganizationSelected(this.props.account) ? "" : Setting.getRequestOrganization(this.props.account), params.pagination.current, params.pagination.pageSize, field, value, sortField, sortOrder)
|
||||||
.then((res) => {
|
.then((res) => {
|
||||||
this.setState({
|
this.setState({
|
||||||
loading: false,
|
loading: false,
|
||||||
|
@@ -26,6 +26,7 @@ import PopconfirmModal from "./common/modal/PopconfirmModal";
|
|||||||
class PaymentListPage extends BaseListPage {
|
class PaymentListPage extends BaseListPage {
|
||||||
newPayment() {
|
newPayment() {
|
||||||
const randomName = Setting.getRandomName();
|
const randomName = Setting.getRandomName();
|
||||||
|
const organizationName = Setting.getRequestOrganization(this.props.account);
|
||||||
return {
|
return {
|
||||||
owner: "admin",
|
owner: "admin",
|
||||||
name: `payment_${randomName}`,
|
name: `payment_${randomName}`,
|
||||||
@@ -33,7 +34,7 @@ class PaymentListPage extends BaseListPage {
|
|||||||
displayName: `New Payment - ${randomName}`,
|
displayName: `New Payment - ${randomName}`,
|
||||||
provider: "provider_pay_paypal",
|
provider: "provider_pay_paypal",
|
||||||
type: "PayPal",
|
type: "PayPal",
|
||||||
organization: this.props.account.owner,
|
organization: organizationName,
|
||||||
user: "admin",
|
user: "admin",
|
||||||
productName: "computer-1",
|
productName: "computer-1",
|
||||||
productDisplayName: "A notebook computer",
|
productDisplayName: "A notebook computer",
|
||||||
@@ -265,7 +266,7 @@ class PaymentListPage extends BaseListPage {
|
|||||||
value = params.type;
|
value = params.type;
|
||||||
}
|
}
|
||||||
this.setState({loading: true});
|
this.setState({loading: true});
|
||||||
PaymentBackend.getPayments("admin", Setting.isAdminUser(this.props.account) ? "" : this.props.account.owner, params.pagination.current, params.pagination.pageSize, field, value, sortField, sortOrder)
|
PaymentBackend.getPayments("admin", Setting.isDefaultOrganizationSelected(this.props.account) ? "" : Setting.getRequestOrganization(this.props.account), params.pagination.current, params.pagination.pageSize, field, value, sortField, sortOrder)
|
||||||
.then((res) => {
|
.then((res) => {
|
||||||
this.setState({
|
this.setState({
|
||||||
loading: false,
|
loading: false,
|
||||||
|
@@ -49,21 +49,26 @@ class PermissionEditPage extends React.Component {
|
|||||||
|
|
||||||
getPermission() {
|
getPermission() {
|
||||||
PermissionBackend.getPermission(this.state.organizationName, this.state.permissionName)
|
PermissionBackend.getPermission(this.state.organizationName, this.state.permissionName)
|
||||||
.then((permission) => {
|
.then((res) => {
|
||||||
if (permission === null) {
|
if (res === null) {
|
||||||
this.props.history.push("/404");
|
this.props.history.push("/404");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (res.status === "error") {
|
||||||
|
Setting.showMessage("error", res.msg);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
this.setState({
|
this.setState({
|
||||||
permission: permission,
|
permission: res,
|
||||||
});
|
});
|
||||||
|
|
||||||
this.getUsers(permission.owner);
|
this.getUsers(res.owner);
|
||||||
this.getRoles(permission.owner);
|
this.getRoles(res.owner);
|
||||||
this.getModels(permission.owner);
|
this.getModels(res.owner);
|
||||||
this.getResources(permission.owner);
|
this.getResources(res.owner);
|
||||||
this.getModel(permission.owner, permission.model);
|
this.getModel(res.owner, res.model);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -79,6 +84,10 @@ class PermissionEditPage extends React.Component {
|
|||||||
getUsers(organizationName) {
|
getUsers(organizationName) {
|
||||||
UserBackend.getUsers(organizationName)
|
UserBackend.getUsers(organizationName)
|
||||||
.then((res) => {
|
.then((res) => {
|
||||||
|
if (res.status === "error") {
|
||||||
|
Setting.showMessage("error", res.msg);
|
||||||
|
return;
|
||||||
|
}
|
||||||
this.setState({
|
this.setState({
|
||||||
users: res,
|
users: res,
|
||||||
});
|
});
|
||||||
@@ -88,6 +97,10 @@ class PermissionEditPage extends React.Component {
|
|||||||
getRoles(organizationName) {
|
getRoles(organizationName) {
|
||||||
RoleBackend.getRoles(organizationName)
|
RoleBackend.getRoles(organizationName)
|
||||||
.then((res) => {
|
.then((res) => {
|
||||||
|
if (res.status === "error") {
|
||||||
|
Setting.showMessage("error", res.msg);
|
||||||
|
return;
|
||||||
|
}
|
||||||
this.setState({
|
this.setState({
|
||||||
roles: res,
|
roles: res,
|
||||||
});
|
});
|
||||||
@@ -97,6 +110,10 @@ class PermissionEditPage extends React.Component {
|
|||||||
getModels(organizationName) {
|
getModels(organizationName) {
|
||||||
ModelBackend.getModels(organizationName)
|
ModelBackend.getModels(organizationName)
|
||||||
.then((res) => {
|
.then((res) => {
|
||||||
|
if (res.status === "error") {
|
||||||
|
Setting.showMessage("error", res.msg);
|
||||||
|
return;
|
||||||
|
}
|
||||||
this.setState({
|
this.setState({
|
||||||
models: res,
|
models: res,
|
||||||
});
|
});
|
||||||
@@ -106,6 +123,10 @@ class PermissionEditPage extends React.Component {
|
|||||||
getModel(organizationName, modelName) {
|
getModel(organizationName, modelName) {
|
||||||
ModelBackend.getModel(organizationName, modelName)
|
ModelBackend.getModel(organizationName, modelName)
|
||||||
.then((res) => {
|
.then((res) => {
|
||||||
|
if (res.status === "error") {
|
||||||
|
Setting.showMessage("error", res.msg);
|
||||||
|
return;
|
||||||
|
}
|
||||||
this.setState({
|
this.setState({
|
||||||
model: res,
|
model: res,
|
||||||
});
|
});
|
||||||
|
@@ -26,8 +26,9 @@ import {UploadOutlined} from "@ant-design/icons";
|
|||||||
class PermissionListPage extends BaseListPage {
|
class PermissionListPage extends BaseListPage {
|
||||||
newPermission() {
|
newPermission() {
|
||||||
const randomName = Setting.getRandomName();
|
const randomName = Setting.getRandomName();
|
||||||
|
const owner = Setting.getRequestOrganization(this.props.account);
|
||||||
return {
|
return {
|
||||||
owner: this.props.account.owner,
|
owner: owner,
|
||||||
name: `permission_${randomName}`,
|
name: `permission_${randomName}`,
|
||||||
createdTime: moment().format(),
|
createdTime: moment().format(),
|
||||||
displayName: `New Permission - ${randomName}`,
|
displayName: `New Permission - ${randomName}`,
|
||||||
@@ -383,7 +384,7 @@ class PermissionListPage extends BaseListPage {
|
|||||||
this.setState({loading: true});
|
this.setState({loading: true});
|
||||||
|
|
||||||
const getPermissions = Setting.isLocalAdminUser(this.props.account) ? PermissionBackend.getPermissions : PermissionBackend.getPermissionsBySubmitter;
|
const getPermissions = Setting.isLocalAdminUser(this.props.account) ? PermissionBackend.getPermissions : PermissionBackend.getPermissionsBySubmitter;
|
||||||
getPermissions(Setting.isAdminUser(this.props.account) ? "" : this.props.account.owner, params.pagination.current, params.pagination.pageSize, field, value, sortField, sortOrder)
|
getPermissions(Setting.isDefaultOrganizationSelected(this.props.account) ? "" : Setting.getRequestOrganization(this.props.account), params.pagination.current, params.pagination.pageSize, field, value, sortField, sortOrder)
|
||||||
.then((res) => {
|
.then((res) => {
|
||||||
this.setState({
|
this.setState({
|
||||||
loading: false,
|
loading: false,
|
||||||
|
@@ -64,6 +64,10 @@ class PlanEditPage extends React.Component {
|
|||||||
getRoles(organizationName) {
|
getRoles(organizationName) {
|
||||||
RoleBackend.getRoles(organizationName)
|
RoleBackend.getRoles(organizationName)
|
||||||
.then((res) => {
|
.then((res) => {
|
||||||
|
if (res.status === "error") {
|
||||||
|
Setting.showMessage("error", res.msg);
|
||||||
|
return;
|
||||||
|
}
|
||||||
this.setState({
|
this.setState({
|
||||||
roles: res,
|
roles: res,
|
||||||
});
|
});
|
||||||
@@ -73,6 +77,10 @@ class PlanEditPage extends React.Component {
|
|||||||
getUsers(organizationName) {
|
getUsers(organizationName) {
|
||||||
UserBackend.getUsers(organizationName)
|
UserBackend.getUsers(organizationName)
|
||||||
.then((res) => {
|
.then((res) => {
|
||||||
|
if (res.status === "error") {
|
||||||
|
Setting.showMessage("error", res.msg);
|
||||||
|
return;
|
||||||
|
}
|
||||||
this.setState({
|
this.setState({
|
||||||
users: res,
|
users: res,
|
||||||
});
|
});
|
||||||
|
@@ -25,8 +25,7 @@ import PopconfirmModal from "./common/modal/PopconfirmModal";
|
|||||||
class PlanListPage extends BaseListPage {
|
class PlanListPage extends BaseListPage {
|
||||||
newPlan() {
|
newPlan() {
|
||||||
const randomName = Setting.getRandomName();
|
const randomName = Setting.getRandomName();
|
||||||
const owner = (this.state.organizationName !== undefined) ? this.state.organizationName : this.props.account.owner;
|
const owner = Setting.getRequestOrganization(this.props.account);
|
||||||
|
|
||||||
return {
|
return {
|
||||||
owner: owner,
|
owner: owner,
|
||||||
name: `plan_${randomName}`,
|
name: `plan_${randomName}`,
|
||||||
@@ -219,7 +218,7 @@ class PlanListPage extends BaseListPage {
|
|||||||
value = params.type;
|
value = params.type;
|
||||||
}
|
}
|
||||||
this.setState({loading: true});
|
this.setState({loading: true});
|
||||||
PlanBackend.getPlans(Setting.isAdminUser(this.props.account) ? "" : this.props.account.owner, params.pagination.current, params.pagination.pageSize, field, value, sortField, sortOrder)
|
PlanBackend.getPlans(Setting.isDefaultOrganizationSelected(this.props.account) ? "" : Setting.getRequestOrganization(this.props.account), params.pagination.current, params.pagination.pageSize, field, value, sortField, sortOrder)
|
||||||
.then((res) => {
|
.then((res) => {
|
||||||
this.setState({
|
this.setState({
|
||||||
loading: false,
|
loading: false,
|
||||||
|
@@ -49,22 +49,31 @@ class PricingEditPage extends React.Component {
|
|||||||
|
|
||||||
getPricing() {
|
getPricing() {
|
||||||
PricingBackend.getPricing(this.state.organizationName, this.state.pricingName)
|
PricingBackend.getPricing(this.state.organizationName, this.state.pricingName)
|
||||||
.then((pricing) => {
|
.then((res) => {
|
||||||
if (pricing === null) {
|
if (res === null) {
|
||||||
this.props.history.push("/404");
|
this.props.history.push("/404");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (res.status === "error") {
|
||||||
|
Setting.showMessage("error", res.msg);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
this.setState({
|
this.setState({
|
||||||
pricing: pricing,
|
pricing: res,
|
||||||
});
|
});
|
||||||
this.getPlans(pricing.owner);
|
this.getPlans(res.owner);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
getPlans(organizationName) {
|
getPlans(organizationName) {
|
||||||
PlanBackend.getPlans(organizationName)
|
PlanBackend.getPlans(organizationName)
|
||||||
.then((res) => {
|
.then((res) => {
|
||||||
|
if (res.status === "error") {
|
||||||
|
Setting.showMessage("error", res.msg);
|
||||||
|
return;
|
||||||
|
}
|
||||||
this.setState({
|
this.setState({
|
||||||
plans: res,
|
plans: res,
|
||||||
});
|
});
|
||||||
@@ -109,9 +118,13 @@ class PricingEditPage extends React.Component {
|
|||||||
|
|
||||||
getUserApplication() {
|
getUserApplication() {
|
||||||
ApplicationBackend.getUserApplication(this.state.organizationName, this.state.userName)
|
ApplicationBackend.getUserApplication(this.state.organizationName, this.state.userName)
|
||||||
.then((application) => {
|
.then((res) => {
|
||||||
|
if (res.status === "error") {
|
||||||
|
Setting.showMessage("error", res.msg);
|
||||||
|
return;
|
||||||
|
}
|
||||||
this.setState({
|
this.setState({
|
||||||
application: application,
|
application: res,
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@@ -25,8 +25,7 @@ import PopconfirmModal from "./common/modal/PopconfirmModal";
|
|||||||
class PricingListPage extends BaseListPage {
|
class PricingListPage extends BaseListPage {
|
||||||
newPricing() {
|
newPricing() {
|
||||||
const randomName = Setting.getRandomName();
|
const randomName = Setting.getRandomName();
|
||||||
const owner = (this.state.organizationName !== undefined) ? this.state.organizationName : this.props.account.owner;
|
const owner = Setting.getRequestOrganization(this.props.account);
|
||||||
|
|
||||||
return {
|
return {
|
||||||
owner: owner,
|
owner: owner,
|
||||||
name: `pricing_${randomName}`,
|
name: `pricing_${randomName}`,
|
||||||
@@ -188,7 +187,7 @@ class PricingListPage extends BaseListPage {
|
|||||||
value = params.type;
|
value = params.type;
|
||||||
}
|
}
|
||||||
this.setState({loading: true});
|
this.setState({loading: true});
|
||||||
PricingBackend.getPricings(Setting.isAdminUser(this.props.account) ? "" : this.props.account.owner, params.pagination.current, params.pagination.pageSize, field, value, sortField, sortOrder)
|
PricingBackend.getPricings(Setting.isDefaultOrganizationSelected(this.props.account) ? "" : Setting.getRequestOrganization(this.props.account), params.pagination.current, params.pagination.pageSize, field, value, sortField, sortOrder)
|
||||||
.then((res) => {
|
.then((res) => {
|
||||||
this.setState({
|
this.setState({
|
||||||
loading: false,
|
loading: false,
|
||||||
|
@@ -41,9 +41,14 @@ class ProductBuyPage extends React.Component {
|
|||||||
}
|
}
|
||||||
|
|
||||||
ProductBackend.getProduct(this.props.account.owner, this.state.productName)
|
ProductBackend.getProduct(this.props.account.owner, this.state.productName)
|
||||||
.then((product) => {
|
.then((res) => {
|
||||||
|
if (res.status === "error") {
|
||||||
|
Setting.showMessage("error", res.msg);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
this.setState({
|
this.setState({
|
||||||
product: product,
|
product: res,
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@@ -20,6 +20,7 @@ import i18next from "i18next";
|
|||||||
import {LinkOutlined} from "@ant-design/icons";
|
import {LinkOutlined} from "@ant-design/icons";
|
||||||
import * as ProviderBackend from "./backend/ProviderBackend";
|
import * as ProviderBackend from "./backend/ProviderBackend";
|
||||||
import ProductBuyPage from "./ProductBuyPage";
|
import ProductBuyPage from "./ProductBuyPage";
|
||||||
|
import * as OrganizationBackend from "./backend/OrganizationBackend";
|
||||||
|
|
||||||
const {Option} = Select;
|
const {Option} = Select;
|
||||||
|
|
||||||
@@ -39,11 +40,12 @@ class ProductEditPage extends React.Component {
|
|||||||
|
|
||||||
UNSAFE_componentWillMount() {
|
UNSAFE_componentWillMount() {
|
||||||
this.getProduct();
|
this.getProduct();
|
||||||
|
this.getOrganizations();
|
||||||
this.getPaymentProviders();
|
this.getPaymentProviders();
|
||||||
}
|
}
|
||||||
|
|
||||||
getProduct() {
|
getProduct() {
|
||||||
ProductBackend.getProduct(this.props.account.owner, this.state.productName)
|
ProductBackend.getProduct(this.state.organizationName, this.state.productName)
|
||||||
.then((product) => {
|
.then((product) => {
|
||||||
if (product === null) {
|
if (product === null) {
|
||||||
this.props.history.push("/404");
|
this.props.history.push("/404");
|
||||||
@@ -56,6 +58,15 @@ class ProductEditPage extends React.Component {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
getOrganizations() {
|
||||||
|
OrganizationBackend.getOrganizations("admin")
|
||||||
|
.then((res) => {
|
||||||
|
this.setState({
|
||||||
|
organizations: (res.msg === undefined) ? res : [],
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
getPaymentProviders() {
|
getPaymentProviders() {
|
||||||
ProviderBackend.getProviders(this.props.account.owner)
|
ProviderBackend.getProviders(this.props.account.owner)
|
||||||
.then((res) => {
|
.then((res) => {
|
||||||
@@ -312,7 +323,7 @@ class ProductEditPage extends React.Component {
|
|||||||
if (willExist) {
|
if (willExist) {
|
||||||
this.props.history.push("/products");
|
this.props.history.push("/products");
|
||||||
} else {
|
} else {
|
||||||
this.props.history.push(`/products/${this.state.product.name}`);
|
this.props.history.push(`/products/${this.state.product.owner}/${this.state.product.name}`);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
Setting.showMessage("error", `${i18next.t("general:Failed to save")}: ${res.msg}`);
|
Setting.showMessage("error", `${i18next.t("general:Failed to save")}: ${res.msg}`);
|
||||||
|
@@ -26,8 +26,9 @@ import PopconfirmModal from "./common/modal/PopconfirmModal";
|
|||||||
class ProductListPage extends BaseListPage {
|
class ProductListPage extends BaseListPage {
|
||||||
newProduct() {
|
newProduct() {
|
||||||
const randomName = Setting.getRandomName();
|
const randomName = Setting.getRandomName();
|
||||||
|
const owner = Setting.getRequestOrganization(this.props.account);
|
||||||
return {
|
return {
|
||||||
owner: this.props.account.owner,
|
owner: owner,
|
||||||
name: `product_${randomName}`,
|
name: `product_${randomName}`,
|
||||||
createdTime: moment().format(),
|
createdTime: moment().format(),
|
||||||
displayName: `New Product - ${randomName}`,
|
displayName: `New Product - ${randomName}`,
|
||||||
@@ -47,7 +48,7 @@ class ProductListPage extends BaseListPage {
|
|||||||
ProductBackend.addProduct(newProduct)
|
ProductBackend.addProduct(newProduct)
|
||||||
.then((res) => {
|
.then((res) => {
|
||||||
if (res.status === "ok") {
|
if (res.status === "ok") {
|
||||||
this.props.history.push({pathname: `/products/${newProduct.name}`, mode: "add"});
|
this.props.history.push({pathname: `/products/${newProduct.owner}/${newProduct.name}`, mode: "add"});
|
||||||
Setting.showMessage("success", i18next.t("general:Successfully added"));
|
Setting.showMessage("success", i18next.t("general:Successfully added"));
|
||||||
} else {
|
} else {
|
||||||
Setting.showMessage("error", `${i18next.t("general:Failed to add")}: ${res.msg}`);
|
Setting.showMessage("error", `${i18next.t("general:Failed to add")}: ${res.msg}`);
|
||||||
@@ -88,7 +89,7 @@ class ProductListPage extends BaseListPage {
|
|||||||
...this.getColumnSearchProps("name"),
|
...this.getColumnSearchProps("name"),
|
||||||
render: (text, record, index) => {
|
render: (text, record, index) => {
|
||||||
return (
|
return (
|
||||||
<Link to={`/products/${text}`}>
|
<Link to={`/products/${record.owner}/${text}`}>
|
||||||
{text}
|
{text}
|
||||||
</Link>
|
</Link>
|
||||||
);
|
);
|
||||||
@@ -201,7 +202,7 @@ class ProductListPage extends BaseListPage {
|
|||||||
size="small"
|
size="small"
|
||||||
locale={{emptyText: " "}}
|
locale={{emptyText: " "}}
|
||||||
dataSource={providers}
|
dataSource={providers}
|
||||||
renderItem={(providerName, i) => {
|
renderItem={(providerName, record, i) => {
|
||||||
return (
|
return (
|
||||||
<List.Item>
|
<List.Item>
|
||||||
<div style={{display: "inline"}}>
|
<div style={{display: "inline"}}>
|
||||||
@@ -247,7 +248,7 @@ class ProductListPage extends BaseListPage {
|
|||||||
return (
|
return (
|
||||||
<div>
|
<div>
|
||||||
<Button style={{marginTop: "10px", marginBottom: "10px", marginRight: "10px"}} onClick={() => this.props.history.push(`/products/${record.name}/buy`)}>{i18next.t("product:Buy")}</Button>
|
<Button style={{marginTop: "10px", marginBottom: "10px", marginRight: "10px"}} onClick={() => this.props.history.push(`/products/${record.name}/buy`)}>{i18next.t("product:Buy")}</Button>
|
||||||
<Button style={{marginTop: "10px", marginBottom: "10px", marginRight: "10px"}} type="primary" onClick={() => this.props.history.push(`/products/${record.name}`)}>{i18next.t("general:Edit")}</Button>
|
<Button style={{marginTop: "10px", marginBottom: "10px", marginRight: "10px"}} type="primary" onClick={() => this.props.history.push(`/products/${record.owner}/${record.name}`)}>{i18next.t("general:Edit")}</Button>
|
||||||
<PopconfirmModal
|
<PopconfirmModal
|
||||||
title={i18next.t("general:Sure to delete") + `: ${record.name} ?`}
|
title={i18next.t("general:Sure to delete") + `: ${record.name} ?`}
|
||||||
onConfirm={() => this.deleteProduct(index)}
|
onConfirm={() => this.deleteProduct(index)}
|
||||||
@@ -268,7 +269,7 @@ class ProductListPage extends BaseListPage {
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<div>
|
<div>
|
||||||
<Table scroll={{x: "max-content"}} columns={columns} dataSource={products} rowKey="name" size="middle" bordered pagination={paginationProps}
|
<Table scroll={{x: "max-content"}} columns={columns} dataSource={products} rowKey={(record) => `${record.owner}/${record.name}`} size="middle" bordered pagination={paginationProps}
|
||||||
title={() => (
|
title={() => (
|
||||||
<div>
|
<div>
|
||||||
{i18next.t("general:Products")}
|
{i18next.t("general:Products")}
|
||||||
@@ -290,7 +291,7 @@ class ProductListPage extends BaseListPage {
|
|||||||
value = params.type;
|
value = params.type;
|
||||||
}
|
}
|
||||||
this.setState({loading: true});
|
this.setState({loading: true});
|
||||||
ProductBackend.getProducts(Setting.isAdminUser(this.props.account) ? "" : this.props.account.owner, params.pagination.current, params.pagination.pageSize, field, value, sortField, sortOrder)
|
ProductBackend.getProducts(Setting.isDefaultOrganizationSelected(this.props.account) ? "" : Setting.getRequestOrganization(this.props.account), params.pagination.current, params.pagination.pageSize, field, value, sortField, sortOrder)
|
||||||
.then((res) => {
|
.then((res) => {
|
||||||
this.setState({
|
this.setState({
|
||||||
loading: false,
|
loading: false,
|
||||||
|
@@ -29,6 +29,7 @@ class ProviderListPage extends BaseListPage {
|
|||||||
}
|
}
|
||||||
|
|
||||||
componentDidMount() {
|
componentDidMount() {
|
||||||
|
super.componentDidMount();
|
||||||
this.setState({
|
this.setState({
|
||||||
owner: Setting.isAdminUser(this.props.account) ? "admin" : this.props.account.owner,
|
owner: Setting.isAdminUser(this.props.account) ? "admin" : this.props.account.owner,
|
||||||
});
|
});
|
||||||
@@ -36,8 +37,9 @@ class ProviderListPage extends BaseListPage {
|
|||||||
|
|
||||||
newProvider() {
|
newProvider() {
|
||||||
const randomName = Setting.getRandomName();
|
const randomName = Setting.getRandomName();
|
||||||
|
const owner = Setting.isDefaultOrganizationSelected(this.props.account) ? this.state.owner : Setting.getRequestOrganization();
|
||||||
return {
|
return {
|
||||||
owner: this.state.owner,
|
owner: owner,
|
||||||
name: `provider_${randomName}`,
|
name: `provider_${randomName}`,
|
||||||
createdTime: moment().format(),
|
createdTime: moment().format(),
|
||||||
displayName: `New Provider - ${randomName}`,
|
displayName: `New Provider - ${randomName}`,
|
||||||
@@ -256,8 +258,8 @@ class ProviderListPage extends BaseListPage {
|
|||||||
value = params.type;
|
value = params.type;
|
||||||
}
|
}
|
||||||
this.setState({loading: true});
|
this.setState({loading: true});
|
||||||
(Setting.isAdminUser(this.props.account) ? ProviderBackend.getGlobalProviders(params.pagination.current, params.pagination.pageSize, field, value, sortField, sortOrder)
|
(Setting.isDefaultOrganizationSelected(this.props.account) ? ProviderBackend.getGlobalProviders(params.pagination.current, params.pagination.pageSize, field, value, sortField, sortOrder)
|
||||||
: ProviderBackend.getProviders(this.props.account.owner, params.pagination.current, params.pagination.pageSize, field, value, sortField, sortOrder))
|
: ProviderBackend.getProviders(Setting.getRequestOrganization(this.props.account), params.pagination.current, params.pagination.pageSize, field, value, sortField, sortOrder))
|
||||||
.then((res) => {
|
.then((res) => {
|
||||||
this.setState({
|
this.setState({
|
||||||
loading: false,
|
loading: false,
|
||||||
|
@@ -209,7 +209,7 @@ class RecordListPage extends BaseListPage {
|
|||||||
value = params.method;
|
value = params.method;
|
||||||
}
|
}
|
||||||
this.setState({loading: true});
|
this.setState({loading: true});
|
||||||
RecordBackend.getRecords(params.pagination.current, params.pagination.pageSize, field, value, sortField, sortOrder)
|
RecordBackend.getRecords(Setting.isDefaultOrganizationSelected(this.props.account) ? "" : Setting.getRequestOrganization(this.props.account), params.pagination.current, params.pagination.pageSize, field, value, sortField, sortOrder)
|
||||||
.then((res) => {
|
.then((res) => {
|
||||||
this.setState({
|
this.setState({
|
||||||
loading: false,
|
loading: false,
|
||||||
|
@@ -309,7 +309,7 @@ class ResourceListPage extends BaseListPage {
|
|||||||
const field = params.searchedColumn, value = params.searchText;
|
const field = params.searchedColumn, value = params.searchText;
|
||||||
const sortField = params.sortField, sortOrder = params.sortOrder;
|
const sortField = params.sortField, sortOrder = params.sortOrder;
|
||||||
this.setState({loading: true});
|
this.setState({loading: true});
|
||||||
ResourceBackend.getResources(Setting.isAdminUser(this.props.account) ? "" : this.props.account.owner, this.props.account.name, params.pagination.current, params.pagination.pageSize, field, value, sortField, sortOrder)
|
ResourceBackend.getResources(Setting.isDefaultOrganizationSelected(this.props.account) ? "" : Setting.getRequestOrganization(this.props.account), this.props.account.name, params.pagination.current, params.pagination.pageSize, field, value, sortField, sortOrder)
|
||||||
.then((res) => {
|
.then((res) => {
|
||||||
this.setState({
|
this.setState({
|
||||||
loading: false,
|
loading: false,
|
||||||
|
@@ -42,18 +42,22 @@ class RoleEditPage extends React.Component {
|
|||||||
|
|
||||||
getRole() {
|
getRole() {
|
||||||
RoleBackend.getRole(this.state.organizationName, this.state.roleName)
|
RoleBackend.getRole(this.state.organizationName, this.state.roleName)
|
||||||
.then((role) => {
|
.then((res) => {
|
||||||
if (role === null) {
|
if (res === null) {
|
||||||
this.props.history.push("/404");
|
this.props.history.push("/404");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
if (res.status === "error") {
|
||||||
|
Setting.showMessage("error", res.msg);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
this.setState({
|
this.setState({
|
||||||
role: role,
|
role: res,
|
||||||
});
|
});
|
||||||
|
|
||||||
this.getUsers(role.owner);
|
this.getUsers(res.owner);
|
||||||
this.getRoles(role.owner);
|
this.getRoles(res.owner);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -69,6 +73,10 @@ class RoleEditPage extends React.Component {
|
|||||||
getUsers(organizationName) {
|
getUsers(organizationName) {
|
||||||
UserBackend.getUsers(organizationName)
|
UserBackend.getUsers(organizationName)
|
||||||
.then((res) => {
|
.then((res) => {
|
||||||
|
if (res.status === "error") {
|
||||||
|
Setting.showMessage("error", res.msg);
|
||||||
|
return;
|
||||||
|
}
|
||||||
this.setState({
|
this.setState({
|
||||||
users: res,
|
users: res,
|
||||||
});
|
});
|
||||||
@@ -78,6 +86,10 @@ class RoleEditPage extends React.Component {
|
|||||||
getRoles(organizationName) {
|
getRoles(organizationName) {
|
||||||
RoleBackend.getRoles(organizationName)
|
RoleBackend.getRoles(organizationName)
|
||||||
.then((res) => {
|
.then((res) => {
|
||||||
|
if (res.status === "error") {
|
||||||
|
Setting.showMessage("error", res.msg);
|
||||||
|
return;
|
||||||
|
}
|
||||||
this.setState({
|
this.setState({
|
||||||
roles: res,
|
roles: res,
|
||||||
});
|
});
|
||||||
|
@@ -26,8 +26,9 @@ import {UploadOutlined} from "@ant-design/icons";
|
|||||||
class RoleListPage extends BaseListPage {
|
class RoleListPage extends BaseListPage {
|
||||||
newRole() {
|
newRole() {
|
||||||
const randomName = Setting.getRandomName();
|
const randomName = Setting.getRandomName();
|
||||||
|
const owner = Setting.getRequestOrganization(this.props.account);
|
||||||
return {
|
return {
|
||||||
owner: this.props.account.owner,
|
owner: owner,
|
||||||
name: `role_${randomName}`,
|
name: `role_${randomName}`,
|
||||||
createdTime: moment().format(),
|
createdTime: moment().format(),
|
||||||
displayName: `New Role - ${randomName}`,
|
displayName: `New Role - ${randomName}`,
|
||||||
@@ -258,7 +259,7 @@ class RoleListPage extends BaseListPage {
|
|||||||
value = params.type;
|
value = params.type;
|
||||||
}
|
}
|
||||||
this.setState({loading: true});
|
this.setState({loading: true});
|
||||||
RoleBackend.getRoles(Setting.isAdminUser(this.props.account) ? "" : this.props.account.owner, params.pagination.current, params.pagination.pageSize, field, value, sortField, sortOrder)
|
RoleBackend.getRoles(Setting.isDefaultOrganizationSelected(this.props.account) ? "" : Setting.getRequestOrganization(this.props.account), params.pagination.current, params.pagination.pageSize, field, value, sortField, sortOrder)
|
||||||
.then((res) => {
|
.then((res) => {
|
||||||
this.setState({
|
this.setState({
|
||||||
loading: false,
|
loading: false,
|
||||||
|
@@ -22,7 +22,6 @@ import * as SessionBackend from "./backend/SessionBackend";
|
|||||||
import PopconfirmModal from "./common/modal/PopconfirmModal";
|
import PopconfirmModal from "./common/modal/PopconfirmModal";
|
||||||
|
|
||||||
class SessionListPage extends BaseListPage {
|
class SessionListPage extends BaseListPage {
|
||||||
|
|
||||||
deleteSession(i) {
|
deleteSession(i) {
|
||||||
SessionBackend.deleteSession(this.state.data[i])
|
SessionBackend.deleteSession(this.state.data[i])
|
||||||
.then((res) => {
|
.then((res) => {
|
||||||
@@ -134,7 +133,7 @@ class SessionListPage extends BaseListPage {
|
|||||||
value = params.contentType;
|
value = params.contentType;
|
||||||
}
|
}
|
||||||
this.setState({loading: true});
|
this.setState({loading: true});
|
||||||
SessionBackend.getSessions(Setting.isAdminUser(this.props.account) ? "" : this.props.account.owner, params.pagination.current, params.pagination.pageSize, field, value, sortField, sortOrder)
|
SessionBackend.getSessions(Setting.isDefaultOrganizationSelected(this.props.account) ? "" : Setting.getRequestOrganization(this.props.account), params.pagination.current, params.pagination.pageSize, field, value, sortField, sortOrder)
|
||||||
.then((res) => {
|
.then((res) => {
|
||||||
this.setState({
|
this.setState({
|
||||||
loading: false,
|
loading: false,
|
||||||
|
@@ -1164,3 +1164,27 @@ export function inIframe() {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function getOrganization() {
|
||||||
|
const organization = localStorage.getItem("organization");
|
||||||
|
return organization !== null ? organization : "All";
|
||||||
|
}
|
||||||
|
|
||||||
|
export function setOrganization(organization) {
|
||||||
|
localStorage.setItem("organization", organization);
|
||||||
|
window.dispatchEvent(new Event("storageOrganizationChanged"));
|
||||||
|
}
|
||||||
|
|
||||||
|
export function getRequestOrganization(account) {
|
||||||
|
if (isAdminUser(account)) {
|
||||||
|
return getOrganization() === "All" ? account.owner : getOrganization();
|
||||||
|
}
|
||||||
|
return account.owner;
|
||||||
|
}
|
||||||
|
|
||||||
|
export function isDefaultOrganizationSelected(account) {
|
||||||
|
if (isAdminUser(account)) {
|
||||||
|
return getOrganization() === "All";
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
@@ -46,18 +46,23 @@ class SubscriptionEditPage extends React.Component {
|
|||||||
|
|
||||||
getSubscription() {
|
getSubscription() {
|
||||||
SubscriptionBackend.getSubscription(this.state.organizationName, this.state.subscriptionName)
|
SubscriptionBackend.getSubscription(this.state.organizationName, this.state.subscriptionName)
|
||||||
.then((subscription) => {
|
.then((res) => {
|
||||||
if (subscription === null) {
|
if (res === null) {
|
||||||
this.props.history.push("/404");
|
this.props.history.push("/404");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (res.status === "error") {
|
||||||
|
Setting.showMessage("error", res.msg);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
this.setState({
|
this.setState({
|
||||||
subscription: subscription,
|
subscription: res,
|
||||||
});
|
});
|
||||||
|
|
||||||
this.getUsers(subscription.owner);
|
this.getUsers(res.owner);
|
||||||
this.getPlanes(subscription.owner);
|
this.getPlanes(res.owner);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -73,6 +78,10 @@ class SubscriptionEditPage extends React.Component {
|
|||||||
getUsers(organizationName) {
|
getUsers(organizationName) {
|
||||||
UserBackend.getUsers(organizationName)
|
UserBackend.getUsers(organizationName)
|
||||||
.then((res) => {
|
.then((res) => {
|
||||||
|
if (res.status === "error") {
|
||||||
|
Setting.showMessage("error", res.msg);
|
||||||
|
return;
|
||||||
|
}
|
||||||
this.setState({
|
this.setState({
|
||||||
users: res,
|
users: res,
|
||||||
});
|
});
|
||||||
|
@@ -25,7 +25,7 @@ import PopconfirmModal from "./common/modal/PopconfirmModal";
|
|||||||
class SubscriptionListPage extends BaseListPage {
|
class SubscriptionListPage extends BaseListPage {
|
||||||
newSubscription() {
|
newSubscription() {
|
||||||
const randomName = Setting.getRandomName();
|
const randomName = Setting.getRandomName();
|
||||||
const owner = (this.state.organizationName !== undefined) ? this.state.organizationName : this.props.account.owner;
|
const owner = Setting.getRequestOrganization(this.props.account);
|
||||||
const defaultDuration = 365;
|
const defaultDuration = 365;
|
||||||
|
|
||||||
return {
|
return {
|
||||||
@@ -237,7 +237,7 @@ class SubscriptionListPage extends BaseListPage {
|
|||||||
value = params.type;
|
value = params.type;
|
||||||
}
|
}
|
||||||
this.setState({loading: true});
|
this.setState({loading: true});
|
||||||
SubscriptionBackend.getSubscriptions(Setting.isAdminUser(this.props.account) ? "" : this.props.account.owner, params.pagination.current, params.pagination.pageSize, field, value, sortField, sortOrder)
|
SubscriptionBackend.getSubscriptions(Setting.isDefaultOrganizationSelected(this.props.account) ? "" : Setting.getRequestOrganization(this.props.account), params.pagination.current, params.pagination.pageSize, field, value, sortField, sortOrder)
|
||||||
.then((res) => {
|
.then((res) => {
|
||||||
this.setState({
|
this.setState({
|
||||||
loading: false,
|
loading: false,
|
||||||
|
@@ -47,14 +47,19 @@ class SyncerEditPage extends React.Component {
|
|||||||
|
|
||||||
getSyncer() {
|
getSyncer() {
|
||||||
SyncerBackend.getSyncer("admin", this.state.syncerName)
|
SyncerBackend.getSyncer("admin", this.state.syncerName)
|
||||||
.then((syncer) => {
|
.then((res) => {
|
||||||
if (syncer === null) {
|
if (res === null) {
|
||||||
this.props.history.push("/404");
|
this.props.history.push("/404");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (res.status === "error") {
|
||||||
|
Setting.showMessage("error", res.msg);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
this.setState({
|
this.setState({
|
||||||
syncer: syncer,
|
syncer: res,
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@@ -25,11 +25,12 @@ import PopconfirmModal from "./common/modal/PopconfirmModal";
|
|||||||
class SyncerListPage extends BaseListPage {
|
class SyncerListPage extends BaseListPage {
|
||||||
newSyncer() {
|
newSyncer() {
|
||||||
const randomName = Setting.getRandomName();
|
const randomName = Setting.getRandomName();
|
||||||
|
const organizationName = Setting.getRequestOrganization(this.props.account);
|
||||||
return {
|
return {
|
||||||
owner: "admin",
|
owner: "admin",
|
||||||
name: `syncer_${randomName}`,
|
name: `syncer_${randomName}`,
|
||||||
createdTime: moment().format(),
|
createdTime: moment().format(),
|
||||||
organization: this.props.account.owner,
|
organization: organizationName,
|
||||||
type: "Database",
|
type: "Database",
|
||||||
host: "localhost",
|
host: "localhost",
|
||||||
port: 3306,
|
port: 3306,
|
||||||
@@ -276,7 +277,7 @@ class SyncerListPage extends BaseListPage {
|
|||||||
value = params.type;
|
value = params.type;
|
||||||
}
|
}
|
||||||
this.setState({loading: true});
|
this.setState({loading: true});
|
||||||
SyncerBackend.getSyncers("admin", Setting.isAdminUser(this.props.account) ? "" : this.props.account.owner, params.pagination.current, params.pagination.pageSize, field, value, sortField, sortOrder)
|
SyncerBackend.getSyncers("admin", Setting.isDefaultOrganizationSelected(this.props.account) ? "" : Setting.getRequestOrganization(this.props.account), params.pagination.current, params.pagination.pageSize, field, value, sortField, sortOrder)
|
||||||
.then((res) => {
|
.then((res) => {
|
||||||
this.setState({
|
this.setState({
|
||||||
loading: false,
|
loading: false,
|
||||||
|
@@ -35,14 +35,19 @@ class TokenEditPage extends React.Component {
|
|||||||
|
|
||||||
getToken() {
|
getToken() {
|
||||||
TokenBackend.getToken("admin", this.state.tokenName)
|
TokenBackend.getToken("admin", this.state.tokenName)
|
||||||
.then((token) => {
|
.then((res) => {
|
||||||
if (token === null) {
|
if (res === null) {
|
||||||
this.props.history.push("/404");
|
this.props.history.push("/404");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (res.status === "error") {
|
||||||
|
Setting.showMessage("error", res.msg);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
this.setState({
|
this.setState({
|
||||||
token: token,
|
token: res,
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@@ -25,12 +25,13 @@ import PopconfirmModal from "./common/modal/PopconfirmModal";
|
|||||||
class TokenListPage extends BaseListPage {
|
class TokenListPage extends BaseListPage {
|
||||||
newToken() {
|
newToken() {
|
||||||
const randomName = Setting.getRandomName();
|
const randomName = Setting.getRandomName();
|
||||||
|
const organizationName = Setting.getRequestOrganization(this.props.account);
|
||||||
return {
|
return {
|
||||||
owner: "admin", // this.props.account.tokenname,
|
owner: "admin", // this.props.account.tokenname,
|
||||||
name: `token_${randomName}`,
|
name: `token_${randomName}`,
|
||||||
createdTime: moment().format(),
|
createdTime: moment().format(),
|
||||||
application: "app-built-in",
|
application: "app-built-in",
|
||||||
organization: this.props.account.owner,
|
organization: organizationName,
|
||||||
user: "admin",
|
user: "admin",
|
||||||
accessToken: "",
|
accessToken: "",
|
||||||
expiresIn: 7200,
|
expiresIn: 7200,
|
||||||
@@ -240,7 +241,7 @@ class TokenListPage extends BaseListPage {
|
|||||||
const field = params.searchedColumn, value = params.searchText;
|
const field = params.searchedColumn, value = params.searchText;
|
||||||
const sortField = params.sortField, sortOrder = params.sortOrder;
|
const sortField = params.sortField, sortOrder = params.sortOrder;
|
||||||
this.setState({loading: true});
|
this.setState({loading: true});
|
||||||
TokenBackend.getTokens("admin", Setting.isAdminUser(this.props.account) ? "" : this.props.account.owner, params.pagination.current, params.pagination.pageSize, field, value, sortField, sortOrder)
|
TokenBackend.getTokens("admin", Setting.isDefaultOrganizationSelected(this.props.account) ? "" : Setting.getRequestOrganization(this.props.account), params.pagination.current, params.pagination.pageSize, field, value, sortField, sortOrder)
|
||||||
.then((res) => {
|
.then((res) => {
|
||||||
this.setState({
|
this.setState({
|
||||||
loading: false,
|
loading: false,
|
||||||
|
@@ -121,13 +121,17 @@ class UserEditPage extends React.Component {
|
|||||||
|
|
||||||
getUserApplication() {
|
getUserApplication() {
|
||||||
ApplicationBackend.getUserApplication(this.state.organizationName, this.state.userName)
|
ApplicationBackend.getUserApplication(this.state.organizationName, this.state.userName)
|
||||||
.then((application) => {
|
.then((res) => {
|
||||||
|
if (res.status === "error") {
|
||||||
|
Setting.showMessage("error", res.msg);
|
||||||
|
return;
|
||||||
|
}
|
||||||
this.setState({
|
this.setState({
|
||||||
application: application,
|
application: res,
|
||||||
});
|
});
|
||||||
|
|
||||||
this.setState({
|
this.setState({
|
||||||
isGroupsVisible: application.organizationObj.accountItems?.some((item) => item.name === "Groups" && item.visible),
|
isGroupsVisible: res.organizationObj.accountItems?.some((item) => item.name === "Groups" && item.visible),
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@@ -61,7 +61,7 @@ class UserListPage extends BaseListPage {
|
|||||||
|
|
||||||
newUser() {
|
newUser() {
|
||||||
const randomName = Setting.getRandomName();
|
const randomName = Setting.getRandomName();
|
||||||
const owner = this.state.organizationName;
|
const owner = Setting.isDefaultOrganizationSelected(this.props.account) ? this.state.organizationName : Setting.getRequestOrganization(this.props.account);
|
||||||
return {
|
return {
|
||||||
owner: owner,
|
owner: owner,
|
||||||
name: `user_${randomName}`,
|
name: `user_${randomName}`,
|
||||||
@@ -456,7 +456,7 @@ class UserListPage extends BaseListPage {
|
|||||||
const sortField = params.sortField, sortOrder = params.sortOrder;
|
const sortField = params.sortField, sortOrder = params.sortOrder;
|
||||||
this.setState({loading: true});
|
this.setState({loading: true});
|
||||||
if (this.props.match?.path === "/users") {
|
if (this.props.match?.path === "/users") {
|
||||||
(Setting.isAdminUser(this.props.account) ? UserBackend.getGlobalUsers(params.pagination.current, params.pagination.pageSize, field, value, sortField, sortOrder) : UserBackend.getUsers(this.props.account.owner, params.pagination.current, params.pagination.pageSize, field, value, sortField, sortOrder))
|
(Setting.isDefaultOrganizationSelected(this.props.account) ? UserBackend.getGlobalUsers(params.pagination.current, params.pagination.pageSize, field, value, sortField, sortOrder) : UserBackend.getUsers(Setting.getRequestOrganization(this.props.account), params.pagination.current, params.pagination.pageSize, field, value, sortField, sortOrder))
|
||||||
.then((res) => {
|
.then((res) => {
|
||||||
this.setState({
|
this.setState({
|
||||||
loading: false,
|
loading: false,
|
||||||
|
@@ -25,11 +25,12 @@ import PopconfirmModal from "./common/modal/PopconfirmModal";
|
|||||||
class WebhookListPage extends BaseListPage {
|
class WebhookListPage extends BaseListPage {
|
||||||
newWebhook() {
|
newWebhook() {
|
||||||
const randomName = Setting.getRandomName();
|
const randomName = Setting.getRandomName();
|
||||||
|
const organizationName = Setting.getRequestOrganization(this.props.account);
|
||||||
return {
|
return {
|
||||||
owner: "admin", // this.props.account.webhookname,
|
owner: "admin", // this.props.account.webhookname,
|
||||||
name: `webhook_${randomName}`,
|
name: `webhook_${randomName}`,
|
||||||
createdTime: moment().format(),
|
createdTime: moment().format(),
|
||||||
organization: this.props.account.owner,
|
organization: organizationName,
|
||||||
url: "https://example.com/callback",
|
url: "https://example.com/callback",
|
||||||
method: "POST",
|
method: "POST",
|
||||||
contentType: "application/json",
|
contentType: "application/json",
|
||||||
@@ -240,7 +241,7 @@ class WebhookListPage extends BaseListPage {
|
|||||||
value = params.contentType;
|
value = params.contentType;
|
||||||
}
|
}
|
||||||
this.setState({loading: true});
|
this.setState({loading: true});
|
||||||
WebhookBackend.getWebhooks("admin", Setting.isAdminUser(this.props.account) ? "" : this.props.account.owner, params.pagination.current, params.pagination.pageSize, field, value, sortField, sortOrder)
|
WebhookBackend.getWebhooks("admin", Setting.isDefaultOrganizationSelected(this.props.account) ? "" : Setting.getRequestOrganization(this.props.account), params.pagination.current, params.pagination.pageSize, field, value, sortField, sortOrder)
|
||||||
.then((res) => {
|
.then((res) => {
|
||||||
this.setState({
|
this.setState({
|
||||||
loading: false,
|
loading: false,
|
||||||
|
@@ -63,8 +63,12 @@ class ForgetPage extends React.Component {
|
|||||||
}
|
}
|
||||||
|
|
||||||
ApplicationBackend.getApplication("admin", this.state.applicationName)
|
ApplicationBackend.getApplication("admin", this.state.applicationName)
|
||||||
.then((application) => {
|
.then((res) => {
|
||||||
this.onUpdateApplication(application);
|
if (res.status === "error") {
|
||||||
|
Setting.showMessage("error", res.msg);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
this.onUpdateApplication(res);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
getApplicationObj() {
|
getApplicationObj() {
|
||||||
|
@@ -49,7 +49,6 @@ class LoginPage extends React.Component {
|
|||||||
username: null,
|
username: null,
|
||||||
validEmailOrPhone: false,
|
validEmailOrPhone: false,
|
||||||
validEmail: false,
|
validEmail: false,
|
||||||
loginMethod: "password",
|
|
||||||
enableCaptchaModal: CaptchaRule.Never,
|
enableCaptchaModal: CaptchaRule.Never,
|
||||||
openCaptchaModal: false,
|
openCaptchaModal: false,
|
||||||
verifyCaptcha: undefined,
|
verifyCaptcha: undefined,
|
||||||
@@ -83,6 +82,8 @@ class LoginPage extends React.Component {
|
|||||||
|
|
||||||
componentDidUpdate(prevProps, prevState, snapshot) {
|
componentDidUpdate(prevProps, prevState, snapshot) {
|
||||||
if (prevProps.application !== this.props.application) {
|
if (prevProps.application !== this.props.application) {
|
||||||
|
this.setState({loginMethod: this.getDefaultLoginMethod(this.props.application)});
|
||||||
|
|
||||||
const captchaProviderItems = this.getCaptchaProviderItems(this.props.application);
|
const captchaProviderItems = this.getCaptchaProviderItems(this.props.application);
|
||||||
if (captchaProviderItems) {
|
if (captchaProviderItems) {
|
||||||
if (captchaProviderItems.some(providerItem => providerItem.rule === "Always")) {
|
if (captchaProviderItems.some(providerItem => providerItem.rule === "Always")) {
|
||||||
@@ -159,8 +160,12 @@ class LoginPage extends React.Component {
|
|||||||
|
|
||||||
if (this.state.owner === null || this.state.type === "saml") {
|
if (this.state.owner === null || this.state.type === "saml") {
|
||||||
ApplicationBackend.getApplication("admin", this.state.applicationName)
|
ApplicationBackend.getApplication("admin", this.state.applicationName)
|
||||||
.then((application) => {
|
.then((res) => {
|
||||||
this.onUpdateApplication(application);
|
if (res.status === "error") {
|
||||||
|
Setting.showMessage("error", res.msg);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
this.onUpdateApplication(res);
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
OrganizationBackend.getDefaultApplication("admin", this.state.owner)
|
OrganizationBackend.getDefaultApplication("admin", this.state.owner)
|
||||||
@@ -174,6 +179,8 @@ class LoginPage extends React.Component {
|
|||||||
} else {
|
} else {
|
||||||
this.onUpdateApplication(null);
|
this.onUpdateApplication(null);
|
||||||
Setting.showMessage("error", res.msg);
|
Setting.showMessage("error", res.msg);
|
||||||
|
|
||||||
|
this.props.history.push("/404");
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -183,6 +190,20 @@ class LoginPage extends React.Component {
|
|||||||
return this.props.application;
|
return this.props.application;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
getDefaultLoginMethod(application) {
|
||||||
|
if (application?.enablePassword) {
|
||||||
|
return "password";
|
||||||
|
}
|
||||||
|
if (application?.enableCodeSignin) {
|
||||||
|
return "verificationCode";
|
||||||
|
}
|
||||||
|
if (application?.enableWebAuthn) {
|
||||||
|
return "webAuthn";
|
||||||
|
}
|
||||||
|
|
||||||
|
return "password";
|
||||||
|
}
|
||||||
|
|
||||||
onUpdateAccount(account) {
|
onUpdateAccount(account) {
|
||||||
this.props.onUpdateAccount(account);
|
this.props.onUpdateAccount(account);
|
||||||
}
|
}
|
||||||
@@ -426,7 +447,8 @@ class LoginPage extends React.Component {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (application.enablePassword) {
|
const showForm = application.enablePassword || application.enableCodeSignin || application.enableWebAuthn;
|
||||||
|
if (showForm) {
|
||||||
let loginWidth = 320;
|
let loginWidth = 320;
|
||||||
if (Setting.getLanguage() === "fr") {
|
if (Setting.getLanguage() === "fr") {
|
||||||
loginWidth += 20;
|
loginWidth += 20;
|
||||||
@@ -511,7 +533,6 @@ class LoginPage extends React.Component {
|
|||||||
id="input"
|
id="input"
|
||||||
prefix={<UserOutlined className="site-form-item-icon" />}
|
prefix={<UserOutlined className="site-form-item-icon" />}
|
||||||
placeholder={(this.state.loginMethod === "verificationCode") ? i18next.t("login:Email or phone") : i18next.t("login:username, Email or phone")}
|
placeholder={(this.state.loginMethod === "verificationCode") ? i18next.t("login:Email or phone") : i18next.t("login:username, Email or phone")}
|
||||||
disabled={!application.enablePassword}
|
|
||||||
onChange={e => {
|
onChange={e => {
|
||||||
this.setState({
|
this.setState({
|
||||||
username: e.target.value,
|
username: e.target.value,
|
||||||
@@ -526,7 +547,7 @@ class LoginPage extends React.Component {
|
|||||||
</Row>
|
</Row>
|
||||||
<div style={{display: "inline-flex", justifyContent: "space-between", width: "320px", marginBottom: AgreementModal.isAgreementRequired(application) ? "5px" : "25px"}}>
|
<div style={{display: "inline-flex", justifyContent: "space-between", width: "320px", marginBottom: AgreementModal.isAgreementRequired(application) ? "5px" : "25px"}}>
|
||||||
<Form.Item name="autoSignin" valuePropName="checked" noStyle>
|
<Form.Item name="autoSignin" valuePropName="checked" noStyle>
|
||||||
<Checkbox style={{float: "left"}} disabled={!application.enablePassword}>
|
<Checkbox style={{float: "left"}}>
|
||||||
{i18next.t("login:Auto sign in")}
|
{i18next.t("login:Auto sign in")}
|
||||||
</Checkbox>
|
</Checkbox>
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
@@ -540,7 +561,6 @@ class LoginPage extends React.Component {
|
|||||||
type="primary"
|
type="primary"
|
||||||
htmlType="submit"
|
htmlType="submit"
|
||||||
style={{width: "100%", marginBottom: "5px"}}
|
style={{width: "100%", marginBottom: "5px"}}
|
||||||
disabled={!application.enablePassword}
|
|
||||||
>
|
>
|
||||||
{
|
{
|
||||||
this.state.loginMethod === "webAuthn" ? i18next.t("login:Sign in with WebAuthn") :
|
this.state.loginMethod === "webAuthn" ? i18next.t("login:Sign in with WebAuthn") :
|
||||||
@@ -801,14 +821,14 @@ class LoginPage extends React.Component {
|
|||||||
renderMethodChoiceBox() {
|
renderMethodChoiceBox() {
|
||||||
const application = this.getApplicationObj();
|
const application = this.getApplicationObj();
|
||||||
const items = [];
|
const items = [];
|
||||||
items.push({label: i18next.t("general:Password"), key: "password"});
|
application.enablePassword ? items.push({label: i18next.t("general:Password"), key: "password"}) : null;
|
||||||
application.enableCodeSignin ? items.push({label: i18next.t("login:Verification code"), key: "verificationCode"}) : null;
|
application.enableCodeSignin ? items.push({label: i18next.t("login:Verification code"), key: "verificationCode"}) : null;
|
||||||
application.enableWebAuthn ? items.push({label: i18next.t("login:WebAuthn"), key: "webAuthn"}) : null;
|
application.enableWebAuthn ? items.push({label: i18next.t("login:WebAuthn"), key: "webAuthn"}) : null;
|
||||||
|
|
||||||
if (application.enableCodeSignin || application.enableWebAuthn) {
|
if (items.length > 1) {
|
||||||
return (
|
return (
|
||||||
<div>
|
<div>
|
||||||
<Tabs items={items} size={"small"} defaultActiveKey="password" onChange={(key) => {
|
<Tabs items={items} size={"small"} defaultActiveKey={this.getDefaultLoginMethod(application)} onChange={(key) => {
|
||||||
this.setState({loginMethod: key});
|
this.setState({loginMethod: key});
|
||||||
}} centered>
|
}} centered>
|
||||||
</Tabs>
|
</Tabs>
|
||||||
@@ -933,7 +953,7 @@ class LoginPage extends React.Component {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const visibleOAuthProviderItems = (application.providers === null) ? [] : application.providers.filter(providerItem => this.isProviderVisible(providerItem));
|
const visibleOAuthProviderItems = (application.providers === null) ? [] : application.providers.filter(providerItem => this.isProviderVisible(providerItem));
|
||||||
if (this.props.preview !== "auto" && !application.enablePassword && visibleOAuthProviderItems.length === 1) {
|
if (this.props.preview !== "auto" && !application.enablePassword && !application.enableCodeSignin && !application.enableWebAuthn && visibleOAuthProviderItems.length === 1) {
|
||||||
Setting.goToLink(Provider.getAuthUrl(application, visibleOAuthProviderItems[0].provider, "signup"));
|
Setting.goToLink(Provider.getAuthUrl(application, visibleOAuthProviderItems[0].provider, "signup"));
|
||||||
return (
|
return (
|
||||||
<div style={{display: "flex", justifyContent: "center", alignItems: "center", width: "100%"}}>
|
<div style={{display: "flex", justifyContent: "center", alignItems: "center", width: "100%"}}>
|
||||||
|
@@ -188,10 +188,14 @@ class MfaSetupPage extends React.Component {
|
|||||||
}
|
}
|
||||||
|
|
||||||
ApplicationBackend.getApplication("admin", this.state.applicationName)
|
ApplicationBackend.getApplication("admin", this.state.applicationName)
|
||||||
.then((application) => {
|
.then((res) => {
|
||||||
if (application !== null) {
|
if (res !== null) {
|
||||||
|
if (res.status === "error") {
|
||||||
|
Setting.showMessage("error", res.msg);
|
||||||
|
return;
|
||||||
|
}
|
||||||
this.setState({
|
this.setState({
|
||||||
application: application,
|
application: res,
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
Setting.showMessage("error", i18next.t("mfa:Failed to get application"));
|
Setting.showMessage("error", i18next.t("mfa:Failed to get application"));
|
||||||
|
@@ -49,9 +49,14 @@ class PromptPage extends React.Component {
|
|||||||
const organizationName = this.props.account.owner;
|
const organizationName = this.props.account.owner;
|
||||||
const userName = this.props.account.name;
|
const userName = this.props.account.name;
|
||||||
UserBackend.getUser(organizationName, userName)
|
UserBackend.getUser(organizationName, userName)
|
||||||
.then((user) => {
|
.then((res) => {
|
||||||
|
if (res.status === "error") {
|
||||||
|
Setting.showMessage("error", res.msg);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
this.setState({
|
this.setState({
|
||||||
user: user,
|
user: res,
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -62,10 +67,15 @@ class PromptPage extends React.Component {
|
|||||||
}
|
}
|
||||||
|
|
||||||
ApplicationBackend.getApplication("admin", this.state.applicationName)
|
ApplicationBackend.getApplication("admin", this.state.applicationName)
|
||||||
.then((application) => {
|
.then((res) => {
|
||||||
this.onUpdateApplication(application);
|
if (res.status === "error") {
|
||||||
|
Setting.showMessage("error", res.msg);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
this.onUpdateApplication(res);
|
||||||
this.setState({
|
this.setState({
|
||||||
application: application,
|
application: res,
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user