patch to delete userrole, event role

This commit is contained in:
Rohit Waghchaure 2017-02-22 17:22:07 +05:30
parent 8d90eff95d
commit f1c4e5a8d1
8 changed files with 14 additions and 113 deletions

View file

@ -9,5 +9,5 @@ from frappe.model.document import Document
class HasRole(Document):
def validate(self):
if cint(self.get("__islocal")) and frappe.db.exists("Has Role", {
"parent": self.parent, "role": self.role, "parenttype": "User"}):
"parent": self.parent, "role": self.role}):
frappe.throw(frappe._("User '{0}' already has the role '{1}'").format(self.parent, self.role))

View file

@ -1,4 +1,5 @@
{
"_liked_by": "[]",
"allow_copy": 0,
"allow_import": 1,
"allow_rename": 1,
@ -1126,35 +1127,6 @@
"set_only_once": 0,
"unique": 0
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"columns": 0,
"fieldname": "user_roles",
"fieldtype": "Table",
"hidden": 1,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_global_search": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Roles Assigned",
"length": 0,
"no_copy": 0,
"options": "UserRole",
"permlevel": 1,
"print_hide": 1,
"print_hide_if_no_value": 0,
"read_only": 1,
"remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"unique": 0
},
{
"allow_on_submit": 0,
"bold": 0,
@ -1906,7 +1878,7 @@
"istable": 0,
"max_attachments": 5,
"menu_index": 0,
"modified": "2017-02-20 14:00:13.687719",
"modified": "2017-02-22 16:47:32.546965",
"modified_by": "Administrator",
"module": "Core",
"name": "User",

View file

@ -1 +0,0 @@
Role belonging to parent User

View file

@ -1,4 +0,0 @@
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# MIT License. See license.txt
from __future__ import unicode_literals

View file

@ -1,63 +0,0 @@
{
"allow_copy": 0,
"allow_import": 0,
"allow_rename": 0,
"autoname": "hash",
"beta": 0,
"creation": "2013-02-06 11:30:13",
"custom": 0,
"docstatus": 0,
"doctype": "DocType",
"editable_grid": 1,
"fields": [
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "role",
"fieldtype": "Link",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 1,
"label": "Role",
"length": 0,
"no_copy": 0,
"oldfieldname": "role",
"oldfieldtype": "Link",
"options": "Role",
"permlevel": 0,
"print_hide": 0,
"print_hide_if_no_value": 0,
"print_width": "200px",
"read_only": 0,
"report_hide": 0,
"reqd": 1,
"search_index": 0,
"set_only_once": 0,
"unique": 0,
"width": "200px"
}
],
"hide_heading": 0,
"hide_toolbar": 0,
"idx": 1,
"image_view": 0,
"in_create": 0,
"in_dialog": 0,
"is_submittable": 0,
"issingle": 0,
"istable": 1,
"max_attachments": 0,
"modified": "2016-07-11 03:28:09.690931",
"modified_by": "Administrator",
"module": "Core",
"name": "UserRole",
"owner": "Administrator",
"permissions": [],
"quick_entry": 0,
"read_only": 0,
"read_only_onload": 0,
"track_seen": 0
}

View file

@ -1,14 +0,0 @@
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# MIT License. See license.txt
from __future__ import unicode_literals
import frappe
from frappe.utils import cint
from frappe.model.document import Document
class UserRole(Document):
def validate(self):
if cint(self.get("__islocal")) and frappe.db.exists("UserRole", {
"parent": self.parent, "role": self.role}):
frappe.throw(frappe._("User '{0}' already has the role '{1}'").format(self.parent, self.role))

View file

@ -7,6 +7,7 @@ frappe.patches.v7_3.rename_page_role_to_has_role
frappe.patches.v7_3.set_ref_doctype_roles_to_report
frappe.patches.v7_3.copy_user_roles_to_has_roles
frappe.patches.v7_3.set_user_permission_for_page_and_report
frappe.patches.v7_3.remove_doctypes
frappe.patches.v6_1.rename_file_data
frappe.patches.v7_0.re_route #2016-06-27
frappe.patches.v7_2.remove_in_filter

View file

@ -0,0 +1,10 @@
# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
import frappe
def execute():
for doctype in ['UserRole', 'Event Role']:
if frappe.db.exists('DocType', doctype):
frappe.delete_doc('DocType', doctype)