fixed: hide links based on roles in accounts home
This commit is contained in:
parent
809226bcb7
commit
90a54a0435
@ -12,7 +12,7 @@
|
||||
<p class="help">Bills raised by Suppliers</p>
|
||||
</div>
|
||||
<div style="width: 48%; float: right;">
|
||||
<h4><a href="#!Accounts Browser/Account">Chart of Accounts</a></h4>
|
||||
<h4><a href="#!Accounts Browser/Account" data-role="Accounts Manager, Accounts User">Chart of Accounts</a></h4>
|
||||
<p class="help">Structure of books of accounts</p>
|
||||
<br>
|
||||
<h4><a href="#!Accounts Browser/Cost Center">Chart of Cost Centers</a></h4>
|
||||
@ -74,7 +74,7 @@
|
||||
href="#!Financial Statements">Financial Statements</a>
|
||||
</div>
|
||||
<div class="section-item">
|
||||
<a class="section-link"
|
||||
<a class="section-link" data-role="Accounts Manager"
|
||||
title = "Import Multiple Vouchers from CSV"
|
||||
href="#voucher-import-tool">Voucher Import Tool</a>
|
||||
</div>
|
||||
|
@ -22,11 +22,4 @@ pscript['onload_accounts-home'] = function(wrapper) {
|
||||
$('.india-specific').toggle(false);
|
||||
}
|
||||
|
||||
if(wn.boot.profile.roles.indexOf('Accounts Manager')==-1 && wn.boot.profile.roles.indexOf('Accounts User')==-1) {
|
||||
$('[href*="Accounts Browser"]').each(function() {
|
||||
var txt = $(this).text();
|
||||
$(this).parent().css('color', '#999').html(txt);
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -128,7 +128,10 @@ erpnext.module_page.hide_links = function(wrapper) {
|
||||
|
||||
// pages
|
||||
$(wrapper).find('[data-role]').each(function() {
|
||||
if(!has_common(user_roles, [$(this).attr("data-role"), "System Manager"])) {
|
||||
// can define multiple roles
|
||||
var data_roles = $(this).attr("data-role").split(",").map(function(role) {
|
||||
return role.trim(); });
|
||||
if(!has_common(user_roles, ["System Manager"].concat(data_roles))) {
|
||||
var html = $(this).html();
|
||||
$(this).parent().css('color', '#999');
|
||||
$(this).replaceWith('<span title="Only accessible by Roles: '+
|
||||
|
Loading…
Reference in New Issue
Block a user