mirror of
https://github.com/Steffo99/greed.git
synced 2024-11-23 22:34:20 +00:00
Prevent bypassing the requirement for certain privileges
This commit is contained in:
parent
bb99472c84
commit
fe751cb56d
1 changed files with 15 additions and 15 deletions
30
worker.py
30
worker.py
|
@ -764,12 +764,12 @@ class Worker(threading.Thread):
|
||||||
[self.loc.get("menu_cash"), self.loc.get("menu_credit_card"), self.loc.get("menu_cancel")],
|
[self.loc.get("menu_cash"), self.loc.get("menu_credit_card"), self.loc.get("menu_cancel")],
|
||||||
cancellable=True)
|
cancellable=True)
|
||||||
# If the user has selected the Cash option...
|
# If the user has selected the Cash option...
|
||||||
if selection == self.loc.get("menu_cash"):
|
if selection == self.loc.get("menu_cash") and self.cfg["Payments"]["Cash"]["enable_pay_with_cash"]:
|
||||||
# Go to the pay with cash function
|
# Go to the pay with cash function
|
||||||
self.bot.send_message(self.chat.id,
|
self.bot.send_message(self.chat.id,
|
||||||
self.loc.get("payment_cash", user_cash_id=self.user.identifiable_str()))
|
self.loc.get("payment_cash", user_cash_id=self.user.identifiable_str()))
|
||||||
# If the user has selected the Credit Card option...
|
# If the user has selected the Credit Card option...
|
||||||
elif selection == self.loc.get("menu_credit_card"):
|
elif selection == self.loc.get("menu_credit_card") and self.cfg["Payments"]["CreditCard"]["credit_card_token"]:
|
||||||
# Go to the pay with credit card function
|
# Go to the pay with credit card function
|
||||||
self.__add_credit_cc()
|
self.__add_credit_cc()
|
||||||
# If the user has selected the Cancel option...
|
# If the user has selected the Cancel option...
|
||||||
|
@ -922,34 +922,34 @@ class Worker(threading.Thread):
|
||||||
self.loc.get("menu_transactions"),
|
self.loc.get("menu_transactions"),
|
||||||
self.loc.get("menu_csv"),
|
self.loc.get("menu_csv"),
|
||||||
self.loc.get("menu_edit_admins")])
|
self.loc.get("menu_edit_admins")])
|
||||||
# If the user has selected the Products option...
|
# If the user has selected the Products option and has the privileges to perform the action...
|
||||||
if selection == self.loc.get("menu_products"):
|
if selection == self.loc.get("menu_products") and self.admin.edit_products:
|
||||||
# Open the products menu
|
# Open the products menu
|
||||||
self.__products_menu()
|
self.__products_menu()
|
||||||
# If the user has selected the Orders option...
|
# If the user has selected the Orders option and has the privileges to perform the action...
|
||||||
elif selection == self.loc.get("menu_orders"):
|
elif selection == self.loc.get("menu_orders") and self.admin.receive_orders:
|
||||||
# Open the orders menu
|
# Open the orders menu
|
||||||
self.__orders_menu()
|
self.__orders_menu()
|
||||||
# If the user has selected the Transactions option...
|
# If the user has selected the Transactions option and has the privileges to perform the action...
|
||||||
elif selection == self.loc.get("menu_edit_credit"):
|
elif selection == self.loc.get("menu_edit_credit") and self.admin.create_transactions:
|
||||||
# Open the edit credit menu
|
# Open the edit credit menu
|
||||||
self.__create_transaction()
|
self.__create_transaction()
|
||||||
# If the user has selected the User mode option...
|
# If the user has selected the User mode option and has the privileges to perform the action...
|
||||||
elif selection == self.loc.get("menu_user_mode"):
|
elif selection == self.loc.get("menu_user_mode"):
|
||||||
# Tell the user how to go back to admin menu
|
# Tell the user how to go back to admin menu
|
||||||
self.bot.send_message(self.chat.id, self.loc.get("conversation_switch_to_user_mode"))
|
self.bot.send_message(self.chat.id, self.loc.get("conversation_switch_to_user_mode"))
|
||||||
# Start the bot in user mode
|
# Start the bot in user mode
|
||||||
self.__user_menu()
|
self.__user_menu()
|
||||||
# If the user has selected the Add Admin option...
|
# If the user has selected the Add Admin option and has the privileges to perform the action...
|
||||||
elif selection == self.loc.get("menu_edit_admins"):
|
elif selection == self.loc.get("menu_edit_admins") and self.admin.is_owner:
|
||||||
# Open the edit admin menu
|
# Open the edit admin menu
|
||||||
self.__add_admin()
|
self.__add_admin()
|
||||||
# If the user has selected the Transactions option...
|
# If the user has selected the Transactions option and has the privileges to perform the action...
|
||||||
elif selection == self.loc.get("menu_transactions"):
|
elif selection == self.loc.get("menu_transactions") and self.admin.create_transactions:
|
||||||
# Open the transaction pages
|
# Open the transaction pages
|
||||||
self.__transaction_pages()
|
self.__transaction_pages()
|
||||||
# If the user has selected the .csv option...
|
# If the user has selected the .csv option and has the privileges to perform the action...
|
||||||
elif selection == self.loc.get("menu_csv"):
|
elif selection == self.loc.get("menu_csv") and self.admin.create_transactions:
|
||||||
# Generate the .csv file
|
# Generate the .csv file
|
||||||
self.__transactions_file()
|
self.__transactions_file()
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue