1
0
mirror of https://github.com/osmarks/mycorrhiza.git synced 2025-12-09 01:48:08 +00:00

Drop fixed authorization

Important changes:
- UseFixedAuth is now UseAuth and toggles all kinds of authorization and
  registration
- UseRegistration is now AllowRegistration to better reflect the meaning
- LimitRegistration is now RegistrationLimit because it's not a boolean,
  it's a value (not "limit registration?", but "registration limit is
  ...")
- registered-users.json is now users.json, because all users are stored
  there
- user.AuthUsed is dropped in favor of new cfg.UseAuth which has the
  same meaning

I hope I have not forgotten anything.
This commit is contained in:
handlerug
2021-07-02 15:20:03 +07:00
parent e6265c9ad9
commit b87583ef28
19 changed files with 211 additions and 335 deletions

View File

@@ -9,13 +9,12 @@ import (
)
var paths struct {
gitRepo string
cacheDir string
staticFiles string
configPath string
tokensJSON string
registrationCredentialsJSON string
fixedCredentialsJSON string
gitRepo string
cacheDir string
staticFiles string
configPath string
tokensJSON string
userCredentialsJSON string
}
// HyphaeDir returns the path to hyphae storage.
@@ -36,12 +35,8 @@ func ConfigPath() string { return paths.configPath }
// TokensJSON returns the path to the JSON user tokens storage.
func TokensJSON() string { return paths.tokensJSON }
// RegistrationCredentialsJSON returns the path to the JSON registration
// credentials storage.
func RegistrationCredentialsJSON() string { return paths.registrationCredentialsJSON }
// FixedCredentialsJSON returns the path to the JSON fixed credentials storage.
func FixedCredentialsJSON() string { return paths.fixedCredentialsJSON }
// UserCredentialsJSON returns the path to the JSON user credentials storage.
func UserCredentialsJSON() string { return paths.userCredentialsJSON }
// PrepareWikiRoot ensures all needed directories and files exist and have
// correct permissions.
@@ -66,10 +61,9 @@ func PrepareWikiRoot() error {
}
paths.configPath = filepath.Join(cfg.WikiDir, "config.ini")
paths.userCredentialsJSON = filepath.Join(cfg.WikiDir, "users.json")
paths.tokensJSON = filepath.Join(paths.cacheDir, "tokens.json")
paths.fixedCredentialsJSON = filepath.Join(cfg.WikiDir, "fixed-users.json")
paths.registrationCredentialsJSON = filepath.Join(cfg.WikiDir, "registered-users.json")
return nil
}