mirror of
https://github.com/vale981/dirkules
synced 2025-03-05 09:21:38 -05:00
created function for removing shares
This commit is contained in:
parent
a0351df24c
commit
9c6c72ab21
2 changed files with 18 additions and 1 deletions
|
@ -163,3 +163,12 @@ def enable_share(share):
|
||||||
db.session.commit()
|
db.session.commit()
|
||||||
except:
|
except:
|
||||||
db.session.rollback()
|
db.session.rollback()
|
||||||
|
|
||||||
|
|
||||||
|
def remove_share(share, remove_data=False):
|
||||||
|
# TODO: Handling of remove_data. Not implemented because removing of share folder is a future thing.
|
||||||
|
try:
|
||||||
|
db.session.delete(share)
|
||||||
|
db.session.commit()
|
||||||
|
except:
|
||||||
|
db.session.rollback()
|
||||||
|
|
|
@ -80,4 +80,12 @@ def remove():
|
||||||
flash("Can't remove drive without id.")
|
flash("Can't remove drive without id.")
|
||||||
return redirect(url_for('.index'))
|
return redirect(url_for('.index'))
|
||||||
else:
|
else:
|
||||||
return render_template('samba/remove.html')
|
try:
|
||||||
|
share_id = int(share_id)
|
||||||
|
share = smb_man.get_share_by_id(share_id)
|
||||||
|
return render_template('samba/remove.html')
|
||||||
|
except ValueError:
|
||||||
|
flash("ValueError: id is not an int")
|
||||||
|
except LookupError:
|
||||||
|
flash("LookupError: id not valid")
|
||||||
|
return redirect(url_for('.index'))
|
||||||
|
|
Loading…
Add table
Reference in a new issue