chore: change permission check
This commit is contained in:
@ -21,6 +21,7 @@ type User struct {
|
||||
Role int `json:"role"` // user's role
|
||||
IgnoreHide bool `json:"can_hide"` // can see hide files
|
||||
IgnorePassword bool `json:"ignore_password"` // can access without password
|
||||
Aira2 bool `json:"aira_2"` // can add aria2 tasks
|
||||
}
|
||||
|
||||
func (u User) IsGuest() bool {
|
||||
@ -40,3 +41,7 @@ func (u User) ValidatePassword(password string) error {
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (u User) CanWrite() bool {
|
||||
return u.IsAdmin() || !u.ReadOnly
|
||||
}
|
||||
|
Reference in New Issue
Block a user