<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
	<channel>
		<title><![CDATA[FrontAccounting forum — Hide Menu options if not authorized (for Report)]]></title>
		<link>https://frontaccounting.com/punbb/viewtopic.php?id=7613</link>
		<atom:link href="https://frontaccounting.com/punbb/extern.php?action=feed&amp;tid=7613&amp;type=rss" rel="self" type="application/rss+xml" />
		<description><![CDATA[The most recent posts in Hide Menu options if not authorized (for Report).]]></description>
		<lastBuildDate>Sat, 06 Mar 2021 08:23:23 +0000</lastBuildDate>
		<generator>PunBB</generator>
		<item>
			<title><![CDATA[Re: Hide Menu options if not authorized (for Report)]]></title>
			<link>https://frontaccounting.com/punbb/viewtopic.php?pid=39219#p39219</link>
			<description><![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>]]></description>
			<author><![CDATA[null@example.com (apmuthu)]]></author>
			<pubDate>Sat, 06 Mar 2021 08:23:23 +0000</pubDate>
			<guid>https://frontaccounting.com/punbb/viewtopic.php?pid=39219#p39219</guid>
		</item>
		<item>
			<title><![CDATA[Re: Hide Menu options if not authorized (for Report)]]></title>
			<link>https://frontaccounting.com/punbb/viewtopic.php?pid=39218#p39218</link>
			<description><![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>]]></description>
			<author><![CDATA[null@example.com (joe)]]></author>
			<pubDate>Fri, 05 Mar 2021 23:17:13 +0000</pubDate>
			<guid>https://frontaccounting.com/punbb/viewtopic.php?pid=39218#p39218</guid>
		</item>
		<item>
			<title><![CDATA[Re: Hide Menu options if not authorized (for Report)]]></title>
			<link>https://frontaccounting.com/punbb/viewtopic.php?pid=39216#p39216</link>
			<description><![CDATA[<p>@joe: ?</p>]]></description>
			<author><![CDATA[null@example.com (apmuthu)]]></author>
			<pubDate>Fri, 05 Mar 2021 16:43:59 +0000</pubDate>
			<guid>https://frontaccounting.com/punbb/viewtopic.php?pid=39216#p39216</guid>
		</item>
		<item>
			<title><![CDATA[Re: Hide Menu options if not authorized (for Report)]]></title>
			<link>https://frontaccounting.com/punbb/viewtopic.php?pid=39209#p39209</link>
			<description><![CDATA[<p>True... Does it get into the core?</p>]]></description>
			<author><![CDATA[null@example.com (detkenn)]]></author>
			<pubDate>Wed, 03 Mar 2021 07:05:45 +0000</pubDate>
			<guid>https://frontaccounting.com/punbb/viewtopic.php?pid=39209#p39209</guid>
		</item>
		<item>
			<title><![CDATA[Re: Hide Menu options if not authorized (for Report)]]></title>
			<link>https://frontaccounting.com/punbb/viewtopic.php?pid=39194#p39194</link>
			<description><![CDATA[<p>This is a good update to restrict reports based on user permissions.</p>]]></description>
			<author><![CDATA[null@example.com (kvvaradha)]]></author>
			<pubDate>Mon, 01 Mar 2021 04:52:42 +0000</pubDate>
			<guid>https://frontaccounting.com/punbb/viewtopic.php?pid=39194#p39194</guid>
		</item>
		<item>
			<title><![CDATA[Re: Hide Menu options if not authorized (for Report)]]></title>
			<link>https://frontaccounting.com/punbb/viewtopic.php?pid=39188#p39188</link>
			<description><![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>]]></description>
			<author><![CDATA[null@example.com (detkenn)]]></author>
			<pubDate>Sun, 28 Feb 2021 17:39:02 +0000</pubDate>
			<guid>https://frontaccounting.com/punbb/viewtopic.php?pid=39188#p39188</guid>
		</item>
		<item>
			<title><![CDATA[Hide Menu options if not authorized (for Report)]]></title>
			<link>https://frontaccounting.com/punbb/viewtopic.php?pid=32169#p32169</link>
			<description><![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>]]></description>
			<author><![CDATA[null@example.com (aleifuuwork)]]></author>
			<pubDate>Wed, 11 Jul 2018 07:35:01 +0000</pubDate>
			<guid>https://frontaccounting.com/punbb/viewtopic.php?pid=32169#p32169</guid>
		</item>
	</channel>
</rss>
