验证只读用户权限

This commit is contained in:
FunCoder 2024-12-20 08:49:46 +08:00
parent 81a3a5b32d
commit 57cd73b5a2
3 changed files with 3 additions and 1 deletions

View File

@ -497,6 +497,7 @@ status = Status
super_admin = Super administrator
admin = Administrator
user = User
read_usr = Read-Only User
normal = Normal
disable = Disable
enable = Enable

View File

@ -497,6 +497,7 @@ status = Статус
super_admin = Супер администратор
admin = Администратор
user = Пользователь
read_usr = Пользователи только для чтения
normal = Нормальный
disable = Отключено
enable = Включено

View File

@ -475,7 +475,7 @@ func (m *Member) Valid(is_hash_password bool) error {
if strings.Count(m.Description, "") > 500 {
return ErrMemberDescriptionTooLong
}
if m.Role != conf.MemberGeneralRole && m.Role != conf.MemberSuperRole && m.Role != conf.MemberAdminRole {
if m.Role != conf.MemberGeneralRole && m.Role != conf.MemberSuperRole && m.Role != conf.MemberAdminRole && m.Role != conf.MemberReaderRole {
return ErrMemberRoleError
}
if m.Status != 0 && m.Status != 1 {