Dimofinf Mobile

Subscribe now to Dimofinf Mobile and enjoy a wide range of premium services. You will receive our SMS text messages wherever you are for a very low cost! More

 Currency Converter

  • Currency
  • US$ Amount

Permissions system

Dimofinf provides you with an advanced permissions system as Dimofinf depends on the Bitfield system and there are some basic points you need to know about the Bitfield system:

  • The Bit is the smallest data unit in digital technology and it can only include two values and they are presented in a double numerical (Binary) form; which is '0' and '1'.
  • Bitfield permission values are assigned in ascending form and in order of powers of the number '2' as '2' is the maximum value a Bit can include:

20 = 1

21 = 2

22 = 4

23 = 8

24 = 16

25 = 32

26 = 64




2n = ..


Please note:

In Dimofinf, permissions are classified into groups where the Bitfield values for each permission within the group needs to be correct and in the right ascending order so that the comparison process can be done smoothly. The Bitfield system compares the binary number for the Bitfield number for the permission using the single '&' factor and the binary number for the total of the Bitfield numbers for the group which includes the permission and eventually it returns a binary number for one of the Bitfield permission values from the permissions within the group thus returning a 'true' value which fulfills the permission condition. If it returns a binary number which isn't included in the values of the binary number for one of the permissions available in the group, it returns 'false' and the condition isn't met.

For example:

If we have a group called 'viewing permissions' and it includes a number of permissions whose Bitfield total value is 15 and we would like to verify a permission within this group; the viewing permission whose order is 4th and so, its Bitfield value should be 8 according to the previous table. The calculation is done as this example:

- The binary number for the total number of the Bitfield values for the group (15) is 1111.

- The binary number of the Bitfield values for the permission required (8) is 1000.

The comparison equation using the single '&' factor is done as follows:


1000 &



When compared, the two conditions at the nodes of the 'AND' factor must be met as the equation result is as follows from the right to the left is:

- 1 and 0 (condition isn't met) = 0

- 1 and 0 (condition isn't met) = 0

- 1 and 0 (condition isn't met) = 0

- 1 and 1 (condition is met) = 1

Thus making the total equals 1000 which is equal to 8 in the Bitfield which is one of the Bitfield values within the permissions group and so, it returns 'true'. In Dimofinf, we offer you a group of ready-made functions for the execution of the comparison process; they'll be explained later.

  • The permissions and their Bitfield values are saved in an XML file and in Dimofinf you can find the Bitfield file within the following path: 'include/xml' and under the name 'dimofinf-bitfield.xml' but in the plugins (if available) it is found in the XML folder in the following path 'include/plugins/pluginfolder/xml/pluginfolder-bitfield.xml' but replacing 'pluginfolder' with the name of the plugins folder name. (It is very important to save the Bitfield file with the same name form in the plugins.)

 An example of the Bitfield XML file:

<?xml version="1.0" encoding="UTF-8"?>
<bitfields product="dimofinf">
		<group name="ugp">
The permissions groups starts here from
			<group name="modulepermissions">				
				<bitfield name="cvcontent"	group="module_permissions" 	phrase="c_v_c"	readonly="10"	install="1,2,3,4,5,6,7,8,9,10">1</bitfield>
				<bitfield name="cvothcontent"	group="module_permissions" 	phrase="c_v_oth_c"  readonly="10"	install="1,2,3,4,5,6,7,8,9,10">2</bitfield>


  • Permissions are classified into groups and each group has its own set of permissions.
  • The word 'module' is replaced with the module or plugin name.
  • The name feature in the Bitfield tag is the permission name.
  • The phrase feature in the Bitfield tag is the phrase name variable in the permission language.
  • The readonly feature in the Bitfield tag is the one with the numbers of members groups who will have this permission as mandatory and without having the choice of whether to get the access or not.
  • The install feature in the Bitfield tag is the one with the numbers of the members groups who will be allowed this permission as a default.

The plugin Bitfield file must include the following group and permission as a default:

<group name="pluginfolderpermissions">
				<bitfield name="cctrlsettings"	group="pluginfolder_permissions" 	phrase="c_ctrl"	 readonly="10"	install="9,10">1</bitfield>

This permission hypothetically allows members groups number 9 and 10 which belong to administrators to control the plugins settings through the DimCP control panel after installing it. You can also add the rest of your permissions to this group and don't forget to change the 'pluginfolder' word with the name of the plugins folder.  

Permissions verification functions:


{* php buffer start *} is_permissioned_to($module$perm$ugp_sperm false,$userid false
{* php buffer end *}

This function verifies the current user or visitor permissions and returns 'true' if the permission is allowed and returns 'false' otherwise. A specific user ID can be sent to verify the user permissions.


$module (mandatory): the plugin or module name and it is considered the group which includes the
      -  $perm (mandatory): the name of the permission to be verified.
      -  $ugp_sperm (optional):the Bitfield permissions for the special permissions. There are two kinds of
             permissions in Dimofinf, first, the members groups permissions and these are the defaults. Second,
             the sections permissions, when assigned, they override the member group permissions and so, the
             function deals with its Bitfield only with regards to the sections permissions.
      -  $userid (optional):if an ID number is assigned to the member, the function verifies the user's permissions
             according to the user's member group. If they aren't assigned, the function verifies the permissions
             for the current user or visitor.


{* php buffer start *} define('THIS_PRODUCT''article');
em>//</em><em>returning the section permissions
</em>$ugp_spermc $dimofinf->modulesections[THIS_SCRIPT]
$allow_view_own 1;
$allow_view_other 1;
$allow_publish 1;
if (
$allow_publish_other 1;

whatipermissionedTo($module,$forwhat false,$customcase=false
{* php buffer end *}

This is a helping function and its usefulness is being used and embedded in the SQL queries as it returns String separated by a comma, for the sections which the current user or visitor has permissions on, in accordance with the sections permissions. Please note that a part of SQL query can be returned when the variable $customcase is assigned directly for the sections/contents which the current user/visitor has permissions to view, view its contents or other's contents/publish its contents/publish other's contents.


$module (mandatory): the plugin or module name and it is considered the group which includes the
      -  $forwhat (optional):a matrix of the permissions names you would like to verify.
      -  $customcase (optional): a matrix if assigned, it cancels the String return separated by a comma,
             for the sections which the current user or visitor has permissions on and it returns that as a part of
             SQL query which is used to verify the sections the user/visitor has permissions to view contents and
             other's contents thus only viewing the contents he/she has viewing permissions of, whether contents
             or other's contents/publish its contents/publish other's contents.

This matrix should hypothetically include:

- secid: the section ID number.

- tblname: the content table name in the database.


{* php buffer start *} define('THIS_PRODUCT''article');
$SQL "SELECT COUNT(*) AS total FROM " . TABLE_PREFIX . "articlesm 
WHERE article_id =" . 
 . " AND " . whatipermissionedTo( THIS_PRODUCT, false,
 array( 'secid' => 
$dimofinf->GPC['id'], 'tblname' => THIS_MODULE  ) );
$count = $dimofinf->db->query_first_slave($SQL); 
{* php buffer end *}

Was this answer helpful?

Add to Favourites Add to Favourites    Print this Article Print this Article