Restricted button in version 12

Hi all,

Login as User vice shown Restricted button, please tell me anyone “Restricted” button functionality.

Maybe include a screenshot, to best set the context you refer to here?


From a quick look at the code: that Restricted button apparently relates to the restrict_to_domain field and the Domainification feature introduced in v8 or so that sets ‘active domain’ control to a specified module, doctype, user role and perhaps field level?

Here’s a test that may help illustrate:

I can’t say where or how this is documented, here’s a code search that may help you explore this:

frappe@ubuntu:~/frappe-bench$ find . -name '*.py' | xargs grep restrict_to_domain
./apps/erpnext/erpnext/patches/v10_0/			'restrict_to_domain': domain
./apps/erpnext/erpnext/patches/v10_0/	'restrict_to_domain': 'Education'
./apps/erpnext/erpnext/patches/v9_0/	frappe.db.set_value('Role', role, 'restrict_to_domain', '')
./apps/frappe/frappe/desk/doctype/desktop_icon/			"ifnull(restrict_to_domain, '')": ("not in", ",".join(active_domains))
./apps/frappe/frappe/desk/	return filter_by_restrict_to_domain(data)
./apps/frappe/frappe/desk/ filter_by_restrict_to_domain(data):
./apps/frappe/frappe/desk/			doctype_domain = frappe.db.get_value(doctype, item.get("name"), "restrict_to_domain") or ''
./apps/frappe/frappe/desk/		"ifnull(restrict_to_domain, '')": "",
./apps/frappe/frappe/desk/		"restrict_to_domain": ("in", active_domains)
./apps/frappe/frappe/core/doctype/doctype/		if hasattr(doc,'restrict_to_domain') and doc.restrict_to_domain and \
./apps/frappe/frappe/core/doctype/doctype/			not frappe.db.exists('Domain', doc.restrict_to_domain):
./apps/frappe/frappe/core/doctype/doctype/			frappe.get_doc(dict(doctype='Domain', domain=doc.restrict_to_domain)).insert()
./apps/frappe/frappe/core/doctype/domain_settings/		'''Disable all restricted roles and set `restrict_to_domain` property in Module Def'''
./apps/frappe/frappe/core/doctype/domain_settings/		frappe.db.set_value('Module Def', module, 'restrict_to_domain', domain)
./apps/frappe/frappe/core/doctype/domain_settings/		frappe.db.set_value('Role', role, 'restrict_to_domain', domain)
./apps/frappe/frappe/core/doctype/domain_settings/		for m in frappe.get_all("Module Def", fields=['name', 'restrict_to_domain']):
./apps/frappe/frappe/core/doctype/domain_settings/		if (not m.restrict_to_domain) or (m.restrict_to_domain in active_domains):
./apps/frappe/frappe/core/doctype/user/		"ifnull(restrict_to_domain, '')": "",
./apps/frappe/frappe/core/doctype/user/		"restrict_to_domain": ("in", active_domains)
./apps/frappe/frappe/core/page/permission_manager/	"ifnull(restrict_to_domain, '')": "",
./apps/frappe/frappe/core/page/permission_manager/	"restrict_to_domain": ("in", active_domains)
./apps/frappe/frappe/core/page/permission_manager/	"ifnull(restrict_to_domain, '')": "",
./apps/frappe/frappe/core/page/permission_manager/	"restrict_to_domain": ("in", active_domains)
./apps/frappe/frappe/utils/			read_only, restrict_to_domain, module from tabDocType""", as_dict=1):
./apps/frappe/frappe/utils/			if (not r.restrict_to_domain) or (r.restrict_to_domain in active_domains):
./apps/frappe/frappe/tests/		test_doctype.restrict_to_domain = "_Test Domain 2"
./apps/frappe/frappe/tests/		test_role.restrict_to_domain = "_Test Domain 2"
./apps/frappe/frappe/tests/		test_doctype.restrict_to_domain = "_Test Domain 2"
./apps/frappe/frappe/tests/		test_module_def.restrict_to_domain = "_Test Domain 2"
./apps/frappe/frappe/tests/		test_module_def.restrict_to_domain = ""

It indicates that there is a user permission applied for that user based on some condition. Clicking on Restricted will show you the said conditions.

Yeah , i saw clicked on restricted button and it's shown field value . but how it's take  link  field value (ex. Employee it's automatically take employee id and it's starts restricted)? 

I would like to know what happen here…

For employees, when you’re linking the employee master and the user ID, there is an option to Create User Permission.

To cross check, you can go to the User Permission list and see.

Thanks for reply …
got it now…thanks u so much @kennethsequeira