Skip to content

Commit

Permalink
feat: grant table permission patch
Browse files Browse the repository at this point in the history
  • Loading branch information
rahulgupta8848 committed Jan 15, 2025
1 parent 328b2df commit e502e7a
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
1 change: 1 addition & 0 deletions frappe/patches.txt
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,7 @@ frappe.patches.v15_0.copy_disable_prepared_report_to_prepared_report
execute:frappe.reload_doc("desk", "doctype", "Form Tour")
execute:frappe.delete_doc('Page', 'recorder', ignore_missing=True, force=True)
frappe.patches.v14_0.modify_value_column_size_for_singles
frappe.patches.v15_0.grant_table_permission

[post_model_sync]
execute:frappe.get_doc('Role', 'Guest').save() # remove desk access
Expand Down
15 changes: 15 additions & 0 deletions frappe/patches/v15_0/grant_table_permission.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import frappe


def execute():
db_name = frappe.conf.db_name

sql_commands = [
f"GRANT ALL PRIVILEGES ON ALL TABLES IN SCHEMA public TO {db_name};",
f"ALTER DEFAULT PRIVILEGES IN SCHEMA public GRANT ALL PRIVILEGES ON TABLES TO {db_name};"
]

for sql_cmd in sql_commands:
frappe.db.sql(sql_cmd)
frappe.db.commit()
print("Database permissions updated successfully")

0 comments on commit e502e7a

Please sign in to comment.