Security and Archive Levels>>
In the data table, Brimbox allows an integer detailing the security or archive levels. The
$archive global and session value and the current
$userrole global and session value correspond and relate to the database row archive and security levels.
To keep it organized, a value of 0 represents the lowest security or archive level in the data table. For the standard interface, there is no row level check for security, and the archive global is set to 1 meaning only archive levels less than 1 (thus 0) are displayed by default. If there is customization, setting a higher archive level to the standard interface will display archive levels less than the archive level set. For example, in the standard interface if
$archive is set to 2 it will display all rows with and archive less than 2 (thus 0 and 1).
Note: Security levels in Brimbox are superglobals and are only defined once by one security array. It would be good to design code that works with whatever security levels are defined.
This is an example of how security and archive levels might be set up:
Row archive and security values for the standard interface are accessible through:
Generally they are set like:
$main->add_value ('security', array(0=>"Open",1=>"Low",2=>"Medium",3=>"High"), 'row_security'); $main->add_value ('security', array(0=>"Current",1=>"Archived",2 =>"Deep Archive"), 'row_archive');
This is the equivalent of:
$array_security['row_security'] = array(0=>"Open",1=>"Low",2=>"Medium",3=>"High"); $array_security['row_archive'] = array(0=>"Current", 1=>"Archived", 2=>"Deep Archive");
By default, these are empty arrays if not defined otherwise.
Column and Layout Security
Columns and Layouts also allow for security. In the default, columns and layouts are either secure (thus 1) or not secure (thus 0). The standard interface displays all levels by default. The functions which display the layout dropdowns (
$main->layout_dropdown()) and the column dropdowns (
$main->column_dropdown()) will display by default all layouts or columns. However if a security level is set in the optional parameters, they will display everything less than that security level. So if the security level is set to 2, these functions will display everything less than 2 (or 0 and 1 columns and layouts security).
This is also true for the standard record return function (
$main->return_rows()). This will by default display all columns, or everything less than the security value passed.
To define layout and column security values for the Brimbox Instance, you can define or re-declare:
$main->add_value ('security', array(0=>"Open",1=>"Guarded",2=>"Secure"), 'layout_security'); $main->add_value ('security', array(0=>"Open",1=>"Guarded",2=>"Secure"), column_security');
$array_security['layout_security'] = array(0=>"Open",1=>"Guarded",2=>"Secure"); $array_security['column_security'] = array(0=>"Open",1=>"Guarded",2=>"Secure");
If it is desired to have no security or archive levels, simply set all the security arrays to:
Probably also you will want to customize the links array so there are no “Secure” and “Archive” links displayed in the standard interface when records are returned.
As an aside, the default security settings of the empty array
array() cause checkbox (0 or 1) security options. However you could set the same security and archive levels displayed as Dropdowns by setting all the security arrays to:
and the archive levels to: