feat!: fine-grained permissions

This commit is contained in:
Henrique Dias
2024-07-31 11:06:34 +02:00
parent f4de82cfd1
commit b5a3d07f5c
7 changed files with 176 additions and 87 deletions
+4 -4
View File
@@ -10,9 +10,9 @@ import (
)
type User struct {
Permissions `mapstructure:",squash"`
Username string
Password string
UserPermissions `mapstructure:",squash"`
Username string
Password string
}
func (u User) checkPassword(input string) bool {
@@ -44,7 +44,7 @@ func (u *User) Validate() error {
}
}
if err := u.Permissions.Validate(); err != nil {
if err := u.UserPermissions.Validate(); err != nil {
return fmt.Errorf("invalid user %q: %w", u.Username, err)
}