mirror of
https://github.com/spl0k/supysonic.git
synced 2024-12-22 17:06:17 +00:00
Fixed potential issue when trying to delete a user
This commit is contained in:
parent
7f736c240b
commit
10ca91bd6f
@ -192,7 +192,7 @@ def add_user():
|
|||||||
|
|
||||||
@app.route('/user/del/<uid>')
|
@app.route('/user/del/<uid>')
|
||||||
def del_user(uid):
|
def del_user(uid):
|
||||||
status = UserManager.delete(store, uuid.UUID(uid))
|
status = UserManager.delete(store, uid)
|
||||||
if status == UserManager.SUCCESS:
|
if status == UserManager.SUCCESS:
|
||||||
flash('Deleted user')
|
flash('Deleted user')
|
||||||
else:
|
else:
|
||||||
|
@ -70,14 +70,14 @@ class UserManager:
|
|||||||
if status != UserManager.SUCCESS:
|
if status != UserManager.SUCCESS:
|
||||||
return status
|
return status
|
||||||
|
|
||||||
store.find(StarredFolder, StarredFolder.user_id == uid).remove()
|
store.find(StarredFolder, StarredFolder.user_id == user.id).remove()
|
||||||
store.find(StarredArtist, StarredArtist.user_id == uid).remove()
|
store.find(StarredArtist, StarredArtist.user_id == user.id).remove()
|
||||||
store.find(StarredAlbum, StarredAlbum.user_id == uid).remove()
|
store.find(StarredAlbum, StarredAlbum.user_id == user.id).remove()
|
||||||
store.find(StarredTrack, StarredTrack.user_id == uid).remove()
|
store.find(StarredTrack, StarredTrack.user_id == user.id).remove()
|
||||||
store.find(RatingFolder, RatingFolder.user_id == uid).remove()
|
store.find(RatingFolder, RatingFolder.user_id == user.id).remove()
|
||||||
store.find(RatingTrack, RatingTrack.user_id == uid).remove()
|
store.find(RatingTrack, RatingTrack.user_id == user.id).remove()
|
||||||
store.find(ChatMessage, ChatMessage.user_id == uid).remove()
|
store.find(ChatMessage, ChatMessage.user_id == user.id).remove()
|
||||||
for playlist in store.find(Playlist, Playlist.user_id == uid):
|
for playlist in store.find(Playlist, Playlist.user_id == user.id):
|
||||||
playlist.tracks.clear()
|
playlist.tracks.clear()
|
||||||
store.remove(playlist)
|
store.remove(playlist)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user