refactor: allow system managers to view notification settings list for all users
This commit is contained in:
parent
446c0636ac
commit
58fe724428
2 changed files with 17 additions and 1 deletions
|
|
@ -8,5 +8,14 @@ frappe.ui.form.on('Notification Settings', {
|
|||
route: '#modules/Settings',
|
||||
type: 'Custom'
|
||||
});
|
||||
},
|
||||
|
||||
refresh: (frm) => {
|
||||
if (frappe.user.has_role(['System Manager', 'Administrator'])) {
|
||||
frm.add_custom_button('Go to Notification Settings List', () => {
|
||||
frappe.set_route('List', 'Notification Settings');
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
});
|
||||
|
|
|
|||
|
|
@ -62,7 +62,14 @@ def get_subscribed_documents():
|
|||
def get_permission_query_conditions(user):
|
||||
if not user: user = frappe.session.user
|
||||
|
||||
return '''(`tabNotification Settings`.user = '{user}')'''.format(user=user)
|
||||
if user == 'Administrator':
|
||||
return
|
||||
|
||||
roles = frappe.get_roles(user)
|
||||
if "System Manager" in roles:
|
||||
return '''(`tabNotification Settings`.name != 'Administrator')'''
|
||||
|
||||
return '''(`tabNotification Settings`.name = '{user}')'''.format(user=user)
|
||||
|
||||
@frappe.whitelist()
|
||||
def set_seen_value(value, user):
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue