mirror of
https://github.com/hrfee/jfa-go.git
synced 2024-12-22 17:10:10 +00:00
db: mark profile store as deprecated
This commit is contained in:
parent
a735e4ff29
commit
3bb9272f06
@ -238,7 +238,7 @@ func migrateToBadger(app *appContext) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
app.storage.loadProfiles()
|
app.storage.loadProfiles()
|
||||||
for k, v := range app.storage.profiles {
|
for k, v := range app.storage.deprecatedProfiles {
|
||||||
app.storage.SetProfileKey(k, v)
|
app.storage.SetProfileKey(k, v)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
29
storage.go
29
storage.go
@ -34,8 +34,7 @@ type Storage struct {
|
|||||||
invite_path, emails_path, policy_path, configuration_path, displayprefs_path, ombi_path, profiles_path, customEmails_path, users_path, telegram_path, discord_path, matrix_path, announcements_path, matrix_sql_path, userPage_path string
|
invite_path, emails_path, policy_path, configuration_path, displayprefs_path, ombi_path, profiles_path, customEmails_path, users_path, telegram_path, discord_path, matrix_path, announcements_path, matrix_sql_path, userPage_path string
|
||||||
deprecatedUserExpiries map[string]time.Time // Map of Jellyfin User IDs to their expiry times.
|
deprecatedUserExpiries map[string]time.Time // Map of Jellyfin User IDs to their expiry times.
|
||||||
deprecatedInvites Invites
|
deprecatedInvites Invites
|
||||||
profiles map[string]Profile
|
deprecatedProfiles map[string]Profile
|
||||||
defaultProfile string
|
|
||||||
displayprefs, ombi_template map[string]interface{}
|
displayprefs, ombi_template map[string]interface{}
|
||||||
deprecatedEmails emailStore // Map of Jellyfin User IDs to Email addresses.
|
deprecatedEmails emailStore // Map of Jellyfin User IDs to Email addresses.
|
||||||
deprecatedTelegram telegramStore // Map of Jellyfin User IDs to telegram users.
|
deprecatedTelegram telegramStore // Map of Jellyfin User IDs to telegram users.
|
||||||
@ -1254,11 +1253,11 @@ func (st *Storage) storeAnnouncements() error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (st *Storage) loadProfiles() error {
|
func (st *Storage) loadProfiles() error {
|
||||||
err := loadJSON(st.profiles_path, &st.profiles)
|
err := loadJSON(st.profiles_path, &st.deprecatedProfiles)
|
||||||
for name, profile := range st.profiles {
|
for name, profile := range st.deprecatedProfiles {
|
||||||
if profile.Default {
|
// if profile.Default {
|
||||||
st.defaultProfile = name
|
// st.defaultProfile = name
|
||||||
}
|
// }
|
||||||
change := false
|
change := false
|
||||||
if profile.Policy.IsAdministrator != profile.Admin {
|
if profile.Policy.IsAdministrator != profile.Admin {
|
||||||
change = true
|
change = true
|
||||||
@ -1278,19 +1277,19 @@ func (st *Storage) loadProfiles() error {
|
|||||||
change = true
|
change = true
|
||||||
}
|
}
|
||||||
if change {
|
if change {
|
||||||
st.profiles[name] = profile
|
st.deprecatedProfiles[name] = profile
|
||||||
}
|
|
||||||
}
|
|
||||||
if st.defaultProfile == "" {
|
|
||||||
for n := range st.profiles {
|
|
||||||
st.defaultProfile = n
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// if st.defaultProfile == "" {
|
||||||
|
// for n := range st.deprecatedProfiles {
|
||||||
|
// st.defaultProfile = n
|
||||||
|
// }
|
||||||
|
// }
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
func (st *Storage) storeProfiles() error {
|
func (st *Storage) storeProfiles() error {
|
||||||
return storeJSON(st.profiles_path, st.profiles)
|
return storeJSON(st.profiles_path, st.deprecatedProfiles)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (st *Storage) migrateToProfile() error {
|
func (st *Storage) migrateToProfile() error {
|
||||||
@ -1298,7 +1297,7 @@ func (st *Storage) migrateToProfile() error {
|
|||||||
st.loadConfiguration()
|
st.loadConfiguration()
|
||||||
st.loadDisplayprefs()
|
st.loadDisplayprefs()
|
||||||
st.loadProfiles()
|
st.loadProfiles()
|
||||||
st.profiles["Default"] = Profile{
|
st.deprecatedProfiles["Default"] = Profile{
|
||||||
Policy: st.policy,
|
Policy: st.policy,
|
||||||
Configuration: st.configuration,
|
Configuration: st.configuration,
|
||||||
Displayprefs: st.displayprefs,
|
Displayprefs: st.displayprefs,
|
||||||
|
Loading…
Reference in New Issue
Block a user