验证只读用户权限

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 super_admin = Super administrator
admin = Administrator admin = Administrator
user = User user = User
read_usr = Read-Only User
normal = Normal normal = Normal
disable = Disable disable = Disable
enable = Enable enable = Enable

View File

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

View File

@ -475,7 +475,7 @@ func (m *Member) Valid(is_hash_password bool) error {
if strings.Count(m.Description, "") > 500 { if strings.Count(m.Description, "") > 500 {
return ErrMemberDescriptionTooLong 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 return ErrMemberRoleError
} }
if m.Status != 0 && m.Status != 1 { if m.Status != 0 && m.Status != 1 {