<commit_before># Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# MIT License. See license.txt

from __future__ import unicode_literals
import frappe
import frappe.defaults
from frappe.modules.import_file import get_file_path, read_doc_from_file
from frappe.translate import send_translations
from frappe.desk.notifications import delete_notification_count_for
from frappe.permissions import reset_perms, get_linked_doctypes, get_all_perms, setup_custom_perms
from frappe import _

@frappe.whitelist()
def get_roles_and_doctypes():
	frappe.only_for("System Manager")
	send_translations(frappe.get_lang_dict("doctype", "DocPerm"))
	return {
		"doctypes": [d[0] for d in frappe.db.sql("""select name from `tabDocType` dt where
			istable=0 and
			name not in ('DocType') and
			exists(select * from `tabDocPerm` dp,`tabRole` role where dp.role = role.name and dp.parent=dt.name and not role.disabled)""")],
		"roles": [d[0] for d in frappe.db.sql("""select name from tabRole where
			name != 'Administrator' and disabled=0""")]
	}

@frappe.whitelist()
def get_permissions(doctype=None, role=None):
	frappe.only_for("System Manager")
	if role:
		out = get_all_perms(role)<commit_msg>[minor] allow all tables for Permission Manager<commit_after># Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# MIT License. See license.txt

from __future__ import unicode_literals
import frappe
import frappe.defaults
from frappe.modules.import_file import get_file_path, read_doc_from_file
from frappe.translate import send_translations
from frappe.desk.notifications import delete_notification_count_for
from frappe.permissions import reset_perms, get_linked_doctypes, get_all_perms, setup_custom_perms
from frappe import _

@frappe.whitelist()
def get_roles_and_doctypes():
	frappe.only_for("System Manager")
	send_translations(frappe.get_lang_dict("doctype", "DocPerm"))
	return {
		"doctypes": [d[0] for d in frappe.db.sql("""select name from `tabDocType` dt where
			istable=0 and name not in ('DocType')""")],
		"roles": [d[0] for d in frappe.db.sql("""select name from tabRole where
			name != 'Administrator' and disabled=0""")]
	}

@frappe.whitelist()
def get_permissions(doctype=None, role=None):
	frappe.only_for("System Manager")
	if role:
		out = get_all_perms(role)
{'fraction_non_alphanumeric': 0.10560625814863103, 'fraction_numerical': 0.006953498478922208, 'mean_word_length': 6.3312101910828025, 'pattern_counts': {'":': 4, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4150726', 'n_tokens_mistral': 817, 'n_tokens_neox': 810, 'n_words': 207}