mirror of
https://github.com/casdoor/casdoor.git
synced 2025-05-23 02:35:49 +08:00
feat: better handling of organization.AccountItems on init_data import (#3263)
* Better handling of accountitems on init_data import. * Removed commented code. * Update init_data.go * Update init_data.go --------- Co-authored-by: Yang Luo <hsluoyz@qq.com>
This commit is contained in:
parent
c9635d9e2b
commit
c0f22bae43
@ -182,6 +182,9 @@ func readInitDataFromFile(filePath string) (*InitData, error) {
|
||||
if organization.Tags == nil {
|
||||
organization.Tags = []string{}
|
||||
}
|
||||
if organization.AccountItems == nil {
|
||||
organization.AccountItems = []*AccountItem{}
|
||||
}
|
||||
}
|
||||
for _, application := range data.Applications {
|
||||
if application.Providers == nil {
|
||||
@ -275,7 +278,9 @@ func initDefinedOrganization(organization *Organization) {
|
||||
}
|
||||
}
|
||||
organization.CreatedTime = util.GetCurrentTime()
|
||||
organization.AccountItems = getBuiltInAccountItems()
|
||||
if len(organization.AccountItems) == 0 {
|
||||
organization.AccountItems = getBuiltInAccountItems()
|
||||
}
|
||||
|
||||
_, err = AddOrganization(organization)
|
||||
if err != nil {
|
||||
|
Loading…
x
Reference in New Issue
Block a user