mirror of
https://github.com/casdoor/casdoor.git
synced 2025-07-22 12:43:50 +08:00
Compare commits
14 Commits
Author | SHA1 | Date | |
---|---|---|---|
b6b0b7d318 | |||
0ecc1d599f | |||
3456fc6695 | |||
c302dc7b8e | |||
d24ddd4f1c | |||
572616d390 | |||
2187310dbc | |||
26345bb21b | |||
e0455df504 | |||
1dfbbf0e90 | |||
d43d58dee2 | |||
9eb4b12041 | |||
3a45a4ee77 | |||
43393f034b |
6
go.mod
6
go.mod
@ -9,12 +9,12 @@ require (
|
|||||||
github.com/beego/beego v1.12.12
|
github.com/beego/beego v1.12.12
|
||||||
github.com/beevik/etree v1.1.0
|
github.com/beevik/etree v1.1.0
|
||||||
github.com/casbin/casbin/v2 v2.77.2
|
github.com/casbin/casbin/v2 v2.77.2
|
||||||
github.com/casdoor/go-sms-sender v0.20.0
|
github.com/casdoor/go-sms-sender v0.23.0
|
||||||
github.com/casdoor/gomail/v2 v2.0.1
|
github.com/casdoor/gomail/v2 v2.0.1
|
||||||
github.com/casdoor/notify v0.45.0
|
github.com/casdoor/notify v0.45.0
|
||||||
github.com/casdoor/oss v1.6.0
|
github.com/casdoor/oss v1.6.0
|
||||||
github.com/casdoor/xorm-adapter/v3 v3.1.0
|
github.com/casdoor/xorm-adapter/v3 v3.1.0
|
||||||
github.com/casvisor/casvisor-go-sdk v1.3.0
|
github.com/casvisor/casvisor-go-sdk v1.4.0
|
||||||
github.com/dchest/captcha v0.0.0-20200903113550-03f5f0333e1f
|
github.com/dchest/captcha v0.0.0-20200903113550-03f5f0333e1f
|
||||||
github.com/denisenkom/go-mssqldb v0.9.0
|
github.com/denisenkom/go-mssqldb v0.9.0
|
||||||
github.com/elazarl/go-bindata-assetfs v1.0.1 // indirect
|
github.com/elazarl/go-bindata-assetfs v1.0.1 // indirect
|
||||||
@ -45,7 +45,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/sendgrid/sendgrid-go v3.14.0+incompatible // indirect
|
github.com/sendgrid/sendgrid-go v3.14.0+incompatible
|
||||||
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
|
||||||
github.com/siddontang/go-log v0.0.0-20190221022429-1e957dd83bed
|
github.com/siddontang/go-log v0.0.0-20190221022429-1e957dd83bed
|
||||||
|
10
go.sum
10
go.sum
@ -1003,6 +1003,8 @@ github.com/apache/arrow/go/v10 v10.0.1/go.mod h1:YvhnlEePVnBS4+0z3fhPfUy7W1Ikj0I
|
|||||||
github.com/apache/arrow/go/v11 v11.0.0/go.mod h1:Eg5OsL5H+e299f7u5ssuXsuHQVEGC4xei5aX110hRiI=
|
github.com/apache/arrow/go/v11 v11.0.0/go.mod h1:Eg5OsL5H+e299f7u5ssuXsuHQVEGC4xei5aX110hRiI=
|
||||||
github.com/apache/arrow/go/v12 v12.0.0/go.mod h1:d+tV/eHZZ7Dz7RPrFKtPK02tpr+c9/PEd/zm8mDS9Vg=
|
github.com/apache/arrow/go/v12 v12.0.0/go.mod h1:d+tV/eHZZ7Dz7RPrFKtPK02tpr+c9/PEd/zm8mDS9Vg=
|
||||||
github.com/apache/thrift v0.16.0/go.mod h1:PHK3hniurgQaNMZYaCLEqXKsYK8upmhPbmdP2FXSqgU=
|
github.com/apache/thrift v0.16.0/go.mod h1:PHK3hniurgQaNMZYaCLEqXKsYK8upmhPbmdP2FXSqgU=
|
||||||
|
github.com/apistd/uni-go-sdk v0.0.2 h1:7kqETCOz/rz8AQU55XGzxDFGoFeMgeZL5fGwvxKBZrc=
|
||||||
|
github.com/apistd/uni-go-sdk v0.0.2/go.mod h1:eIqYos4IbHgE/rB75r05ypNLahooEMJCrbjXq322b74=
|
||||||
github.com/appleboy/go-fcm v0.1.5/go.mod h1:MSxZ4LqGRsnywOjnlXJXMqbjZrG4vf+0oHitfC9HRH0=
|
github.com/appleboy/go-fcm v0.1.5/go.mod h1:MSxZ4LqGRsnywOjnlXJXMqbjZrG4vf+0oHitfC9HRH0=
|
||||||
github.com/armon/circbuf v0.0.0-20150827004946-bbbad097214e/go.mod h1:3U/XgcO3hCbHZ8TKRvWD2dDTCfh9M9ya+I9JpbB7O8o=
|
github.com/armon/circbuf v0.0.0-20150827004946-bbbad097214e/go.mod h1:3U/XgcO3hCbHZ8TKRvWD2dDTCfh9M9ya+I9JpbB7O8o=
|
||||||
github.com/armon/consul-api v0.0.0-20180202201655-eb2c6b5be1b6/go.mod h1:grANhF5doyWs3UAsr3K4I6qtAmlQcZDesFNEHPZAzj8=
|
github.com/armon/consul-api v0.0.0-20180202201655-eb2c6b5be1b6/go.mod h1:grANhF5doyWs3UAsr3K4I6qtAmlQcZDesFNEHPZAzj8=
|
||||||
@ -1083,8 +1085,8 @@ github.com/casbin/casbin/v2 v2.77.2 h1:yQinn/w9x8AswiwqwtrXz93VU48R1aYTXdHEx4RI3
|
|||||||
github.com/casbin/casbin/v2 v2.77.2/go.mod h1:mzGx0hYW9/ksOSpw3wNjk3NRAroq5VMFYUQ6G43iGPk=
|
github.com/casbin/casbin/v2 v2.77.2/go.mod h1:mzGx0hYW9/ksOSpw3wNjk3NRAroq5VMFYUQ6G43iGPk=
|
||||||
github.com/casdoor/go-reddit/v2 v2.1.0 h1:kIbfdJ7AA7H0uTQ8s0q4GGZqSS5V9wVE74RrXyD9XPs=
|
github.com/casdoor/go-reddit/v2 v2.1.0 h1:kIbfdJ7AA7H0uTQ8s0q4GGZqSS5V9wVE74RrXyD9XPs=
|
||||||
github.com/casdoor/go-reddit/v2 v2.1.0/go.mod h1:eagkvwlZ4Hcsuc/uQsLHYEulz5jN65SVSwV/AIE7zsc=
|
github.com/casdoor/go-reddit/v2 v2.1.0/go.mod h1:eagkvwlZ4Hcsuc/uQsLHYEulz5jN65SVSwV/AIE7zsc=
|
||||||
github.com/casdoor/go-sms-sender v0.20.0 h1:yLbCakV04DzzehhgBklOrSeCFjMwpfKBeemz9b+Y8OM=
|
github.com/casdoor/go-sms-sender v0.23.0 h1:N8+By4JNwyilEcx7cp0QGOepafefM88VwV+o3UEFZio=
|
||||||
github.com/casdoor/go-sms-sender v0.20.0/go.mod h1:cQs7qqohMJBgIVZebOCB8ko09naG1vzFJEH59VNIscs=
|
github.com/casdoor/go-sms-sender v0.23.0/go.mod h1:bOm4H8/YfJmEHjBatEVQFOnAf0OOn1B0Wi5B7zDhws0=
|
||||||
github.com/casdoor/gomail/v2 v2.0.1 h1:J+FG6x80s9e5lBHUn8Sv0Y56mud34KiWih5YdmudR/w=
|
github.com/casdoor/gomail/v2 v2.0.1 h1:J+FG6x80s9e5lBHUn8Sv0Y56mud34KiWih5YdmudR/w=
|
||||||
github.com/casdoor/gomail/v2 v2.0.1/go.mod h1:VnGPslEAtpix5FjHisR/WKB1qvZDBaujbikxDe9d+2Q=
|
github.com/casdoor/gomail/v2 v2.0.1/go.mod h1:VnGPslEAtpix5FjHisR/WKB1qvZDBaujbikxDe9d+2Q=
|
||||||
github.com/casdoor/notify v0.45.0 h1:OlaFvcQFjGOgA4mRx07M8AH1gvb5xNo21mcqrVGlLgk=
|
github.com/casdoor/notify v0.45.0 h1:OlaFvcQFjGOgA4mRx07M8AH1gvb5xNo21mcqrVGlLgk=
|
||||||
@ -1093,8 +1095,8 @@ github.com/casdoor/oss v1.6.0 h1:IOWrGLJ+VO82qS796eaRnzFPPA1Sn3cotYTi7O/VIlQ=
|
|||||||
github.com/casdoor/oss v1.6.0/go.mod h1:rJAWA0hLhtu94t6IRpotLUkXO1NWMASirywQYaGizJE=
|
github.com/casdoor/oss v1.6.0/go.mod h1:rJAWA0hLhtu94t6IRpotLUkXO1NWMASirywQYaGizJE=
|
||||||
github.com/casdoor/xorm-adapter/v3 v3.1.0 h1:NodWayRtSLVSeCvL9H3Hc61k0G17KhV9IymTCNfh3kk=
|
github.com/casdoor/xorm-adapter/v3 v3.1.0 h1:NodWayRtSLVSeCvL9H3Hc61k0G17KhV9IymTCNfh3kk=
|
||||||
github.com/casdoor/xorm-adapter/v3 v3.1.0/go.mod h1:4WTcUw+bTgBylGHeGHzTtBvuTXRS23dtwzFLl9tsgFM=
|
github.com/casdoor/xorm-adapter/v3 v3.1.0/go.mod h1:4WTcUw+bTgBylGHeGHzTtBvuTXRS23dtwzFLl9tsgFM=
|
||||||
github.com/casvisor/casvisor-go-sdk v1.3.0 h1:HVgm2g3lWpNX2wBNidzR743QY4O5kAjLUJ9tS2juO8g=
|
github.com/casvisor/casvisor-go-sdk v1.4.0 h1:hbZEGGJ1cwdHFAxeXrMoNw6yha6Oyg2F0qQhBNCN/dg=
|
||||||
github.com/casvisor/casvisor-go-sdk v1.3.0/go.mod h1:frnNtH5GA0wxzAQLyZxxfL0RSsSub9GQPi2Ybe86ocE=
|
github.com/casvisor/casvisor-go-sdk v1.4.0/go.mod h1:frnNtH5GA0wxzAQLyZxxfL0RSsSub9GQPi2Ybe86ocE=
|
||||||
github.com/cenkalti/backoff/v4 v4.1.1/go.mod h1:scbssz8iZGpm3xbr14ovlUdkxfGXNInqkPWOWmG2CLw=
|
github.com/cenkalti/backoff/v4 v4.1.1/go.mod h1:scbssz8iZGpm3xbr14ovlUdkxfGXNInqkPWOWmG2CLw=
|
||||||
github.com/cenkalti/backoff/v4 v4.1.2/go.mod h1:scbssz8iZGpm3xbr14ovlUdkxfGXNInqkPWOWmG2CLw=
|
github.com/cenkalti/backoff/v4 v4.1.2/go.mod h1:scbssz8iZGpm3xbr14ovlUdkxfGXNInqkPWOWmG2CLw=
|
||||||
github.com/cenkalti/backoff/v4 v4.1.3 h1:cFAlzYUlVYDysBEH2T5hyJZMh3+5+WCBvSnK6Q8UtC4=
|
github.com/cenkalti/backoff/v4 v4.1.3 h1:cFAlzYUlVYDysBEH2T5hyJZMh3+5+WCBvSnK6Q8UtC4=
|
||||||
|
@ -670,11 +670,7 @@ func AddApplication(application *Application) (bool, error) {
|
|||||||
return affected != 0, nil
|
return affected != 0, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func DeleteApplication(application *Application) (bool, error) {
|
func deleteApplication(application *Application) (bool, error) {
|
||||||
if application.Name == "app-built-in" {
|
|
||||||
return false, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
affected, err := ormer.Engine.ID(core.PK{application.Owner, application.Name}).Delete(&Application{})
|
affected, err := ormer.Engine.ID(core.PK{application.Owner, application.Name}).Delete(&Application{})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return false, err
|
return false, err
|
||||||
@ -683,6 +679,14 @@ func DeleteApplication(application *Application) (bool, error) {
|
|||||||
return affected != 0, nil
|
return affected != 0, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func DeleteApplication(application *Application) (bool, error) {
|
||||||
|
if application.Name == "app-built-in" {
|
||||||
|
return false, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
return deleteApplication(application)
|
||||||
|
}
|
||||||
|
|
||||||
func (application *Application) GetId() string {
|
func (application *Application) GetId() string {
|
||||||
return fmt.Sprintf("%s/%s", application.Owner, application.Name)
|
return fmt.Sprintf("%s/%s", application.Owner, application.Name)
|
||||||
}
|
}
|
||||||
|
@ -38,6 +38,19 @@ func (application *Application) GetProviderByCategory(category string) (*Provide
|
|||||||
return nil, nil
|
return nil, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func isProviderItemCountryCodeMatched(providerItem *ProviderItem, countryCode string) bool {
|
||||||
|
if len(providerItem.CountryCodes) == 0 {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
|
for _, countryCode2 := range providerItem.CountryCodes {
|
||||||
|
if countryCode2 == "" || countryCode2 == "All" || countryCode2 == "all" || countryCode2 == countryCode {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
func (application *Application) GetProviderByCategoryAndRule(category string, method string, countryCode string) (*Provider, error) {
|
func (application *Application) GetProviderByCategoryAndRule(category string, method string, countryCode string) (*Provider, error) {
|
||||||
providers, err := GetProviders(application.Organization)
|
providers, err := GetProviders(application.Organization)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@ -54,15 +67,13 @@ func (application *Application) GetProviderByCategoryAndRule(category string, me
|
|||||||
}
|
}
|
||||||
|
|
||||||
for _, providerItem := range application.Providers {
|
for _, providerItem := range application.Providers {
|
||||||
includeCode := false
|
if providerItem.Provider != nil && providerItem.Provider.Category == "SMS" {
|
||||||
if providerItem.CountryCode != nil {
|
if !isProviderItemCountryCodeMatched(providerItem, countryCode) {
|
||||||
for _, item := range providerItem.CountryCode {
|
continue
|
||||||
if item == countryCode || item == "All" || item == "" {
|
|
||||||
includeCode = true
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (providerItem.Rule == method || (providerItem.Rule == "All" || providerItem.Rule == "" || providerItem.Rule == "None")) && includeCode {
|
|
||||||
|
if providerItem.Rule == method || providerItem.Rule == "" || providerItem.Rule == "All" || providerItem.Rule == "all" || providerItem.Rule == "None" {
|
||||||
if provider, ok := m[providerItem.Name]; ok {
|
if provider, ok := m[providerItem.Name]; ok {
|
||||||
return provider, nil
|
return provider, nil
|
||||||
}
|
}
|
||||||
|
@ -154,6 +154,15 @@ func AddGroups(groups []*Group) (bool, error) {
|
|||||||
return affected != 0, nil
|
return affected != 0, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func deleteGroup(group *Group) (bool, error) {
|
||||||
|
affected, err := ormer.Engine.ID(core.PK{group.Owner, group.Name}).Delete(&Group{})
|
||||||
|
if err != nil {
|
||||||
|
return false, err
|
||||||
|
}
|
||||||
|
|
||||||
|
return affected != 0, nil
|
||||||
|
}
|
||||||
|
|
||||||
func DeleteGroup(group *Group) (bool, error) {
|
func DeleteGroup(group *Group) (bool, error) {
|
||||||
_, err := ormer.Engine.Get(group)
|
_, err := ormer.Engine.Get(group)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@ -172,12 +181,7 @@ func DeleteGroup(group *Group) (bool, error) {
|
|||||||
return false, errors.New("group has users")
|
return false, errors.New("group has users")
|
||||||
}
|
}
|
||||||
|
|
||||||
affected, err := ormer.Engine.ID(core.PK{group.Owner, group.Name}).Delete(&Group{})
|
return deleteGroup(group)
|
||||||
if err != nil {
|
|
||||||
return false, err
|
|
||||||
}
|
|
||||||
|
|
||||||
return affected != 0, nil
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func checkGroupName(name string) error {
|
func checkGroupName(name string) error {
|
||||||
|
@ -266,7 +266,13 @@ func initDefinedOrganization(organization *Organization) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if existed != nil {
|
if existed != nil {
|
||||||
return
|
affected, err := deleteOrganization(organization)
|
||||||
|
if err != nil {
|
||||||
|
panic(err)
|
||||||
|
}
|
||||||
|
if !affected {
|
||||||
|
panic("Fail to delete organization")
|
||||||
|
}
|
||||||
}
|
}
|
||||||
organization.CreatedTime = util.GetCurrentTime()
|
organization.CreatedTime = util.GetCurrentTime()
|
||||||
organization.AccountItems = getBuiltInAccountItems()
|
organization.AccountItems = getBuiltInAccountItems()
|
||||||
@ -284,7 +290,13 @@ func initDefinedApplication(application *Application) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if existed != nil {
|
if existed != nil {
|
||||||
return
|
affected, err := deleteApplication(application)
|
||||||
|
if err != nil {
|
||||||
|
panic(err)
|
||||||
|
}
|
||||||
|
if !affected {
|
||||||
|
panic("Fail to delete application")
|
||||||
|
}
|
||||||
}
|
}
|
||||||
application.CreatedTime = util.GetCurrentTime()
|
application.CreatedTime = util.GetCurrentTime()
|
||||||
_, err = AddApplication(application)
|
_, err = AddApplication(application)
|
||||||
@ -299,7 +311,13 @@ func initDefinedUser(user *User) {
|
|||||||
panic(err)
|
panic(err)
|
||||||
}
|
}
|
||||||
if existed != nil {
|
if existed != nil {
|
||||||
return
|
affected, err := deleteUser(user)
|
||||||
|
if err != nil {
|
||||||
|
panic(err)
|
||||||
|
}
|
||||||
|
if !affected {
|
||||||
|
panic("Fail to delete user")
|
||||||
|
}
|
||||||
}
|
}
|
||||||
user.CreatedTime = util.GetCurrentTime()
|
user.CreatedTime = util.GetCurrentTime()
|
||||||
user.Id = util.GenerateId()
|
user.Id = util.GenerateId()
|
||||||
@ -319,7 +337,13 @@ func initDefinedCert(cert *Cert) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if existed != nil {
|
if existed != nil {
|
||||||
return
|
affected, err := DeleteCert(cert)
|
||||||
|
if err != nil {
|
||||||
|
panic(err)
|
||||||
|
}
|
||||||
|
if !affected {
|
||||||
|
panic("Fail to delete cert")
|
||||||
|
}
|
||||||
}
|
}
|
||||||
cert.CreatedTime = util.GetCurrentTime()
|
cert.CreatedTime = util.GetCurrentTime()
|
||||||
_, err = AddCert(cert)
|
_, err = AddCert(cert)
|
||||||
@ -335,7 +359,13 @@ func initDefinedLdap(ldap *Ldap) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if existed != nil {
|
if existed != nil {
|
||||||
return
|
affected, err := DeleteLdap(ldap)
|
||||||
|
if err != nil {
|
||||||
|
panic(err)
|
||||||
|
}
|
||||||
|
if !affected {
|
||||||
|
panic("Fail to delete ldap")
|
||||||
|
}
|
||||||
}
|
}
|
||||||
_, err = AddLdap(ldap)
|
_, err = AddLdap(ldap)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@ -350,7 +380,13 @@ func initDefinedProvider(provider *Provider) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if existed != nil {
|
if existed != nil {
|
||||||
return
|
affected, err := DeleteProvider(provider)
|
||||||
|
if err != nil {
|
||||||
|
panic(err)
|
||||||
|
}
|
||||||
|
if !affected {
|
||||||
|
panic("Fail to delete provider")
|
||||||
|
}
|
||||||
}
|
}
|
||||||
_, err = AddProvider(provider)
|
_, err = AddProvider(provider)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@ -365,7 +401,13 @@ func initDefinedModel(model *Model) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if existed != nil {
|
if existed != nil {
|
||||||
return
|
affected, err := DeleteModel(model)
|
||||||
|
if err != nil {
|
||||||
|
panic(err)
|
||||||
|
}
|
||||||
|
if !affected {
|
||||||
|
panic("Fail to delete provider")
|
||||||
|
}
|
||||||
}
|
}
|
||||||
model.CreatedTime = util.GetCurrentTime()
|
model.CreatedTime = util.GetCurrentTime()
|
||||||
_, err = AddModel(model)
|
_, err = AddModel(model)
|
||||||
@ -381,7 +423,13 @@ func initDefinedPermission(permission *Permission) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if existed != nil {
|
if existed != nil {
|
||||||
return
|
affected, err := deletePermission(permission)
|
||||||
|
if err != nil {
|
||||||
|
panic(err)
|
||||||
|
}
|
||||||
|
if !affected {
|
||||||
|
panic("Fail to delete permission")
|
||||||
|
}
|
||||||
}
|
}
|
||||||
permission.CreatedTime = util.GetCurrentTime()
|
permission.CreatedTime = util.GetCurrentTime()
|
||||||
_, err = AddPermission(permission)
|
_, err = AddPermission(permission)
|
||||||
@ -397,7 +445,13 @@ func initDefinedPayment(payment *Payment) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if existed != nil {
|
if existed != nil {
|
||||||
return
|
affected, err := DeletePayment(payment)
|
||||||
|
if err != nil {
|
||||||
|
panic(err)
|
||||||
|
}
|
||||||
|
if !affected {
|
||||||
|
panic("Fail to delete payment")
|
||||||
|
}
|
||||||
}
|
}
|
||||||
payment.CreatedTime = util.GetCurrentTime()
|
payment.CreatedTime = util.GetCurrentTime()
|
||||||
_, err = AddPayment(payment)
|
_, err = AddPayment(payment)
|
||||||
@ -413,7 +467,13 @@ func initDefinedProduct(product *Product) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if existed != nil {
|
if existed != nil {
|
||||||
return
|
affected, err := DeleteProduct(product)
|
||||||
|
if err != nil {
|
||||||
|
panic(err)
|
||||||
|
}
|
||||||
|
if !affected {
|
||||||
|
panic("Fail to delete product")
|
||||||
|
}
|
||||||
}
|
}
|
||||||
product.CreatedTime = util.GetCurrentTime()
|
product.CreatedTime = util.GetCurrentTime()
|
||||||
_, err = AddProduct(product)
|
_, err = AddProduct(product)
|
||||||
@ -429,7 +489,13 @@ func initDefinedResource(resource *Resource) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if existed != nil {
|
if existed != nil {
|
||||||
return
|
affected, err := DeleteResource(resource)
|
||||||
|
if err != nil {
|
||||||
|
panic(err)
|
||||||
|
}
|
||||||
|
if !affected {
|
||||||
|
panic("Fail to delete resource")
|
||||||
|
}
|
||||||
}
|
}
|
||||||
resource.CreatedTime = util.GetCurrentTime()
|
resource.CreatedTime = util.GetCurrentTime()
|
||||||
_, err = AddResource(resource)
|
_, err = AddResource(resource)
|
||||||
@ -445,7 +511,13 @@ func initDefinedRole(role *Role) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if existed != nil {
|
if existed != nil {
|
||||||
return
|
affected, err := deleteRole(role)
|
||||||
|
if err != nil {
|
||||||
|
panic(err)
|
||||||
|
}
|
||||||
|
if !affected {
|
||||||
|
panic("Fail to delete role")
|
||||||
|
}
|
||||||
}
|
}
|
||||||
role.CreatedTime = util.GetCurrentTime()
|
role.CreatedTime = util.GetCurrentTime()
|
||||||
_, err = AddRole(role)
|
_, err = AddRole(role)
|
||||||
@ -461,7 +533,13 @@ func initDefinedSyncer(syncer *Syncer) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if existed != nil {
|
if existed != nil {
|
||||||
return
|
affected, err := DeleteSyncer(syncer)
|
||||||
|
if err != nil {
|
||||||
|
panic(err)
|
||||||
|
}
|
||||||
|
if !affected {
|
||||||
|
panic("Fail to delete role")
|
||||||
|
}
|
||||||
}
|
}
|
||||||
syncer.CreatedTime = util.GetCurrentTime()
|
syncer.CreatedTime = util.GetCurrentTime()
|
||||||
_, err = AddSyncer(syncer)
|
_, err = AddSyncer(syncer)
|
||||||
@ -477,7 +555,13 @@ func initDefinedToken(token *Token) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if existed != nil {
|
if existed != nil {
|
||||||
return
|
affected, err := DeleteToken(token)
|
||||||
|
if err != nil {
|
||||||
|
panic(err)
|
||||||
|
}
|
||||||
|
if !affected {
|
||||||
|
panic("Fail to delete token")
|
||||||
|
}
|
||||||
}
|
}
|
||||||
token.CreatedTime = util.GetCurrentTime()
|
token.CreatedTime = util.GetCurrentTime()
|
||||||
_, err = AddToken(token)
|
_, err = AddToken(token)
|
||||||
@ -493,7 +577,13 @@ func initDefinedWebhook(webhook *Webhook) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if existed != nil {
|
if existed != nil {
|
||||||
return
|
affected, err := DeleteWebhook(webhook)
|
||||||
|
if err != nil {
|
||||||
|
panic(err)
|
||||||
|
}
|
||||||
|
if !affected {
|
||||||
|
panic("Fail to delete webhook")
|
||||||
|
}
|
||||||
}
|
}
|
||||||
webhook.CreatedTime = util.GetCurrentTime()
|
webhook.CreatedTime = util.GetCurrentTime()
|
||||||
_, err = AddWebhook(webhook)
|
_, err = AddWebhook(webhook)
|
||||||
@ -508,7 +598,13 @@ func initDefinedGroup(group *Group) {
|
|||||||
panic(err)
|
panic(err)
|
||||||
}
|
}
|
||||||
if existed != nil {
|
if existed != nil {
|
||||||
return
|
affected, err := deleteGroup(group)
|
||||||
|
if err != nil {
|
||||||
|
panic(err)
|
||||||
|
}
|
||||||
|
if !affected {
|
||||||
|
panic("Fail to delete group")
|
||||||
|
}
|
||||||
}
|
}
|
||||||
group.CreatedTime = util.GetCurrentTime()
|
group.CreatedTime = util.GetCurrentTime()
|
||||||
_, err = AddGroup(group)
|
_, err = AddGroup(group)
|
||||||
@ -523,7 +619,13 @@ func initDefinedAdapter(adapter *Adapter) {
|
|||||||
panic(err)
|
panic(err)
|
||||||
}
|
}
|
||||||
if existed != nil {
|
if existed != nil {
|
||||||
return
|
affected, err := DeleteAdapter(adapter)
|
||||||
|
if err != nil {
|
||||||
|
panic(err)
|
||||||
|
}
|
||||||
|
if !affected {
|
||||||
|
panic("Fail to delete adapter")
|
||||||
|
}
|
||||||
}
|
}
|
||||||
adapter.CreatedTime = util.GetCurrentTime()
|
adapter.CreatedTime = util.GetCurrentTime()
|
||||||
_, err = AddAdapter(adapter)
|
_, err = AddAdapter(adapter)
|
||||||
@ -538,7 +640,13 @@ func initDefinedEnforcer(enforcer *Enforcer) {
|
|||||||
panic(err)
|
panic(err)
|
||||||
}
|
}
|
||||||
if existed != nil {
|
if existed != nil {
|
||||||
return
|
affected, err := DeleteEnforcer(enforcer)
|
||||||
|
if err != nil {
|
||||||
|
panic(err)
|
||||||
|
}
|
||||||
|
if !affected {
|
||||||
|
panic("Fail to delete enforcer")
|
||||||
|
}
|
||||||
}
|
}
|
||||||
enforcer.CreatedTime = util.GetCurrentTime()
|
enforcer.CreatedTime = util.GetCurrentTime()
|
||||||
_, err = AddEnforcer(enforcer)
|
_, err = AddEnforcer(enforcer)
|
||||||
@ -553,7 +661,13 @@ func initDefinedPlan(plan *Plan) {
|
|||||||
panic(err)
|
panic(err)
|
||||||
}
|
}
|
||||||
if existed != nil {
|
if existed != nil {
|
||||||
return
|
affected, err := DeletePlan(plan)
|
||||||
|
if err != nil {
|
||||||
|
panic(err)
|
||||||
|
}
|
||||||
|
if !affected {
|
||||||
|
panic("Fail to delete plan")
|
||||||
|
}
|
||||||
}
|
}
|
||||||
plan.CreatedTime = util.GetCurrentTime()
|
plan.CreatedTime = util.GetCurrentTime()
|
||||||
_, err = AddPlan(plan)
|
_, err = AddPlan(plan)
|
||||||
@ -563,12 +677,18 @@ func initDefinedPlan(plan *Plan) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func initDefinedPricing(pricing *Pricing) {
|
func initDefinedPricing(pricing *Pricing) {
|
||||||
existed, err := getPlan(pricing.Owner, pricing.Name)
|
existed, err := getPricing(pricing.Owner, pricing.Name)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
panic(err)
|
panic(err)
|
||||||
}
|
}
|
||||||
if existed != nil {
|
if existed != nil {
|
||||||
return
|
affected, err := DeletePricing(pricing)
|
||||||
|
if err != nil {
|
||||||
|
panic(err)
|
||||||
|
}
|
||||||
|
if !affected {
|
||||||
|
panic("Fail to delete pricing")
|
||||||
|
}
|
||||||
}
|
}
|
||||||
pricing.CreatedTime = util.GetCurrentTime()
|
pricing.CreatedTime = util.GetCurrentTime()
|
||||||
_, err = AddPricing(pricing)
|
_, err = AddPricing(pricing)
|
||||||
@ -583,7 +703,13 @@ func initDefinedInvitation(invitation *Invitation) {
|
|||||||
panic(err)
|
panic(err)
|
||||||
}
|
}
|
||||||
if existed != nil {
|
if existed != nil {
|
||||||
return
|
affected, err := DeleteInvitation(invitation)
|
||||||
|
if err != nil {
|
||||||
|
panic(err)
|
||||||
|
}
|
||||||
|
if !affected {
|
||||||
|
panic("Fail to delete invitation")
|
||||||
|
}
|
||||||
}
|
}
|
||||||
invitation.CreatedTime = util.GetCurrentTime()
|
invitation.CreatedTime = util.GetCurrentTime()
|
||||||
_, err = AddInvitation(invitation, "en")
|
_, err = AddInvitation(invitation, "en")
|
||||||
@ -593,6 +719,7 @@ func initDefinedInvitation(invitation *Invitation) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func initDefinedRecord(record *casvisorsdk.Record) {
|
func initDefinedRecord(record *casvisorsdk.Record) {
|
||||||
|
record.Id = 0
|
||||||
record.CreatedTime = util.GetCurrentTime()
|
record.CreatedTime = util.GetCurrentTime()
|
||||||
_ = AddRecord(record)
|
_ = AddRecord(record)
|
||||||
}
|
}
|
||||||
@ -611,7 +738,13 @@ func initDefinedSubscription(subscription *Subscription) {
|
|||||||
panic(err)
|
panic(err)
|
||||||
}
|
}
|
||||||
if existed != nil {
|
if existed != nil {
|
||||||
return
|
affected, err := DeleteSubscription(subscription)
|
||||||
|
if err != nil {
|
||||||
|
panic(err)
|
||||||
|
}
|
||||||
|
if !affected {
|
||||||
|
panic("Fail to delete subscription")
|
||||||
|
}
|
||||||
}
|
}
|
||||||
subscription.CreatedTime = util.GetCurrentTime()
|
subscription.CreatedTime = util.GetCurrentTime()
|
||||||
_, err = AddSubscription(subscription)
|
_, err = AddSubscription(subscription)
|
||||||
@ -626,7 +759,13 @@ func initDefinedTransaction(transaction *Transaction) {
|
|||||||
panic(err)
|
panic(err)
|
||||||
}
|
}
|
||||||
if existed != nil {
|
if existed != nil {
|
||||||
return
|
affected, err := DeleteTransaction(transaction)
|
||||||
|
if err != nil {
|
||||||
|
panic(err)
|
||||||
|
}
|
||||||
|
if !affected {
|
||||||
|
panic("Fail to delete transaction")
|
||||||
|
}
|
||||||
}
|
}
|
||||||
transaction.CreatedTime = util.GetCurrentTime()
|
transaction.CreatedTime = util.GetCurrentTime()
|
||||||
_, err = AddTransaction(transaction)
|
_, err = AddTransaction(transaction)
|
||||||
|
@ -241,11 +241,7 @@ func AddOrganization(organization *Organization) (bool, error) {
|
|||||||
return affected != 0, nil
|
return affected != 0, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func DeleteOrganization(organization *Organization) (bool, error) {
|
func deleteOrganization(organization *Organization) (bool, error) {
|
||||||
if organization.Name == "built-in" {
|
|
||||||
return false, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
affected, err := ormer.Engine.ID(core.PK{organization.Owner, organization.Name}).Delete(&Organization{})
|
affected, err := ormer.Engine.ID(core.PK{organization.Owner, organization.Name}).Delete(&Organization{})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return false, err
|
return false, err
|
||||||
@ -254,6 +250,14 @@ func DeleteOrganization(organization *Organization) (bool, error) {
|
|||||||
return affected != 0, nil
|
return affected != 0, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func DeleteOrganization(organization *Organization) (bool, error) {
|
||||||
|
if organization.Name == "built-in" {
|
||||||
|
return false, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
return deleteOrganization(organization)
|
||||||
|
}
|
||||||
|
|
||||||
func GetOrganizationByUser(user *User) (*Organization, error) {
|
func GetOrganizationByUser(user *User) (*Organization, error) {
|
||||||
if user == nil {
|
if user == nil {
|
||||||
return nil, nil
|
return nil, nil
|
||||||
|
@ -286,13 +286,22 @@ func AddPermissionsInBatch(permissions []*Permission) (bool, error) {
|
|||||||
return affected, nil
|
return affected, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func DeletePermission(permission *Permission) (bool, error) {
|
func deletePermission(permission *Permission) (bool, error) {
|
||||||
affected, err := ormer.Engine.ID(core.PK{permission.Owner, permission.Name}).Delete(&Permission{})
|
affected, err := ormer.Engine.ID(core.PK{permission.Owner, permission.Name}).Delete(&Permission{})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return false, err
|
return false, err
|
||||||
}
|
}
|
||||||
|
|
||||||
if affected != 0 {
|
return affected != 0, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func DeletePermission(permission *Permission) (bool, error) {
|
||||||
|
affected, err := deletePermission(permission)
|
||||||
|
if err != nil {
|
||||||
|
return false, err
|
||||||
|
}
|
||||||
|
|
||||||
|
if affected {
|
||||||
err = removeGroupingPolicies(permission)
|
err = removeGroupingPolicies(permission)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return false, err
|
return false, err
|
||||||
@ -314,7 +323,7 @@ func DeletePermission(permission *Permission) (bool, error) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return affected != 0, nil
|
return affected, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func getPermissionsByUser(userId string) ([]*Permission, error) {
|
func getPermissionsByUser(userId string) ([]*Permission, error) {
|
||||||
|
@ -133,7 +133,7 @@ func AddPlan(plan *Plan) (bool, error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func DeletePlan(plan *Plan) (bool, error) {
|
func DeletePlan(plan *Plan) (bool, error) {
|
||||||
affected, err := ormer.Engine.ID(core.PK{plan.Owner, plan.Name}).Delete(plan)
|
affected, err := ormer.Engine.ID(core.PK{plan.Owner, plan.Name}).Delete(Plan{})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return false, err
|
return false, err
|
||||||
}
|
}
|
||||||
|
@ -140,7 +140,7 @@ func AddPricing(pricing *Pricing) (bool, error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func DeletePricing(pricing *Pricing) (bool, error) {
|
func DeletePricing(pricing *Pricing) (bool, error) {
|
||||||
affected, err := ormer.Engine.ID(core.PK{pricing.Owner, pricing.Name}).Delete(pricing)
|
affected, err := ormer.Engine.ID(core.PK{pricing.Owner, pricing.Name}).Delete(Pricing{})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return false, err
|
return false, err
|
||||||
}
|
}
|
||||||
|
@ -18,14 +18,14 @@ type ProviderItem struct {
|
|||||||
Owner string `json:"owner"`
|
Owner string `json:"owner"`
|
||||||
Name string `json:"name"`
|
Name string `json:"name"`
|
||||||
|
|
||||||
CanSignUp bool `json:"canSignUp"`
|
CanSignUp bool `json:"canSignUp"`
|
||||||
CanSignIn bool `json:"canSignIn"`
|
CanSignIn bool `json:"canSignIn"`
|
||||||
CanUnlink bool `json:"canUnlink"`
|
CanUnlink bool `json:"canUnlink"`
|
||||||
CountryCode []string `json:"countryCode"`
|
CountryCodes []string `json:"countryCodes"`
|
||||||
Prompted bool `json:"prompted"`
|
Prompted bool `json:"prompted"`
|
||||||
SignupGroup string `json:"signupGroup"`
|
SignupGroup string `json:"signupGroup"`
|
||||||
Rule string `json:"rule"`
|
Rule string `json:"rule"`
|
||||||
Provider *Provider `json:"provider"`
|
Provider *Provider `json:"provider"`
|
||||||
}
|
}
|
||||||
|
|
||||||
func (application *Application) GetProviderItem(providerName string) *ProviderItem {
|
func (application *Application) GetProviderItem(providerName string) *ProviderItem {
|
||||||
|
@ -17,6 +17,7 @@ package object
|
|||||||
import (
|
import (
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"regexp"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"github.com/beego/beego/context"
|
"github.com/beego/beego/context"
|
||||||
@ -25,10 +26,14 @@ import (
|
|||||||
"github.com/casvisor/casvisor-go-sdk/casvisorsdk"
|
"github.com/casvisor/casvisor-go-sdk/casvisorsdk"
|
||||||
)
|
)
|
||||||
|
|
||||||
var logPostOnly bool
|
var (
|
||||||
|
logPostOnly bool
|
||||||
|
passwordRegex *regexp.Regexp
|
||||||
|
)
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
logPostOnly = conf.GetConfigBool("logPostOnly")
|
logPostOnly = conf.GetConfigBool("logPostOnly")
|
||||||
|
passwordRegex = regexp.MustCompile("\"password\":\".+\"")
|
||||||
}
|
}
|
||||||
|
|
||||||
type Record struct {
|
type Record struct {
|
||||||
@ -40,6 +45,10 @@ type Response struct {
|
|||||||
Msg string `json:"msg"`
|
Msg string `json:"msg"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func maskPassword(recordString string) string {
|
||||||
|
return passwordRegex.ReplaceAllString(recordString, "\"password\":\"***\"")
|
||||||
|
}
|
||||||
|
|
||||||
func NewRecord(ctx *context.Context) (*casvisorsdk.Record, error) {
|
func NewRecord(ctx *context.Context) (*casvisorsdk.Record, error) {
|
||||||
ip := strings.Replace(util.GetIPFromRequest(ctx.Request), ": ", "", -1)
|
ip := strings.Replace(util.GetIPFromRequest(ctx.Request), ": ", "", -1)
|
||||||
action := strings.Replace(ctx.Request.URL.Path, "/api/", "", -1)
|
action := strings.Replace(ctx.Request.URL.Path, "/api/", "", -1)
|
||||||
@ -51,6 +60,7 @@ func NewRecord(ctx *context.Context) (*casvisorsdk.Record, error) {
|
|||||||
object := ""
|
object := ""
|
||||||
if ctx.Input.RequestBody != nil && len(ctx.Input.RequestBody) != 0 {
|
if ctx.Input.RequestBody != nil && len(ctx.Input.RequestBody) != 0 {
|
||||||
object = string(ctx.Input.RequestBody)
|
object = string(ctx.Input.RequestBody)
|
||||||
|
object = maskPassword(object)
|
||||||
}
|
}
|
||||||
|
|
||||||
respBytes, err := json.Marshal(ctx.Input.Data()["json"])
|
respBytes, err := json.Marshal(ctx.Input.Data()["json"])
|
||||||
@ -80,12 +90,18 @@ func NewRecord(ctx *context.Context) (*casvisorsdk.Record, error) {
|
|||||||
Action: action,
|
Action: action,
|
||||||
Language: languageCode,
|
Language: languageCode,
|
||||||
Object: object,
|
Object: object,
|
||||||
|
StatusCode: 200,
|
||||||
Response: fmt.Sprintf("{status:\"%s\", msg:\"%s\"}", resp.Status, resp.Msg),
|
Response: fmt.Sprintf("{status:\"%s\", msg:\"%s\"}", resp.Status, resp.Msg),
|
||||||
IsTriggered: false,
|
IsTriggered: false,
|
||||||
}
|
}
|
||||||
return &record, nil
|
return &record, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func addRecord(record *casvisorsdk.Record) (int64, error) {
|
||||||
|
affected, err := ormer.Engine.Insert(record)
|
||||||
|
return affected, err
|
||||||
|
}
|
||||||
|
|
||||||
func AddRecord(record *casvisorsdk.Record) bool {
|
func AddRecord(record *casvisorsdk.Record) bool {
|
||||||
if logPostOnly {
|
if logPostOnly {
|
||||||
if record.Method == "GET" {
|
if record.Method == "GET" {
|
||||||
@ -98,6 +114,7 @@ func AddRecord(record *casvisorsdk.Record) bool {
|
|||||||
}
|
}
|
||||||
|
|
||||||
record.Owner = record.Organization
|
record.Owner = record.Organization
|
||||||
|
record.Object = maskPassword(record.Object)
|
||||||
|
|
||||||
errWebhook := SendWebhooks(record)
|
errWebhook := SendWebhooks(record)
|
||||||
if errWebhook == nil {
|
if errWebhook == nil {
|
||||||
@ -107,7 +124,7 @@ func AddRecord(record *casvisorsdk.Record) bool {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if casvisorsdk.GetClient() == nil {
|
if casvisorsdk.GetClient() == nil {
|
||||||
affected, err := ormer.Engine.Insert(record)
|
affected, err := addRecord(record)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
panic(err)
|
panic(err)
|
||||||
}
|
}
|
||||||
@ -212,6 +229,40 @@ func getFilteredWebhooks(webhooks []*Webhook, organization string, action string
|
|||||||
return res
|
return res
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func addWebhookRecord(webhook *Webhook, record *casvisorsdk.Record, statusCode int, respBody string, sendError error) error {
|
||||||
|
if statusCode == 200 {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
if len(respBody) > 300 {
|
||||||
|
respBody = respBody[0:300]
|
||||||
|
}
|
||||||
|
|
||||||
|
webhookRecord := &casvisorsdk.Record{
|
||||||
|
Owner: record.Owner,
|
||||||
|
Name: util.GenerateId(),
|
||||||
|
CreatedTime: util.GetCurrentTime(),
|
||||||
|
Organization: record.Organization,
|
||||||
|
User: record.User,
|
||||||
|
|
||||||
|
Method: webhook.Method,
|
||||||
|
Action: "send-webhook",
|
||||||
|
RequestUri: webhook.Url,
|
||||||
|
StatusCode: statusCode,
|
||||||
|
Response: respBody,
|
||||||
|
Language: record.Language,
|
||||||
|
IsTriggered: false,
|
||||||
|
}
|
||||||
|
|
||||||
|
if sendError != nil {
|
||||||
|
webhookRecord.Response = sendError.Error()
|
||||||
|
}
|
||||||
|
|
||||||
|
_, err := addRecord(webhookRecord)
|
||||||
|
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
func SendWebhooks(record *casvisorsdk.Record) error {
|
func SendWebhooks(record *casvisorsdk.Record) error {
|
||||||
webhooks, err := getWebhooksByOrganization("")
|
webhooks, err := getWebhooksByOrganization("")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@ -236,11 +287,16 @@ func SendWebhooks(record *casvisorsdk.Record) error {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
err = sendWebhook(webhook, record, user)
|
statusCode, respBody, err := sendWebhook(webhook, record, user)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
errs = append(errs, err)
|
errs = append(errs, err)
|
||||||
continue
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
err = addWebhookRecord(webhook, record, statusCode, respBody, err)
|
||||||
|
if err != nil {
|
||||||
|
errs = append(errs, err)
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if len(errs) > 0 {
|
if len(errs) > 0 {
|
||||||
|
@ -238,6 +238,15 @@ func AddRolesInBatch(roles []*Role) bool {
|
|||||||
return affected
|
return affected
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func deleteRole(role *Role) (bool, error) {
|
||||||
|
affected, err := ormer.Engine.ID(core.PK{role.Owner, role.Name}).Delete(&Role{})
|
||||||
|
if err != nil {
|
||||||
|
return false, err
|
||||||
|
}
|
||||||
|
|
||||||
|
return affected != 0, nil
|
||||||
|
}
|
||||||
|
|
||||||
func DeleteRole(role *Role) (bool, error) {
|
func DeleteRole(role *Role) (bool, error) {
|
||||||
roleId := role.GetId()
|
roleId := role.GetId()
|
||||||
permissions, err := GetPermissionsByRole(roleId)
|
permissions, err := GetPermissionsByRole(roleId)
|
||||||
@ -253,12 +262,7 @@ func DeleteRole(role *Role) (bool, error) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
affected, err := ormer.Engine.ID(core.PK{role.Owner, role.Name}).Delete(&Role{})
|
return deleteRole(role)
|
||||||
if err != nil {
|
|
||||||
return false, err
|
|
||||||
}
|
|
||||||
|
|
||||||
return affected != 0, nil
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (role *Role) GetId() string {
|
func (role *Role) GetId() string {
|
||||||
|
@ -48,7 +48,7 @@ func SendSms(provider *Provider, content string, phoneNumbers ...string) error {
|
|||||||
if provider.AppId != "" {
|
if provider.AppId != "" {
|
||||||
phoneNumbers = append([]string{provider.AppId}, phoneNumbers...)
|
phoneNumbers = append([]string{provider.AppId}, phoneNumbers...)
|
||||||
}
|
}
|
||||||
} else if provider.Type == sender.Aliyun {
|
} else if provider.Type == sender.Aliyun || provider.Type == sender.SendCloud {
|
||||||
for i, number := range phoneNumbers {
|
for i, number := range phoneNumbers {
|
||||||
phoneNumbers[i] = strings.TrimPrefix(number, "+86")
|
phoneNumbers[i] = strings.TrimPrefix(number, "+86")
|
||||||
}
|
}
|
||||||
|
@ -142,9 +142,11 @@ func (syncer *Syncer) syncUsers() error {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
_, err = AddUsersInBatch(newUsers)
|
if len(newUsers) != 0 {
|
||||||
if err != nil {
|
_, err = AddUsersInBatch(newUsers)
|
||||||
return err
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if !syncer.IsReadOnly {
|
if !syncer.IsReadOnly {
|
||||||
|
@ -919,6 +919,15 @@ func AddUsersInBatch(users []*User) (bool, error) {
|
|||||||
return affected, nil
|
return affected, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func deleteUser(user *User) (bool, error) {
|
||||||
|
affected, err := ormer.Engine.ID(core.PK{user.Owner, user.Name}).Delete(&User{})
|
||||||
|
if err != nil {
|
||||||
|
return false, err
|
||||||
|
}
|
||||||
|
|
||||||
|
return affected != 0, nil
|
||||||
|
}
|
||||||
|
|
||||||
func DeleteUser(user *User) (bool, error) {
|
func DeleteUser(user *User) (bool, error) {
|
||||||
// Forced offline the user first
|
// Forced offline the user first
|
||||||
_, err := DeleteSession(util.GetSessionId(user.Owner, user.Name, CasdoorApplication))
|
_, err := DeleteSession(util.GetSessionId(user.Owner, user.Name, CasdoorApplication))
|
||||||
@ -926,12 +935,7 @@ func DeleteUser(user *User) (bool, error) {
|
|||||||
return false, err
|
return false, err
|
||||||
}
|
}
|
||||||
|
|
||||||
affected, err := ormer.Engine.ID(core.PK{user.Owner, user.Name}).Delete(&User{})
|
return deleteUser(user)
|
||||||
if err != nil {
|
|
||||||
return false, err
|
|
||||||
}
|
|
||||||
|
|
||||||
return affected != 0, nil
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func GetUserInfo(user *User, scope string, aud string, host string) (*Userinfo, error) {
|
func GetUserInfo(user *User, scope string, aud string, host string) (*Userinfo, error) {
|
||||||
|
@ -15,6 +15,7 @@
|
|||||||
package object
|
package object
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"io"
|
||||||
"net/http"
|
"net/http"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
@ -22,7 +23,7 @@ import (
|
|||||||
"github.com/casvisor/casvisor-go-sdk/casvisorsdk"
|
"github.com/casvisor/casvisor-go-sdk/casvisorsdk"
|
||||||
)
|
)
|
||||||
|
|
||||||
func sendWebhook(webhook *Webhook, record *casvisorsdk.Record, extendedUser *User) error {
|
func sendWebhook(webhook *Webhook, record *casvisorsdk.Record, extendedUser *User) (int, string, error) {
|
||||||
client := &http.Client{}
|
client := &http.Client{}
|
||||||
|
|
||||||
type RecordEx struct {
|
type RecordEx struct {
|
||||||
@ -38,7 +39,7 @@ func sendWebhook(webhook *Webhook, record *casvisorsdk.Record, extendedUser *Use
|
|||||||
|
|
||||||
req, err := http.NewRequest(webhook.Method, webhook.Url, body)
|
req, err := http.NewRequest(webhook.Method, webhook.Url, body)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return 0, "", err
|
||||||
}
|
}
|
||||||
|
|
||||||
req.Header.Set("Content-Type", webhook.ContentType)
|
req.Header.Set("Content-Type", webhook.ContentType)
|
||||||
@ -47,6 +48,15 @@ func sendWebhook(webhook *Webhook, record *casvisorsdk.Record, extendedUser *Use
|
|||||||
req.Header.Set(header.Name, header.Value)
|
req.Header.Set(header.Name, header.Value)
|
||||||
}
|
}
|
||||||
|
|
||||||
_, err = client.Do(req)
|
resp, err := client.Do(req)
|
||||||
return err
|
if err != nil {
|
||||||
|
return 0, "", err
|
||||||
|
}
|
||||||
|
|
||||||
|
defer resp.Body.Close()
|
||||||
|
bodyBytes, err := io.ReadAll(resp.Body)
|
||||||
|
if err != nil {
|
||||||
|
return 0, "", err
|
||||||
|
}
|
||||||
|
return resp.StatusCode, string(bodyBytes), err
|
||||||
}
|
}
|
||||||
|
@ -41,7 +41,7 @@ class ProductEditPage extends React.Component {
|
|||||||
UNSAFE_componentWillMount() {
|
UNSAFE_componentWillMount() {
|
||||||
this.getProduct();
|
this.getProduct();
|
||||||
this.getOrganizations();
|
this.getOrganizations();
|
||||||
this.getPaymentProviders();
|
this.getPaymentProviders(this.state.organizationName);
|
||||||
}
|
}
|
||||||
|
|
||||||
getProduct() {
|
getProduct() {
|
||||||
@ -67,8 +67,8 @@ class ProductEditPage extends React.Component {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
getPaymentProviders() {
|
getPaymentProviders(organizationName) {
|
||||||
ProviderBackend.getProviders(this.props.account.owner)
|
ProviderBackend.getProviders(organizationName)
|
||||||
.then((res) => {
|
.then((res) => {
|
||||||
if (res.status === "ok") {
|
if (res.status === "ok") {
|
||||||
this.setState({
|
this.setState({
|
||||||
|
@ -209,6 +209,8 @@ class ProviderEditPage extends React.Component {
|
|||||||
return Setting.getLabel(i18next.t("provider:Public key"), i18next.t("provider:Public key - Tooltip"));
|
return Setting.getLabel(i18next.t("provider:Public key"), i18next.t("provider:Public key - Tooltip"));
|
||||||
} else if (provider.type === "Msg91 SMS" || provider.type === "Infobip SMS" || provider.type === "OSON SMS") {
|
} else if (provider.type === "Msg91 SMS" || provider.type === "Infobip SMS" || provider.type === "OSON SMS") {
|
||||||
return Setting.getLabel(i18next.t("provider:Sender Id"), i18next.t("provider:Sender Id - Tooltip"));
|
return Setting.getLabel(i18next.t("provider:Sender Id"), i18next.t("provider:Sender Id - Tooltip"));
|
||||||
|
} else if (provider.type === "SendCloud SMS") {
|
||||||
|
return "SMS_USER";
|
||||||
} else {
|
} else {
|
||||||
return Setting.getLabel(i18next.t("provider:Client ID"), i18next.t("provider:Client ID - Tooltip"));
|
return Setting.getLabel(i18next.t("provider:Client ID"), i18next.t("provider:Client ID - Tooltip"));
|
||||||
}
|
}
|
||||||
@ -260,6 +262,8 @@ class ProviderEditPage extends React.Component {
|
|||||||
return Setting.getLabel(i18next.t("provider:Auth Key"), i18next.t("provider:Auth Key - Tooltip"));
|
return Setting.getLabel(i18next.t("provider:Auth Key"), i18next.t("provider:Auth Key - Tooltip"));
|
||||||
} else if (provider.type === "Infobip SMS") {
|
} else if (provider.type === "Infobip SMS") {
|
||||||
return Setting.getLabel(i18next.t("provider:Api Key"), i18next.t("provider:Api Key - Tooltip"));
|
return Setting.getLabel(i18next.t("provider:Api Key"), i18next.t("provider:Api Key - Tooltip"));
|
||||||
|
} else if (provider.type === "SendCloud SMS") {
|
||||||
|
return "SMS_KEY";
|
||||||
} else {
|
} else {
|
||||||
return Setting.getLabel(i18next.t("provider:Client secret"), i18next.t("provider:Client secret - Tooltip"));
|
return Setting.getLabel(i18next.t("provider:Client secret"), i18next.t("provider:Client secret - Tooltip"));
|
||||||
}
|
}
|
||||||
@ -1089,7 +1093,7 @@ class ProviderEditPage extends React.Component {
|
|||||||
</React.Fragment>
|
</React.Fragment>
|
||||||
) : this.state.provider.category === "SMS" ? (
|
) : this.state.provider.category === "SMS" ? (
|
||||||
<React.Fragment>
|
<React.Fragment>
|
||||||
{["Custom HTTP SMS", "Twilio SMS", "Amazon SNS", "Azure ACS", "Msg91 SMS", "Infobip SMS"].includes(this.state.provider.type) ?
|
{["Custom HTTP SMS", "Twilio SMS", "Amazon SNS", "Azure ACS", "Msg91 SMS", "Infobip SMS", "SendCloud SMS"].includes(this.state.provider.type) ?
|
||||||
null :
|
null :
|
||||||
(<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}>
|
||||||
|
@ -151,6 +151,14 @@ class RecordListPage extends BaseListPage {
|
|||||||
sorter: true,
|
sorter: true,
|
||||||
...this.getColumnSearchProps("language"),
|
...this.getColumnSearchProps("language"),
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
title: i18next.t("record:Status code"),
|
||||||
|
dataIndex: "statusCode",
|
||||||
|
key: "statusCode",
|
||||||
|
width: "90px",
|
||||||
|
sorter: true,
|
||||||
|
...this.getColumnSearchProps("statusCode"),
|
||||||
|
},
|
||||||
{
|
{
|
||||||
title: i18next.t("record:Response"),
|
title: i18next.t("record:Response"),
|
||||||
dataIndex: "response",
|
dataIndex: "response",
|
||||||
|
@ -139,6 +139,10 @@ export const OtherProviderInfo = {
|
|||||||
logo: `${StaticBaseUrl}/img/social_twilio.svg`,
|
logo: `${StaticBaseUrl}/img/social_twilio.svg`,
|
||||||
url: "https://www.twilio.com/messaging",
|
url: "https://www.twilio.com/messaging",
|
||||||
},
|
},
|
||||||
|
"SendCloud SMS": {
|
||||||
|
logo: `${StaticBaseUrl}/img/sms_sendcloud.png`,
|
||||||
|
url: "https://www.sendcloud.net/",
|
||||||
|
},
|
||||||
"SmsBao SMS": {
|
"SmsBao SMS": {
|
||||||
logo: `${StaticBaseUrl}/img/social_smsbao.png`,
|
logo: `${StaticBaseUrl}/img/social_smsbao.png`,
|
||||||
url: "https://www.smsbao.com/",
|
url: "https://www.smsbao.com/",
|
||||||
@ -1039,6 +1043,7 @@ export function getProviderTypeOptions(category) {
|
|||||||
{id: "Huawei Cloud SMS", name: "Huawei Cloud SMS"},
|
{id: "Huawei Cloud SMS", name: "Huawei Cloud SMS"},
|
||||||
{id: "UCloud SMS", name: "UCloud SMS"},
|
{id: "UCloud SMS", name: "UCloud SMS"},
|
||||||
{id: "Twilio SMS", name: "Twilio SMS"},
|
{id: "Twilio SMS", name: "Twilio SMS"},
|
||||||
|
{id: "SendCloud SMS", name: "SendCloud SMS"},
|
||||||
{id: "SmsBao SMS", name: "SmsBao SMS"},
|
{id: "SmsBao SMS", name: "SmsBao SMS"},
|
||||||
{id: "SUBMAIL SMS", name: "SUBMAIL SMS"},
|
{id: "SUBMAIL SMS", name: "SUBMAIL SMS"},
|
||||||
{id: "Msg91 SMS", name: "Msg91 SMS"},
|
{id: "Msg91 SMS", name: "Msg91 SMS"},
|
||||||
|
@ -897,7 +897,8 @@
|
|||||||
"record": {
|
"record": {
|
||||||
"Is triggered": "Is triggered",
|
"Is triggered": "Is triggered",
|
||||||
"Object": "Object",
|
"Object": "Object",
|
||||||
"Response": "Response"
|
"Response": "Response",
|
||||||
|
"Status code": "Status code"
|
||||||
},
|
},
|
||||||
"resource": {
|
"resource": {
|
||||||
"Copy Link": "Copy Link",
|
"Copy Link": "Copy Link",
|
||||||
@ -1171,6 +1172,7 @@
|
|||||||
"input password": "input password"
|
"input password": "input password"
|
||||||
},
|
},
|
||||||
"verification": {
|
"verification": {
|
||||||
|
"Is used": "Is used",
|
||||||
"Receiver": "Receiver"
|
"Receiver": "Receiver"
|
||||||
},
|
},
|
||||||
"webhook": {
|
"webhook": {
|
||||||
|
@ -897,7 +897,8 @@
|
|||||||
"record": {
|
"record": {
|
||||||
"Is triggered": "Is triggered",
|
"Is triggered": "Is triggered",
|
||||||
"Object": "Object",
|
"Object": "Object",
|
||||||
"Response": "Response"
|
"Response": "Response",
|
||||||
|
"Status code": "Status code"
|
||||||
},
|
},
|
||||||
"resource": {
|
"resource": {
|
||||||
"Copy Link": "Kopiere den Link",
|
"Copy Link": "Kopiere den Link",
|
||||||
@ -1171,6 +1172,7 @@
|
|||||||
"input password": "Eingabe des Passworts"
|
"input password": "Eingabe des Passworts"
|
||||||
},
|
},
|
||||||
"verification": {
|
"verification": {
|
||||||
|
"Is used": "Is used",
|
||||||
"Receiver": "Receiver"
|
"Receiver": "Receiver"
|
||||||
},
|
},
|
||||||
"webhook": {
|
"webhook": {
|
||||||
|
@ -897,7 +897,8 @@
|
|||||||
"record": {
|
"record": {
|
||||||
"Is triggered": "Is triggered",
|
"Is triggered": "Is triggered",
|
||||||
"Object": "Object",
|
"Object": "Object",
|
||||||
"Response": "Response"
|
"Response": "Response",
|
||||||
|
"Status code": "Status code"
|
||||||
},
|
},
|
||||||
"resource": {
|
"resource": {
|
||||||
"Copy Link": "Copy Link",
|
"Copy Link": "Copy Link",
|
||||||
@ -1171,6 +1172,7 @@
|
|||||||
"input password": "input password"
|
"input password": "input password"
|
||||||
},
|
},
|
||||||
"verification": {
|
"verification": {
|
||||||
|
"Is used": "Is used",
|
||||||
"Receiver": "Receiver"
|
"Receiver": "Receiver"
|
||||||
},
|
},
|
||||||
"webhook": {
|
"webhook": {
|
||||||
|
@ -897,7 +897,8 @@
|
|||||||
"record": {
|
"record": {
|
||||||
"Is triggered": "Is triggered",
|
"Is triggered": "Is triggered",
|
||||||
"Object": "Object",
|
"Object": "Object",
|
||||||
"Response": "Response"
|
"Response": "Response",
|
||||||
|
"Status code": "Status code"
|
||||||
},
|
},
|
||||||
"resource": {
|
"resource": {
|
||||||
"Copy Link": "Copiar enlace",
|
"Copy Link": "Copiar enlace",
|
||||||
@ -1171,6 +1172,7 @@
|
|||||||
"input password": "Ingresar contraseña"
|
"input password": "Ingresar contraseña"
|
||||||
},
|
},
|
||||||
"verification": {
|
"verification": {
|
||||||
|
"Is used": "Is used",
|
||||||
"Receiver": "Receiver"
|
"Receiver": "Receiver"
|
||||||
},
|
},
|
||||||
"webhook": {
|
"webhook": {
|
||||||
|
@ -897,7 +897,8 @@
|
|||||||
"record": {
|
"record": {
|
||||||
"Is triggered": "Is triggered",
|
"Is triggered": "Is triggered",
|
||||||
"Object": "Object",
|
"Object": "Object",
|
||||||
"Response": "Response"
|
"Response": "Response",
|
||||||
|
"Status code": "Status code"
|
||||||
},
|
},
|
||||||
"resource": {
|
"resource": {
|
||||||
"Copy Link": "Copy Link",
|
"Copy Link": "Copy Link",
|
||||||
@ -1171,6 +1172,7 @@
|
|||||||
"input password": "input password"
|
"input password": "input password"
|
||||||
},
|
},
|
||||||
"verification": {
|
"verification": {
|
||||||
|
"Is used": "Is used",
|
||||||
"Receiver": "Receiver"
|
"Receiver": "Receiver"
|
||||||
},
|
},
|
||||||
"webhook": {
|
"webhook": {
|
||||||
|
@ -897,7 +897,8 @@
|
|||||||
"record": {
|
"record": {
|
||||||
"Is triggered": "Is triggered",
|
"Is triggered": "Is triggered",
|
||||||
"Object": "Object",
|
"Object": "Object",
|
||||||
"Response": "Response"
|
"Response": "Response",
|
||||||
|
"Status code": "Status code"
|
||||||
},
|
},
|
||||||
"resource": {
|
"resource": {
|
||||||
"Copy Link": "Copy Link",
|
"Copy Link": "Copy Link",
|
||||||
@ -1171,6 +1172,7 @@
|
|||||||
"input password": "input password"
|
"input password": "input password"
|
||||||
},
|
},
|
||||||
"verification": {
|
"verification": {
|
||||||
|
"Is used": "Is used",
|
||||||
"Receiver": "Receiver"
|
"Receiver": "Receiver"
|
||||||
},
|
},
|
||||||
"webhook": {
|
"webhook": {
|
||||||
|
@ -897,7 +897,8 @@
|
|||||||
"record": {
|
"record": {
|
||||||
"Is triggered": "Is triggered",
|
"Is triggered": "Is triggered",
|
||||||
"Object": "Object",
|
"Object": "Object",
|
||||||
"Response": "Response"
|
"Response": "Response",
|
||||||
|
"Status code": "Status code"
|
||||||
},
|
},
|
||||||
"resource": {
|
"resource": {
|
||||||
"Copy Link": "Copier le lien",
|
"Copy Link": "Copier le lien",
|
||||||
@ -1171,6 +1172,7 @@
|
|||||||
"input password": "saisir le mot de passe"
|
"input password": "saisir le mot de passe"
|
||||||
},
|
},
|
||||||
"verification": {
|
"verification": {
|
||||||
|
"Is used": "Is used",
|
||||||
"Receiver": "Receiver"
|
"Receiver": "Receiver"
|
||||||
},
|
},
|
||||||
"webhook": {
|
"webhook": {
|
||||||
|
@ -897,7 +897,8 @@
|
|||||||
"record": {
|
"record": {
|
||||||
"Is triggered": "Is triggered",
|
"Is triggered": "Is triggered",
|
||||||
"Object": "Object",
|
"Object": "Object",
|
||||||
"Response": "Response"
|
"Response": "Response",
|
||||||
|
"Status code": "Status code"
|
||||||
},
|
},
|
||||||
"resource": {
|
"resource": {
|
||||||
"Copy Link": "Copy Link",
|
"Copy Link": "Copy Link",
|
||||||
@ -1171,6 +1172,7 @@
|
|||||||
"input password": "input password"
|
"input password": "input password"
|
||||||
},
|
},
|
||||||
"verification": {
|
"verification": {
|
||||||
|
"Is used": "Is used",
|
||||||
"Receiver": "Receiver"
|
"Receiver": "Receiver"
|
||||||
},
|
},
|
||||||
"webhook": {
|
"webhook": {
|
||||||
|
@ -897,7 +897,8 @@
|
|||||||
"record": {
|
"record": {
|
||||||
"Is triggered": "Is triggered",
|
"Is triggered": "Is triggered",
|
||||||
"Object": "Object",
|
"Object": "Object",
|
||||||
"Response": "Response"
|
"Response": "Response",
|
||||||
|
"Status code": "Status code"
|
||||||
},
|
},
|
||||||
"resource": {
|
"resource": {
|
||||||
"Copy Link": "Salin Tautan",
|
"Copy Link": "Salin Tautan",
|
||||||
@ -1171,6 +1172,7 @@
|
|||||||
"input password": "masukkan kata sandi"
|
"input password": "masukkan kata sandi"
|
||||||
},
|
},
|
||||||
"verification": {
|
"verification": {
|
||||||
|
"Is used": "Is used",
|
||||||
"Receiver": "Receiver"
|
"Receiver": "Receiver"
|
||||||
},
|
},
|
||||||
"webhook": {
|
"webhook": {
|
||||||
|
@ -897,7 +897,8 @@
|
|||||||
"record": {
|
"record": {
|
||||||
"Is triggered": "Is triggered",
|
"Is triggered": "Is triggered",
|
||||||
"Object": "Object",
|
"Object": "Object",
|
||||||
"Response": "Response"
|
"Response": "Response",
|
||||||
|
"Status code": "Status code"
|
||||||
},
|
},
|
||||||
"resource": {
|
"resource": {
|
||||||
"Copy Link": "Copy Link",
|
"Copy Link": "Copy Link",
|
||||||
@ -1171,6 +1172,7 @@
|
|||||||
"input password": "input password"
|
"input password": "input password"
|
||||||
},
|
},
|
||||||
"verification": {
|
"verification": {
|
||||||
|
"Is used": "Is used",
|
||||||
"Receiver": "Receiver"
|
"Receiver": "Receiver"
|
||||||
},
|
},
|
||||||
"webhook": {
|
"webhook": {
|
||||||
|
@ -897,7 +897,8 @@
|
|||||||
"record": {
|
"record": {
|
||||||
"Is triggered": "Is triggered",
|
"Is triggered": "Is triggered",
|
||||||
"Object": "Object",
|
"Object": "Object",
|
||||||
"Response": "Response"
|
"Response": "Response",
|
||||||
|
"Status code": "Status code"
|
||||||
},
|
},
|
||||||
"resource": {
|
"resource": {
|
||||||
"Copy Link": "コピー リンク",
|
"Copy Link": "コピー リンク",
|
||||||
@ -1171,6 +1172,7 @@
|
|||||||
"input password": "パスワードを入力してください"
|
"input password": "パスワードを入力してください"
|
||||||
},
|
},
|
||||||
"verification": {
|
"verification": {
|
||||||
|
"Is used": "Is used",
|
||||||
"Receiver": "Receiver"
|
"Receiver": "Receiver"
|
||||||
},
|
},
|
||||||
"webhook": {
|
"webhook": {
|
||||||
|
@ -897,7 +897,8 @@
|
|||||||
"record": {
|
"record": {
|
||||||
"Is triggered": "Is triggered",
|
"Is triggered": "Is triggered",
|
||||||
"Object": "Object",
|
"Object": "Object",
|
||||||
"Response": "Response"
|
"Response": "Response",
|
||||||
|
"Status code": "Status code"
|
||||||
},
|
},
|
||||||
"resource": {
|
"resource": {
|
||||||
"Copy Link": "Copy Link",
|
"Copy Link": "Copy Link",
|
||||||
@ -1171,6 +1172,7 @@
|
|||||||
"input password": "input password"
|
"input password": "input password"
|
||||||
},
|
},
|
||||||
"verification": {
|
"verification": {
|
||||||
|
"Is used": "Is used",
|
||||||
"Receiver": "Receiver"
|
"Receiver": "Receiver"
|
||||||
},
|
},
|
||||||
"webhook": {
|
"webhook": {
|
||||||
|
@ -897,7 +897,8 @@
|
|||||||
"record": {
|
"record": {
|
||||||
"Is triggered": "Is triggered",
|
"Is triggered": "Is triggered",
|
||||||
"Object": "Object",
|
"Object": "Object",
|
||||||
"Response": "Response"
|
"Response": "Response",
|
||||||
|
"Status code": "Status code"
|
||||||
},
|
},
|
||||||
"resource": {
|
"resource": {
|
||||||
"Copy Link": "링크 복사하기",
|
"Copy Link": "링크 복사하기",
|
||||||
@ -1171,6 +1172,7 @@
|
|||||||
"input password": "비밀번호를 입력해주세요"
|
"input password": "비밀번호를 입력해주세요"
|
||||||
},
|
},
|
||||||
"verification": {
|
"verification": {
|
||||||
|
"Is used": "Is used",
|
||||||
"Receiver": "Receiver"
|
"Receiver": "Receiver"
|
||||||
},
|
},
|
||||||
"webhook": {
|
"webhook": {
|
||||||
|
@ -897,7 +897,8 @@
|
|||||||
"record": {
|
"record": {
|
||||||
"Is triggered": "Is triggered",
|
"Is triggered": "Is triggered",
|
||||||
"Object": "Object",
|
"Object": "Object",
|
||||||
"Response": "Response"
|
"Response": "Response",
|
||||||
|
"Status code": "Status code"
|
||||||
},
|
},
|
||||||
"resource": {
|
"resource": {
|
||||||
"Copy Link": "Copy Link",
|
"Copy Link": "Copy Link",
|
||||||
@ -1171,6 +1172,7 @@
|
|||||||
"input password": "input password"
|
"input password": "input password"
|
||||||
},
|
},
|
||||||
"verification": {
|
"verification": {
|
||||||
|
"Is used": "Is used",
|
||||||
"Receiver": "Receiver"
|
"Receiver": "Receiver"
|
||||||
},
|
},
|
||||||
"webhook": {
|
"webhook": {
|
||||||
|
@ -897,7 +897,8 @@
|
|||||||
"record": {
|
"record": {
|
||||||
"Is triggered": "Is triggered",
|
"Is triggered": "Is triggered",
|
||||||
"Object": "Object",
|
"Object": "Object",
|
||||||
"Response": "Response"
|
"Response": "Response",
|
||||||
|
"Status code": "Status code"
|
||||||
},
|
},
|
||||||
"resource": {
|
"resource": {
|
||||||
"Copy Link": "Copy Link",
|
"Copy Link": "Copy Link",
|
||||||
@ -1171,6 +1172,7 @@
|
|||||||
"input password": "input password"
|
"input password": "input password"
|
||||||
},
|
},
|
||||||
"verification": {
|
"verification": {
|
||||||
|
"Is used": "Is used",
|
||||||
"Receiver": "Receiver"
|
"Receiver": "Receiver"
|
||||||
},
|
},
|
||||||
"webhook": {
|
"webhook": {
|
||||||
|
@ -897,7 +897,8 @@
|
|||||||
"record": {
|
"record": {
|
||||||
"Is triggered": "Is triggered",
|
"Is triggered": "Is triggered",
|
||||||
"Object": "Object",
|
"Object": "Object",
|
||||||
"Response": "Response"
|
"Response": "Response",
|
||||||
|
"Status code": "Status code"
|
||||||
},
|
},
|
||||||
"resource": {
|
"resource": {
|
||||||
"Copy Link": "Copy Link",
|
"Copy Link": "Copy Link",
|
||||||
@ -1171,6 +1172,7 @@
|
|||||||
"input password": "input password"
|
"input password": "input password"
|
||||||
},
|
},
|
||||||
"verification": {
|
"verification": {
|
||||||
|
"Is used": "Is used",
|
||||||
"Receiver": "Receiver"
|
"Receiver": "Receiver"
|
||||||
},
|
},
|
||||||
"webhook": {
|
"webhook": {
|
||||||
|
@ -897,7 +897,8 @@
|
|||||||
"record": {
|
"record": {
|
||||||
"Is triggered": "Is triggered",
|
"Is triggered": "Is triggered",
|
||||||
"Object": "Object",
|
"Object": "Object",
|
||||||
"Response": "Response"
|
"Response": "Response",
|
||||||
|
"Status code": "Status code"
|
||||||
},
|
},
|
||||||
"resource": {
|
"resource": {
|
||||||
"Copy Link": "Copiar Link",
|
"Copy Link": "Copiar Link",
|
||||||
@ -1171,6 +1172,7 @@
|
|||||||
"input password": "Digite a senha"
|
"input password": "Digite a senha"
|
||||||
},
|
},
|
||||||
"verification": {
|
"verification": {
|
||||||
|
"Is used": "Is used",
|
||||||
"Receiver": "Receiver"
|
"Receiver": "Receiver"
|
||||||
},
|
},
|
||||||
"webhook": {
|
"webhook": {
|
||||||
|
@ -897,7 +897,8 @@
|
|||||||
"record": {
|
"record": {
|
||||||
"Is triggered": "Is triggered",
|
"Is triggered": "Is triggered",
|
||||||
"Object": "Object",
|
"Object": "Object",
|
||||||
"Response": "Response"
|
"Response": "Response",
|
||||||
|
"Status code": "Status code"
|
||||||
},
|
},
|
||||||
"resource": {
|
"resource": {
|
||||||
"Copy Link": "Копировать ссылку",
|
"Copy Link": "Копировать ссылку",
|
||||||
@ -1171,6 +1172,7 @@
|
|||||||
"input password": "введите пароль"
|
"input password": "введите пароль"
|
||||||
},
|
},
|
||||||
"verification": {
|
"verification": {
|
||||||
|
"Is used": "Is used",
|
||||||
"Receiver": "Receiver"
|
"Receiver": "Receiver"
|
||||||
},
|
},
|
||||||
"webhook": {
|
"webhook": {
|
||||||
|
@ -897,7 +897,8 @@
|
|||||||
"record": {
|
"record": {
|
||||||
"Is triggered": "Is triggered",
|
"Is triggered": "Is triggered",
|
||||||
"Object": "Object",
|
"Object": "Object",
|
||||||
"Response": "Response"
|
"Response": "Response",
|
||||||
|
"Status code": "Status code"
|
||||||
},
|
},
|
||||||
"resource": {
|
"resource": {
|
||||||
"Copy Link": "Copy Link",
|
"Copy Link": "Copy Link",
|
||||||
@ -1171,6 +1172,7 @@
|
|||||||
"input password": "input password"
|
"input password": "input password"
|
||||||
},
|
},
|
||||||
"verification": {
|
"verification": {
|
||||||
|
"Is used": "Is used",
|
||||||
"Receiver": "Receiver"
|
"Receiver": "Receiver"
|
||||||
},
|
},
|
||||||
"webhook": {
|
"webhook": {
|
||||||
|
@ -897,7 +897,8 @@
|
|||||||
"record": {
|
"record": {
|
||||||
"Is triggered": "Is triggered",
|
"Is triggered": "Is triggered",
|
||||||
"Object": "Object",
|
"Object": "Object",
|
||||||
"Response": "Response"
|
"Response": "Response",
|
||||||
|
"Status code": "Status code"
|
||||||
},
|
},
|
||||||
"resource": {
|
"resource": {
|
||||||
"Copy Link": "Copy Link",
|
"Copy Link": "Copy Link",
|
||||||
@ -1171,6 +1172,7 @@
|
|||||||
"input password": "şifreyi girin"
|
"input password": "şifreyi girin"
|
||||||
},
|
},
|
||||||
"verification": {
|
"verification": {
|
||||||
|
"Is used": "Is used",
|
||||||
"Receiver": "Receiver"
|
"Receiver": "Receiver"
|
||||||
},
|
},
|
||||||
"webhook": {
|
"webhook": {
|
||||||
|
@ -80,6 +80,7 @@
|
|||||||
"Only signup": "Тільки реєстрація",
|
"Only signup": "Тільки реєстрація",
|
||||||
"Org choice mode": "Режим вибору організації",
|
"Org choice mode": "Режим вибору організації",
|
||||||
"Org choice mode - Tooltip": "Режим вибору організації – підказка",
|
"Org choice mode - Tooltip": "Режим вибору організації – підказка",
|
||||||
|
"Please enable \\\"Signin session\\\" first before enabling \\\"Auto signin\\\"": "Please enable \\\"Signin session\\\" first before enabling \\\"Auto signin\\\"",
|
||||||
"Please input your application!": "Будь ласка, введіть свою заявку!",
|
"Please input your application!": "Будь ласка, введіть свою заявку!",
|
||||||
"Please input your organization!": "Будь ласка, введіть вашу організацію!",
|
"Please input your organization!": "Будь ласка, введіть вашу організацію!",
|
||||||
"Please select a HTML file": "Виберіть файл HTML",
|
"Please select a HTML file": "Виберіть файл HTML",
|
||||||
@ -229,6 +230,7 @@
|
|||||||
"Email": "Електронна пошта",
|
"Email": "Електронна пошта",
|
||||||
"Email - Tooltip": "Дійсна електронна пошта",
|
"Email - Tooltip": "Дійсна електронна пошта",
|
||||||
"Email only": "Лише електронна пошта",
|
"Email only": "Лише електронна пошта",
|
||||||
|
"Email or Phone": "Email or Phone",
|
||||||
"Enable": "Увімкнути",
|
"Enable": "Увімкнути",
|
||||||
"Enable dark logo": "Увімкнути темний логотип",
|
"Enable dark logo": "Увімкнути темний логотип",
|
||||||
"Enable dark logo - Tooltip": "Увімкнути темний логотип",
|
"Enable dark logo - Tooltip": "Увімкнути темний логотип",
|
||||||
@ -311,6 +313,7 @@
|
|||||||
"Phone": "Телефон",
|
"Phone": "Телефон",
|
||||||
"Phone - Tooltip": "Номер телефону",
|
"Phone - Tooltip": "Номер телефону",
|
||||||
"Phone only": "Тільки телефон",
|
"Phone only": "Тільки телефон",
|
||||||
|
"Phone or Email": "Phone or Email",
|
||||||
"Plan": "План",
|
"Plan": "План",
|
||||||
"Plan - Tooltip": "План – підказка",
|
"Plan - Tooltip": "План – підказка",
|
||||||
"Plans": "Плани",
|
"Plans": "Плани",
|
||||||
@ -391,6 +394,7 @@
|
|||||||
"User type": "Тип користувача",
|
"User type": "Тип користувача",
|
||||||
"User type - Tooltip": "Теги, до яких належить користувач, за умовчанням \"звичайний користувач\"",
|
"User type - Tooltip": "Теги, до яких належить користувач, за умовчанням \"звичайний користувач\"",
|
||||||
"Users": "Користувачі",
|
"Users": "Користувачі",
|
||||||
|
"Users - Tooltip": "Users - Tooltip",
|
||||||
"Users under all organizations": "Користувачі в усіх організаціях",
|
"Users under all organizations": "Користувачі в усіх організаціях",
|
||||||
"Verifications": "Перевірки",
|
"Verifications": "Перевірки",
|
||||||
"Webhooks": "Веб-хуки",
|
"Webhooks": "Веб-хуки",
|
||||||
@ -473,7 +477,6 @@
|
|||||||
"LDAP username, Email or phone": "Ім’я користувача LDAP, електронна пошта або телефон",
|
"LDAP username, Email or phone": "Ім’я користувача LDAP, електронна пошта або телефон",
|
||||||
"Loading": "Завантаження",
|
"Loading": "Завантаження",
|
||||||
"Logging out...": "Вихід...",
|
"Logging out...": "Вихід...",
|
||||||
"Login button": "Кнопка входу",
|
|
||||||
"MetaMask plugin not detected": "Плагін MetaMask не виявлено",
|
"MetaMask plugin not detected": "Плагін MetaMask не виявлено",
|
||||||
"Model loading failure": "Помилка завантаження моделі",
|
"Model loading failure": "Помилка завантаження моделі",
|
||||||
"No account?": "Немає облікового запису?",
|
"No account?": "Немає облікового запису?",
|
||||||
@ -498,6 +501,7 @@
|
|||||||
"Sign in with Face ID": "Увійдіть за допомогою Face ID",
|
"Sign in with Face ID": "Увійдіть за допомогою Face ID",
|
||||||
"Sign in with WebAuthn": "Увійдіть за допомогою WebAuthn",
|
"Sign in with WebAuthn": "Увійдіть за допомогою WebAuthn",
|
||||||
"Sign in with {type}": "Увійдіть за допомогою {type}",
|
"Sign in with {type}": "Увійдіть за допомогою {type}",
|
||||||
|
"Signin button": "Signin button",
|
||||||
"Signing in...": "Вхід...",
|
"Signing in...": "Вхід...",
|
||||||
"Successfully logged in with WebAuthn credentials": "Успішно ввійшли за допомогою облікових даних WebAuthn",
|
"Successfully logged in with WebAuthn credentials": "Успішно ввійшли за допомогою облікових даних WebAuthn",
|
||||||
"The camera is currently in use by another webpage": "Камера зараз використовується іншою веб-сторінкою",
|
"The camera is currently in use by another webpage": "Камера зараз використовується іншою веб-сторінкою",
|
||||||
@ -893,7 +897,8 @@
|
|||||||
"record": {
|
"record": {
|
||||||
"Is triggered": "Спрацьовує",
|
"Is triggered": "Спрацьовує",
|
||||||
"Object": "Об'єкт",
|
"Object": "Об'єкт",
|
||||||
"Response": "Відповідь"
|
"Response": "Відповідь",
|
||||||
|
"Status code": "Status code"
|
||||||
},
|
},
|
||||||
"resource": {
|
"resource": {
|
||||||
"Copy Link": "Копіювати посилання",
|
"Copy Link": "Копіювати посилання",
|
||||||
@ -941,6 +946,7 @@
|
|||||||
"Please select your country code!": "Виберіть код країни!",
|
"Please select your country code!": "Виберіть код країни!",
|
||||||
"Please select your country/region!": "Виберіть свою країну/регіон!",
|
"Please select your country/region!": "Виберіть свою країну/регіон!",
|
||||||
"Regex": "Регулярний вираз",
|
"Regex": "Регулярний вираз",
|
||||||
|
"Signup button": "Signup button",
|
||||||
"Terms of Use": "Умови використання",
|
"Terms of Use": "Умови використання",
|
||||||
"Terms of Use - Tooltip": "Умови використання, з якими користувачі повинні ознайомитися та погодитися під час реєстрації",
|
"Terms of Use - Tooltip": "Умови використання, з якими користувачі повинні ознайомитися та погодитися під час реєстрації",
|
||||||
"Text 1": "Текст 1",
|
"Text 1": "Текст 1",
|
||||||
@ -1162,9 +1168,11 @@
|
|||||||
"Values": "Цінності",
|
"Values": "Цінності",
|
||||||
"Verification code sent": "Код підтвердження надіслано",
|
"Verification code sent": "Код підтвердження надіслано",
|
||||||
"WebAuthn credentials": "Облікові дані WebAuthn",
|
"WebAuthn credentials": "Облікові дані WebAuthn",
|
||||||
|
"You have changed the username, please save your change first before modifying the password": "You have changed the username, please save your change first before modifying the password",
|
||||||
"input password": "введіть пароль"
|
"input password": "введіть пароль"
|
||||||
},
|
},
|
||||||
"verification": {
|
"verification": {
|
||||||
|
"Is used": "Is used",
|
||||||
"Receiver": "Приймач"
|
"Receiver": "Приймач"
|
||||||
},
|
},
|
||||||
"webhook": {
|
"webhook": {
|
||||||
|
@ -897,7 +897,8 @@
|
|||||||
"record": {
|
"record": {
|
||||||
"Is triggered": "Is triggered",
|
"Is triggered": "Is triggered",
|
||||||
"Object": "Object",
|
"Object": "Object",
|
||||||
"Response": "Response"
|
"Response": "Response",
|
||||||
|
"Status code": "Status code"
|
||||||
},
|
},
|
||||||
"resource": {
|
"resource": {
|
||||||
"Copy Link": "Sao chép liên kết",
|
"Copy Link": "Sao chép liên kết",
|
||||||
@ -1171,6 +1172,7 @@
|
|||||||
"input password": "Nhập mật khẩu"
|
"input password": "Nhập mật khẩu"
|
||||||
},
|
},
|
||||||
"verification": {
|
"verification": {
|
||||||
|
"Is used": "Is used",
|
||||||
"Receiver": "Receiver"
|
"Receiver": "Receiver"
|
||||||
},
|
},
|
||||||
"webhook": {
|
"webhook": {
|
||||||
|
@ -897,7 +897,8 @@
|
|||||||
"record": {
|
"record": {
|
||||||
"Is triggered": "是否触发",
|
"Is triggered": "是否触发",
|
||||||
"Object": "实体",
|
"Object": "实体",
|
||||||
"Response": "响应"
|
"Response": "响应",
|
||||||
|
"Status code": "状态码"
|
||||||
},
|
},
|
||||||
"resource": {
|
"resource": {
|
||||||
"Copy Link": "复制链接",
|
"Copy Link": "复制链接",
|
||||||
@ -1171,6 +1172,7 @@
|
|||||||
"input password": "输入密码"
|
"input password": "输入密码"
|
||||||
},
|
},
|
||||||
"verification": {
|
"verification": {
|
||||||
|
"Is used": "已使用",
|
||||||
"Receiver": "接收者"
|
"Receiver": "接收者"
|
||||||
},
|
},
|
||||||
"webhook": {
|
"webhook": {
|
||||||
|
@ -84,7 +84,7 @@ class ProviderTable extends React.Component {
|
|||||||
|
|
||||||
// If the provider is email or SMS, set the rule to "all" instead of the default "None"
|
// If the provider is email or SMS, set the rule to "all" instead of the default "None"
|
||||||
if (provider.category === "Email" || provider.category === "SMS") {
|
if (provider.category === "Email" || provider.category === "SMS") {
|
||||||
this.updateField(table, index, "rule", "all");
|
this.updateField(table, index, "rule", "All");
|
||||||
}
|
}
|
||||||
}} >
|
}} >
|
||||||
{
|
{
|
||||||
@ -116,8 +116,8 @@ class ProviderTable extends React.Component {
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: i18next.t("user:Country/Region"),
|
title: i18next.t("user:Country/Region"),
|
||||||
dataIndex: "countryCode",
|
dataIndex: "countryCodes",
|
||||||
key: "countryCode",
|
key: "countryCodes",
|
||||||
width: "140px",
|
width: "140px",
|
||||||
render: (text, record, index) => {
|
render: (text, record, index) => {
|
||||||
if (record.provider?.category !== "SMS") {
|
if (record.provider?.category !== "SMS") {
|
||||||
@ -131,7 +131,7 @@ class ProviderTable extends React.Component {
|
|||||||
mode={"multiple"}
|
mode={"multiple"}
|
||||||
initValue={text ? text : ["All"]}
|
initValue={text ? text : ["All"]}
|
||||||
onChange={(value) => {
|
onChange={(value) => {
|
||||||
this.updateField(table, index, "countryCode", value);
|
this.updateField(table, index, "countryCodes", value);
|
||||||
}}
|
}}
|
||||||
countryCodes={this.getUserOrganization()?.countryCodes}
|
countryCodes={this.getUserOrganization()?.countryCodes}
|
||||||
/>
|
/>
|
||||||
@ -259,12 +259,12 @@ class ProviderTable extends React.Component {
|
|||||||
);
|
);
|
||||||
} else if (record.provider?.category === "SMS" || record.provider?.category === "Email") {
|
} else if (record.provider?.category === "SMS" || record.provider?.category === "Email") {
|
||||||
if (text === "None") {
|
if (text === "None") {
|
||||||
text = "all";
|
text = "All";
|
||||||
}
|
}
|
||||||
return (
|
return (
|
||||||
<Select virtual={false} style={{width: "100%"}}
|
<Select virtual={false} style={{width: "100%"}}
|
||||||
value={text}
|
value={text}
|
||||||
defaultValue="all"
|
defaultValue="All"
|
||||||
onChange={value => {
|
onChange={value => {
|
||||||
this.updateField(table, index, "rule", value);
|
this.updateField(table, index, "rule", value);
|
||||||
}}>
|
}}>
|
||||||
|
Reference in New Issue
Block a user