<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
	<title type="html"><![CDATA[FrontAccounting forum — access levels to new modules / plugins]]></title>
	<link rel="self" href="https://frontaccounting.com/punbb/extern.php?action=feed&amp;tid=1333&amp;type=atom" />
	<updated>2010-05-24T10:51:10Z</updated>
	<generator>PunBB</generator>
	<id>https://frontaccounting.com/punbb/viewtopic.php?id=1333</id>
		<entry>
			<title type="html"><![CDATA[Re: access levels to new modules / plugins]]></title>
			<link rel="alternate" href="https://frontaccounting.com/punbb/viewtopic.php?pid=5971#p5971" />
			<content type="html"><![CDATA[<p>Yes, of course you are right. add_access_extensions() have to be called inside extension files to have security areas maintained by core source code. This way module access areas does not interfere with core nor any other module security areas. Thanks for information that you have found a problem.</p><p>Janusz</p>]]></content>
			<author>
				<name><![CDATA[itronics]]></name>
				<uri>https://frontaccounting.com/punbb/profile.php?id=89</uri>
			</author>
			<updated>2010-05-24T10:51:10Z</updated>
			<id>https://frontaccounting.com/punbb/viewtopic.php?pid=5971#p5971</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: access levels to new modules / plugins]]></title>
			<link rel="alternate" href="https://frontaccounting.com/punbb/viewtopic.php?pid=5968#p5968" />
			<content type="html"><![CDATA[<p>I continue reviewing the code and I found this.</p><p>You are moving all the permissions specified by plug-ins or modules (specified in $security_sections and $security_areas) by adding a counter and the extension id so it will not interfere with the normal permissions. </p><p>When those files are included the variables $security_areas and $security_sections are not the global variables, they are local variables that you use as basis to the new codes.</p><div class="codebox"><pre><code>$page_security = &#039;SA_MEXCFD_SETUP&#039;;
include_once($path_to_root . &quot;/includes/session.inc&quot;);
add_access_extensions();</code></pre></div><p>If a module or plug-in is using different codes to security the function add_access_extensions() must be called in order to add the permissions described on &#039;acc_file&#039;</p><p><strong>This is solved, I hope this information works for other people</strong></p>]]></content>
			<author>
				<name><![CDATA[eclipxe]]></name>
				<uri>https://frontaccounting.com/punbb/profile.php?id=1024</uri>
			</author>
			<updated>2010-05-23T23:45:59Z</updated>
			<id>https://frontaccounting.com/punbb/viewtopic.php?pid=5968#p5968</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: access levels to new modules / plugins]]></title>
			<link rel="alternate" href="https://frontaccounting.com/punbb/viewtopic.php?pid=5967#p5967" />
			<content type="html"><![CDATA[<p>Seems you have&nbsp; found a bug. I guess it is related to mixed signed/unsigned logic used in access functions, and will be fixed asap. In mean time you can use 100 instead 201 as base for security area codes, which should omit the problem for now.<br />Thank you for all your effort to investigate the problem.<br />Janusz</p>]]></content>
			<author>
				<name><![CDATA[itronics]]></name>
				<uri>https://frontaccounting.com/punbb/profile.php?id=89</uri>
			</author>
			<updated>2010-05-23T08:19:56Z</updated>
			<id>https://frontaccounting.com/punbb/viewtopic.php?pid=5967#p5967</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: access levels to new modules / plugins]]></title>
			<link rel="alternate" href="https://frontaccounting.com/punbb/viewtopic.php?pid=5966#p5966" />
			<content type="html"><![CDATA[<p>I&#039;ve have added manually to the database the permissions.<br />security_roles.sections &lt;= added &quot;;51456&quot;<br />security_roles.areas, &lt;= added &quot;;51457;51458&quot;</p><p>The message about &quot;The security settings on your account do not permit you to access this function&quot; now disappears, so, there is maybe a bug in the Access Setup (/admin/security_roles.php) that store the value adding 16384 =&gt; 100000000000000.</p><p>Please advise.</p>]]></content>
			<author>
				<name><![CDATA[eclipxe]]></name>
				<uri>https://frontaccounting.com/punbb/profile.php?id=1024</uri>
			</author>
			<updated>2010-05-23T06:22:02Z</updated>
			<id>https://frontaccounting.com/punbb/viewtopic.php?pid=5966#p5966</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[access levels to new modules / plugins]]></title>
			<link rel="alternate" href="https://frontaccounting.com/punbb/viewtopic.php?pid=5965#p5965" />
			<content type="html"><![CDATA[<p>I had made a plugin but I have problems with access levels<br />FA version 2.2.8</p><p>I have read https://frontaccounting.com/fawiki/index.php?n=Devel.AccessControl</p><p>I have a module with access_levels.php with this:<br /></p><div class="codebox"><pre><code>define(&#039;SS_MEXCFD&#039;,    201&lt;&lt;8);
$security_sections[SS_MEXCFD] = _(&quot;MEXCFD (electronic invoices)&quot;);

$security_areas[&#039;SA_MEXCFD_SETUP&#039;] = array(SS_MEXCFD|1, _(&quot;MEXCFD Connector Setup&quot;)) ;
$security_areas[&#039;SA_MEXCFD_NOTICES&#039;] = array(SS_MEXCFD|2, _(&quot;MEXCFD Notices&quot;)) ;
/*
201&lt;&lt;8   =&gt; 1100100100000000 (51456)
201&lt;&lt;8|1 =&gt; 1100100100000001 (51457)
201&lt;&lt;8|2 =&gt; 1100100100000010 (51458)
*/</code></pre></div><p>I try to enter my module, setting $page_security = &#039;SA_MEXCFD_SETUP&#039;;<br />And get an error abput &quot;The security settings on your account do not permit you to access this function&quot;</p><p>The role I&#039;m using already have set the permission at Access Setup (I had logout &amp; login again)</p><p>In the database the access is stored as 91136, 91236 and 91237<br /></p><div class="codebox"><pre><code>91136 =&gt; 10110010000000000
91236 =&gt; 10110010001100100
91237 =&gt; 10110010001100101</code></pre></div><p>I have found this relation between the permission code (for SA_MEXCFD_SETUP) and the permission set by the access setup:<br /></p><div class="codebox"><pre><code>91236 &amp; 51456 =&gt; 16384 =&gt; 100000000000000</code></pre></div><p>I don&#039;t know if this is the normal behavior or what I have to do in order to use the permission I&#039;m setting in&nbsp; $page_security</p><p>I have check also the file current_user.php and the step where it return false is this:<br /></p><div class="codebox"><pre><code>return $code &amp;&amp; in_array($code, $this-&gt;role_set) &amp;&amp; ($this-&gt;company == 0 || (($code&amp;~0xff) != SS_SADMIN));
$code = 51457;
in_array($code, $this-&gt;role_set) =&gt; this return false
$this-&gt;role_set contains 91236 instead of 51457;</code></pre></div><p><strong>Could you please advise about this ? Thanks in advance !!</strong></p>]]></content>
			<author>
				<name><![CDATA[eclipxe]]></name>
				<uri>https://frontaccounting.com/punbb/profile.php?id=1024</uri>
			</author>
			<updated>2010-05-23T06:15:32Z</updated>
			<id>https://frontaccounting.com/punbb/viewtopic.php?pid=5965#p5965</id>
		</entry>
</feed>
