mirror of
https://github.com/casdoor/casdoor.git
synced 2025-05-23 10:45:47 +08:00
feat: make Organization.EnableSoftDeletion and User.IsDeleted work (#3205)
* feat: make Organization.EnableSoftDeletion and User.IsDeleted work * fix: add handling of the situation where organization is nil
This commit is contained in:
parent
e2ce9ad625
commit
0b17cb9746
@ -950,7 +950,17 @@ func DeleteUser(user *User) (bool, error) {
|
|||||||
return false, err
|
return false, err
|
||||||
}
|
}
|
||||||
|
|
||||||
return deleteUser(user)
|
organization, err := GetOrganizationByUser(user)
|
||||||
|
if err != nil {
|
||||||
|
return false, err
|
||||||
|
}
|
||||||
|
if organization != nil && organization.EnableSoftDeletion {
|
||||||
|
user.IsDeleted = true
|
||||||
|
user.DeletedTime = util.GetCurrentTime()
|
||||||
|
return UpdateUser(user.GetId(), user, []string{"is_deleted", "deleted_time"}, false)
|
||||||
|
} else {
|
||||||
|
return deleteUser(user)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func GetUserInfo(user *User, scope string, aud string, host string) (*Userinfo, error) {
|
func GetUserInfo(user *User, scope string, aud string, host string) (*Userinfo, error) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user