Skip to content

Commit

Permalink
Applied changed suggested by Ishan.
Browse files Browse the repository at this point in the history
This conserns some boolean logic, wording, and
YAML config.

Co-authored-by: Ishan Goel <[email protected]>
  • Loading branch information
Arkaeriit and quackduck committed Jul 20, 2022
1 parent 86ffba2 commit 911650c
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions Admin's Manual.md
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,6 @@ whitelist:

The `whitelist` entry is a map similar to the `admins` map. The keys are the ID of the allowed user and the value are a string whose content is not used.

If someone is in the `admins` list, it is assumed that they are allowed. They, they would not be rejected from a private server even if their ID is not in the `whitelist` list.
If everyone on the private server is an admin, you don't need to have a `whitelist` list as all the ID are already in the `admin` list.
All admins are allowed even if their ID is not in the whitelist.
Therefore, if everyone on the private server is an admin, a whitelist isn't necessary.

2 changes: 1 addition & 1 deletion config.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ type ConfigType struct {
Admins map[string]string `yaml:"admins"`
Censor bool `yaml:"censor,omitempty"`
Private bool `yaml:"private,omitempty"`
WhiteList map[string]string `yaml:"whitelist"`
WhiteList map[string]string `yaml:"whitelist,omitempty"`

IntegrationConfig string `yaml:"integration_config"`
}
Expand Down
2 changes: 1 addition & 1 deletion main.go
Original file line number Diff line number Diff line change
Expand Up @@ -327,7 +327,7 @@ func newUser(s ssh.Session) *User {
if Config.Private {
_, okWhitelist := Config.WhiteList[u.id]
_, okAdmin := Config.Admins[u.id]
if !okAdmin && !okWhitelist {
if !(okAdmin || okWhitelist) {
fmt.Println("Refusing user with ID ", u.id)
u.writeln(Devbot, "You are not allowed to log into this private server. If this is a mistake, send your id ("+u.id+") to the admin so that they can whitelist you.")
u.closeQuietly()
Expand Down

0 comments on commit 911650c

Please sign in to comment.