Permissions Scripts: header.php

From XMBdocs
Revision as of 14:15, 20 April 2021 by Miqrogroove (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

All enumerations and global authorizations are located in this portion of the Forum Permissions System.

Postperm Index Enumeration

It is important to note that the integers for postperm index enumeration were poorly chosen, so they are likely to change as early as version 1.9.11. The named constants should always be used for forward compatibility.

// permissions constants
define('X_PERMS_POLL', 0);
define('X_PERMS_THREAD', 1);
define('X_PERMS_REPLY', 2);
define('X_PERMS_VIEW', 3);
define('X_PERMS_USERLIST', 4);
define('X_PERMS_PASSWORD', 5);

Because these are index constants, they are never saved or retrieved directly. They are always defined here and used in the form of $permsarray[X_PERMS_VIEW]

Changes in XMB 1.9.11

The new enumerations are planned as follows, subject to minor adjustments. Note the original perms indexes have been renamed to distinguish between the raw permissions and effective permissions. This is intended to allow various raw settings to interact and create effective settings while keeping both sets of values accessible. Authors should continue to use the original names as they will have the same meaning as before, with the exception of X_PERMS_USERLIST, which has changed significantly in

// permissions constants
define('X_PERMS_COUNT', 4); //Number of raw bit sets stored in postperm setting.

// indexes used in permissions arrays
define('X_PERMS_RAWPOLL', 0);
define('X_PERMS_RAWTHREAD', 1);
define('X_PERMS_RAWREPLY', 2);
define('X_PERMS_RAWVIEW', 3);
define('X_PERMS_POLL', 40);
define('X_PERMS_THREAD', 41);
define('X_PERMS_REPLY', 42);
define('X_PERMS_VIEW', 43); //View is now = Rawview || Userlist
define('X_PERMS_USERLIST', 44);
define('X_PERMS_PASSWORD', 45);

// status string to bit field assignments
$status_enum = array(
'Super Administrator' => 1,
'Administrator'       => 2,
'Super Moderator'     => 4,
'Moderator'           => 8,
'Member'              => 16,
'Guest'               => 32,
''                    => 32,
'Reserved-Future-Use' => 64,
'Banned'              => (1 << 30)
); //$status['Banned'] == 2^30