@@ -12,6 +12,7 @@ type passwordAuthenticator struct {
12
12
13
13
type passwordSettings struct {
14
14
Passwords map [string ][]string `yaml:"passwords"`
15
+ AllowReadByDefault bool `yaml:"allow_read_by_default"`
15
16
}
16
17
17
18
var settings * passwordSettings
@@ -20,7 +21,10 @@ var DEBUG = false
20
21
func getSettings () * passwordSettings {
21
22
if settings == nil {
22
23
data := core .GetSettingsContents ()
24
+
23
25
s := passwordSettings {}
26
+ s .AllowReadByDefault = false
27
+
24
28
yaml .Unmarshal (* data , & s )
25
29
settings = & s
26
30
}
@@ -31,13 +35,13 @@ func getSettings() *passwordSettings {
31
35
func (ma passwordAuthenticator ) GetPermissions (authorization string ) auth.Permissions {
32
36
d := auth.Permissions {}
33
37
38
+ s := getSettings ()
34
39
if authorization == "" {
35
40
if DEBUG {
36
41
log .Printf ("No password provided" )
37
42
}
38
43
} else {
39
44
match := false
40
- s := getSettings ()
41
45
// map is password -> list of channels
42
46
for k , v := range s .Passwords {
43
47
if k == authorization {
@@ -58,12 +62,13 @@ func (ma passwordAuthenticator) GetPermissions(authorization string) auth.Permis
58
62
}
59
63
}
60
64
61
- // Everyone has READ to all for now
62
- if _ , ok := d ["*" ]; ! ok {
63
- d ["*" ] = & auth.Permission {true , false }
65
+ // The default permissions from config
66
+ if s .AllowReadByDefault {
67
+ if _ , ok := d ["*" ]; ! ok {
68
+ d ["*" ] = & auth.Permission {true , false }
69
+ }
64
70
}
65
71
66
-
67
72
return d
68
73
}
69
74
0 commit comments