ParseAuthLevel parses authentication level from a string.
(name string)
| 36 | |
| 37 | // ParseAuthLevel parses authentication level from a string. |
| 38 | func ParseAuthLevel(name string) Level { |
| 39 | switch name { |
| 40 | case "anon", "ANON": |
| 41 | return LevelAnon |
| 42 | case "auth", "AUTH": |
| 43 | return LevelAuth |
| 44 | case "root", "ROOT": |
| 45 | return LevelRoot |
| 46 | default: |
| 47 | return LevelNone |
| 48 | } |
| 49 | } |
| 50 | |
| 51 | // MarshalText converts Level to a slice of bytes with the name of the level. |
| 52 | func (a Level) MarshalText() ([]byte, error) { |
no outgoing calls
no test coverage detected
searching dependent graphs…