feat: change email, export my data, delete account (with data anonymization)
This commit is contained in:
1 parent
bb191c389a
commit
10a66cd979
123 files changed
+10789
-76
No files matched your search
@@ -0,0 +1,42 @@
|
||||
package user
|
||||
|
||||
import "errors"
|
||||
|
||||
const DeletedUserName = "Deleted user"
|
||||
|
||||
const (
|
||||
LastRoleOwner = "Owner"
|
||||
LastRoleAdmin = "Admin"
|
||||
)
|
||||
|
||||
var ErrLastOwner = errors.New("last owner")
|
||||
var ErrLastAdmin = errors.New("last administrator")
|
||||
var ErrAccountNotDeletable = errors.New("account not deletable")
|
||||
|
||||
type LastAdminError struct {
|
||||
Role string
|
||||
}
|
||||
|
||||
func (e LastAdminError) Error() string {
|
||||
if e.Role == LastRoleOwner {
|
||||
return ErrLastOwner.Error()
|
||||
}
|
||||
return ErrLastAdmin.Error()
|
||||
}
|
||||
|
||||
func (e LastAdminError) Is(target error) bool {
|
||||
if target == ErrLastAdmin {
|
||||
return true
|
||||
}
|
||||
return target == ErrLastOwner && e.Role == LastRoleOwner
|
||||
}
|
||||
|
||||
type Erasure struct {
|
||||
UserID uint32
|
||||
GuardRoleIDs []uint32
|
||||
AvatarImageID *uint32
|
||||
}
|
||||
|
||||
type Eraser interface {
|
||||
Erase(erasure Erasure) error
|
||||
}
|
||||
Reference in new issue
Block a user