<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
	<title type="html"><![CDATA[FrontAccounting forum — Hide Menu options if not authorized (for Report)]]></title>
	<link rel="self" href="https://frontaccounting.com/punbb/extern.php?action=feed&amp;tid=7613&amp;type=atom" />
	<updated>2021-03-06T08:23:23Z</updated>
	<generator>PunBB</generator>
	<id>https://frontaccounting.com/punbb/viewtopic.php?id=7613</id>
		<entry>
			<title type="html"><![CDATA[Re: Hide Menu options if not authorized (for Report)]]></title>
			<link rel="alternate" href="https://frontaccounting.com/punbb/viewtopic.php?pid=39219#p39219" />
			<content type="html"><![CDATA[<p>This workaround is for those who want it and is <a href="https://frontaccounting.com/fawiki/index.php?n=Help.ReportsAndAnalysis">documented in the wiki</a>.</p><p>Sometimes, bosses do not want their staff to see what reports the management is capable of viewing!</p>]]></content>
			<author>
				<name><![CDATA[apmuthu]]></name>
				<uri>https://frontaccounting.com/punbb/profile.php?id=364</uri>
			</author>
			<updated>2021-03-06T08:23:23Z</updated>
			<id>https://frontaccounting.com/punbb/viewtopic.php?pid=39219#p39219</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Hide Menu options if not authorized (for Report)]]></title>
			<link rel="alternate" href="https://frontaccounting.com/punbb/viewtopic.php?pid=39218#p39218" />
			<content type="html"><![CDATA[<p>Hello guys,</p><p>I am not sure. I like the grayed versions in the core as is. This means that the report exists, but I am not allowed to see it. In my opinion this is not a problem. I know my place in the organization, so I don&#039;t mind.</p><p>I understand the question, but not sure if we should change this.</p><p>/Joe</p>]]></content>
			<author>
				<name><![CDATA[joe]]></name>
				<uri>https://frontaccounting.com/punbb/profile.php?id=3</uri>
			</author>
			<updated>2021-03-05T23:17:13Z</updated>
			<id>https://frontaccounting.com/punbb/viewtopic.php?pid=39218#p39218</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Hide Menu options if not authorized (for Report)]]></title>
			<link rel="alternate" href="https://frontaccounting.com/punbb/viewtopic.php?pid=39216#p39216" />
			<content type="html"><![CDATA[<p>@joe: ?</p>]]></content>
			<author>
				<name><![CDATA[apmuthu]]></name>
				<uri>https://frontaccounting.com/punbb/profile.php?id=364</uri>
			</author>
			<updated>2021-03-05T16:43:59Z</updated>
			<id>https://frontaccounting.com/punbb/viewtopic.php?pid=39216#p39216</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Hide Menu options if not authorized (for Report)]]></title>
			<link rel="alternate" href="https://frontaccounting.com/punbb/viewtopic.php?pid=39209#p39209" />
			<content type="html"><![CDATA[<p>True... Does it get into the core?</p>]]></content>
			<author>
				<name><![CDATA[detkenn]]></name>
				<uri>https://frontaccounting.com/punbb/profile.php?id=45282</uri>
			</author>
			<updated>2021-03-03T07:05:45Z</updated>
			<id>https://frontaccounting.com/punbb/viewtopic.php?pid=39209#p39209</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Hide Menu options if not authorized (for Report)]]></title>
			<link rel="alternate" href="https://frontaccounting.com/punbb/viewtopic.php?pid=39194#p39194" />
			<content type="html"><![CDATA[<p>This is a good update to restrict reports based on user permissions.</p>]]></content>
			<author>
				<name><![CDATA[kvvaradha]]></name>
				<uri>https://frontaccounting.com/punbb/profile.php?id=19348</uri>
			</author>
			<updated>2021-03-01T04:52:42Z</updated>
			<id>https://frontaccounting.com/punbb/viewtopic.php?pid=39194#p39194</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Hide Menu options if not authorized (for Report)]]></title>
			<link rel="alternate" href="https://frontaccounting.com/punbb/viewtopic.php?pid=39188#p39188" />
			<content type="html"><![CDATA[<p>I agree with @aleifuuwork, this feature is desirable. I have modified the relevant files to hide reports menus that are not authorized.</p><p>In <strong>reporting/includes/reports_classes.inc</strong> file:<br />Change report Class to include <strong>$access</strong> variable like this:<br /></p><div class="codebox"><pre><code>class Report
{
    var $id;
    var $name;
    var $ar_params;
    var $controls;
    var $access;
    
    function __construct($id, $name, $ar_params = null, $access = null)
    {
        $this-&gt;id = $id;
        $this-&gt;name = $name;
        if ($ar_params) $this-&gt;set_controls($ar_params);
                $this-&gt;access = $access;
    }
    
    function set_controls($ar_params) {
        $this-&gt;controls = $ar_params;
    }
    
    function get_controls() {
        return $this-&gt;controls;
    }
    
}</code></pre></div><p>In <strong>reports_classes.inc </strong> file line 83 <strong>getDisplay</strong> function, add:<br /></p><div class="codebox"><pre><code>if($report-&gt;access != null &amp;&amp; !$_SESSION[&quot;wa_current_user&quot;]-&gt;can_access($report-&gt;access) &amp;&amp; $_SESSION[&quot;wa_current_user&quot;]-&gt;hide_inaccessible_menu_items())
                                continue;</code></pre></div><p>Finally modify each <strong>$reports-&gt;addReport</strong> call in <strong>reporting/reports_main.php</strong> to include the <strong>$access</strong> variable.<br />e.g Customer Balances report:<br /></p><div class="codebox"><pre><code>$reports-&gt;addReport(RC_CUSTOMER, 101, _(&#039;Customer &amp;Balances&#039;),
    array(    _(&#039;Start Date&#039;) =&gt; &#039;DATEBEGIN&#039;,
            _(&#039;End Date&#039;) =&gt; &#039;DATEENDM&#039;,
            _(&#039;Customer&#039;) =&gt; &#039;CUSTOMERS_NO_FILTER&#039;,
            _(&#039;Show Balance&#039;) =&gt; &#039;YES_NO&#039;,
            _(&#039;Currency Filter&#039;) =&gt; &#039;CURRENCY&#039;,
            _(&#039;Suppress Zeros&#039;) =&gt; &#039;YES_NO&#039;,
            _(&#039;Comments&#039;) =&gt; &#039;TEXTBOX&#039;,
            _(&#039;Orientation&#039;) =&gt; &#039;ORIENTATION&#039;,
            _(&#039;Destination&#039;) =&gt; &#039;DESTINATION&#039;),&#039;SA_CUSTPAYMREP&#039;);</code></pre></div><p>Edited, Also modify <strong>addReport()</strong> function in <strong>reports_classes.inc</strong> file like this:<br /></p><div class="codebox"><pre><code>function addReport($class, $id, $rep_name, $params=null,$access=null)
    {
        unset($this-&gt;ar_reports[$class][$id]); // unset std report if any
        $this-&gt;ar_reports[$class][$id] = new Report($id, $rep_name, $params, $access);
    }</code></pre></div><p>This solution will allow for backward compatibility especially for extensions that implement reports.<br />If this solution is acceptable to the core, I will modify the whole <strong>reports_main.php</strong> file to affect all reports.</p>]]></content>
			<author>
				<name><![CDATA[detkenn]]></name>
				<uri>https://frontaccounting.com/punbb/profile.php?id=45282</uri>
			</author>
			<updated>2021-02-28T17:39:02Z</updated>
			<id>https://frontaccounting.com/punbb/viewtopic.php?pid=39188#p39188</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Hide Menu options if not authorized (for Report)]]></title>
			<link rel="alternate" href="https://frontaccounting.com/punbb/viewtopic.php?pid=32169#p32169" />
			<content type="html"><![CDATA[<p>Well, this is an extension to previous wish list that&#039;s now been implemented. I would love to see if this can be extended to apply<br />to Report option as well which you&#039;d normally access it from </p><p>http://localhost/frontaccounting/reporting/reports_main.php</p><br /><p>Original wish list : <br />Hide Menu options if not authorized<br /><a href="https://frontaccounting.com/punbb/viewtopic.php?id=1128">https://frontaccounting.com/punbb/viewtopic.php?id=1128</a></p><p>Maybe it&#039;s far stretch from now. But the motivation is the same, for those users who are not authorized it&#039;s better that : </p><p>a) we hide higher-level access completely from their menu or report; rather than having <br />b) greyed-out or make it avalable but then there will be warning that users are not authorized to do so </p><br /><p><em><br />What you can&#039;t see, you can&#039;t fiddle around with it<br />If you can see, there are temptation to fiddle around with it <br /></em></p>]]></content>
			<author>
				<name><![CDATA[aleifuuwork]]></name>
				<uri>https://frontaccounting.com/punbb/profile.php?id=42567</uri>
			</author>
			<updated>2018-07-11T07:35:01Z</updated>
			<id>https://frontaccounting.com/punbb/viewtopic.php?pid=32169#p32169</id>
		</entry>
</feed>
