def save_column_order(key, value, override=False): from frappe.defaults import clear_default, set_default if override: clear_default(key=key) set_default(key, value, "__default" if override else frappe.session.user) return True
def import_user_permissions(): frappe.only_for("System Manager") rows = read_csv_content_from_uploaded_file(ignore_encoding=True) clear_default(parenttype="User Permission") if rows[0][0]!="User Permissions" and rows[1][0] != "User": frappe.throw(frappe._("Please upload using the same template as download.")) for row in rows[2:]: frappe.permissions.add_user_permission(row[1], row[2], row[0])