<?xml version="1.0" encoding="UTF-8"?>
<!-- generator="FeedCreator 1.7.2" -->
<rss version="2.0">
    <channel>
        <title>fieldname__permissions[ Search for &quot;&quot;]</title>
        <description></description>
        <link>http://xataface.com/wiki/index.php?-action=single_record_search&amp;-table=wiki&amp;page_id=%3D53&amp;-cursor=0&amp;-skip=0&amp;-limit=30&amp;-mode=list&amp;--subsearch=</link>
        <lastBuildDate>Thu, 23 May 2013 12:11:53 +0100</lastBuildDate>
        <generator>FeedCreator 1.7.2</generator>
        <item>
            <title>fieldname__permissions</title>
            <link>http://www.xataface.com/wiki/fieldname__permissions</link>
            <description>&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Field&lt;/th&gt;&lt;th&gt;Value&lt;/th&gt;&lt;/tr&gt;&lt;/thead&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td valign=&quot;top&quot;&gt;Page name&lt;/td&gt;&lt;td valign=&quot;top&quot;&gt;fieldname__permissions&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td valign=&quot;top&quot;&gt;Page id&lt;/td&gt;&lt;td valign=&quot;top&quot;&gt;53&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td valign=&quot;top&quot;&gt;Page title&lt;/td&gt;&lt;td valign=&quot;top&quot;&gt;fieldname__permissions&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td valign=&quot;top&quot;&gt;Content&lt;/td&gt;&lt;td valign=&quot;top&quot;&gt;
&lt;h2 id=&quot;toc0&quot;&gt;fieldname__permissions() method&lt;/h2&gt;
&lt;table border=&quot;0&quot; cellspacing=&quot;0&quot; cellpadding=&quot;0&quot;&gt;&lt;tr&gt;&lt;td&gt;
&lt;div id=&quot;toc&quot;&gt;&lt;strong&gt;Table of Contents&lt;/strong&gt;
	&lt;div style=&quot;margin-left: 0em;&quot;&gt;&lt;a href=&quot;#toc0&quot;&gt;fieldname__permissions() method&lt;/a&gt;&lt;/div&gt;
	&lt;div style=&quot;margin-left: 0em;&quot;&gt;&lt;a href=&quot;#toc1&quot;&gt;Example #1&lt;/a&gt;&lt;/div&gt;
	&lt;div style=&quot;margin-left: 1em;&quot;&gt;&lt;a href=&quot;#toc2&quot;&gt;Also See:&lt;/a&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;

&lt;p&gt;The fieldname__permissions() methods will allow you to define custom permissions on a particular field in the delegate class&lt;a href=&quot;/wiki/index.php?-action=new&amp;-table=wiki&amp;page_name=delegate_class&quot;&gt;?&lt;/a&gt;.  For example to specify permissions on a field named &lt;em&gt;foo&lt;/em&gt; you would define the &lt;em&gt;foo__permissions()&lt;/em&gt; method, and to define permissions on a field named &lt;em&gt;role&lt;/em&gt; you would define the &lt;em&gt;role__permissions()&lt;/em&gt; method.&lt;/p&gt;


&lt;h2 id=&quot;toc1&quot;&gt;Example #1&lt;/h2&gt;
&lt;p&gt;(Note this example needs to be refined to be more clear)&lt;/p&gt;


&lt;pre&gt;&lt;code&gt;function approval_level__permissions(&amp;amp;$record){
    return array('edit'=&amp;gt;0); //this is will merge with what the permissions for the normal record
}&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Here we are targeting the &lt;em&gt;approval_level&lt;/em&gt; field of the delegate class&lt;a href=&quot;/wiki/index.php?-action=new&amp;-table=wiki&amp;page_name=delegate_class&quot;&gt;?&lt;/a&gt;.  The permissions method takes a return value an array of permissions.  So for example:&lt;/p&gt;


&lt;pre&gt;&lt;code&gt;$permissions['new'] = 0;
$permissions['edit'] = 0;&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Would be an example of an array of permissions which the key being the permission name and the value being a boolean to specify whether they have (1) or don't (0) have permissions to that field.  We don't have to specify a complete array of permissions (ie. permission of edit, new, readonly, etc, etc), but rather only the ones we want specifically.  The reason being that the permissions array in the return value gets merged with the permissions that this record normally gets from the record permissions.&lt;/p&gt;

&lt;p&gt;So if the record normally gives the permissions new=0, edit=1.  Then the return value from approval_level will merge with the original permissions to produce an array like this:&lt;/p&gt;


&lt;pre&gt;&lt;code&gt;$permissions['new'] = 0;
$permissions['edit'] = 1;&lt;/code&gt;&lt;/pre&gt;


&lt;h3 id=&quot;toc2&quot;&gt;Also See:&lt;/h3&gt;
&lt;ul&gt;
    &lt;li&gt; &lt;a href=&quot;/wiki/How_to_granulate_permissions_on_each_field&quot;&gt;How_to_granulate_permissions_on_each_field&lt;/a&gt;&lt;/li&gt;
    &lt;li&gt; &lt;a href=&quot;/wiki/__field__permissions&quot;&gt;__field__permissions&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td valign=&quot;top&quot;&gt;Language&lt;/td&gt;&lt;td valign=&quot;top&quot;&gt;en&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;</description>
            <author>fieldname__permissions</author>
        </item>
    </channel>
</rss>
