BAOBAB
CO_Security_ID Class Reference
Inheritance diagram for CO_Security_ID:
Collaboration diagram for CO_Security_ID:

Public Member Functions

 __construct ( $in_db_object=NULL, $in_db_result=NULL)
 
 load_from_db ($in_db_result)
 
 security_exemption ()
 
 user_can_read ()
 
- Public Member Functions inherited from A_CO_DB_Table_Base
 set_batch_mode ()
 
 clear_batch_mode ()
 
 id ()
 
 lock ()
 
 locked ()
 
 danger_will_robinson_danger_clear_id ()
 
 user_can_write ()
 
 set_read_security_id ($in_new_id)
 
 set_write_security_id ($in_new_id)
 
 set_name ($in_new_value)
 
 delete_from_db ()
 
 update_db ()
 
 reload_from_db ()
 
 get_access_object ()
 
 get_lang ()
 
 set_lang ( $in_lang_id=NULL)
 

Protected Attributes

 $_special_first_time_security_exemption
 
- Protected Attributes inherited from CO_Security_Node
 $_ids
 
- Protected Attributes inherited from A_CO_DB_Table_Base
 $_db_object
 This is the actual database object that "owns" this instance. It should not be exposed beyond this class or subclasses, thereof. More...
 
 $_id
 This is the within-table unique ID of this record. More...
 
 $_batch_mode
 If this is true, then the write_record call will not be made in update_db. It will be done when clear_batch_mode() is called, instead. More...
 

Additional Inherited Members

- Public Attributes inherited from A_CO_DB_Table_Base
 $class_description
 This is a description of the class (not the instance). More...
 
 $instance_description
 This is a description that describes the instance. More...
 
 $last_access
 This is a UNIX epoch date that describes the last modification. The default is UNIX Day Two (in case of UTC timezone issues). More...
 
 $name
 This is the "object_name" string field. More...
 
 $read_security_id
 This is a single integer, defining the security ID required to view the record. If it is 0, then it is "open.". More...
 
 $write_security_id
 This is a single integer, defining the required security token to modify the record. If it is 0, then any logged-in user can modify. More...
 
 $context
 This is a mixed associative array, containing fields for the object. More...
 
 $error
 If there is an error, it is contained here, in a LGV_Error instance. More...
 
- Protected Member Functions inherited from CO_Security_Node
 _default_setup ()
 
 _build_parameter_array ()
 
- Protected Member Functions inherited from A_CO_DB_Table_Base
 _badger_serialize ( $in_data)
 
 _badger_unserialize ( $in_data)
 
 _write_to_db ()
 
 _seppuku ()
 

Detailed Description

This is the specialized class for the generic security ID.

Definition at line 38 of file co_security_id.class.php.

Constructor & Destructor Documentation

◆ __construct()

CO_Security_ID::__construct (   $in_db_object = NULL,
  $in_db_result = NULL 
)

Constructor.

Parameters
$in_db_objectThis is the database instance that "owns" this record.
$in_db_resultThis is a database-format associative array that is used to initialize this instance.

Reimplemented from CO_Security_Node.

Definition at line 46 of file co_security_id.class.php.

48  {
49  parent::__construct($in_db_object, $in_db_result);
50  $this->class_description = 'This is a security class for IDs.';
51  $this->instance_description = isset($this->name) && $this->name ? "$this->name ($this->_id)" : "Unnamed ID Node ($this->_id)";
52  $this->_special_first_time_security_exemption = true;
53  $this->read_security_id = $this->id(); // These are always the case, regardless of what anyone else says.
54  $this->write_security_id = -1;
55  }

References A_CO_DB_Table_Base\id().

Here is the call graph for this function:

Member Function Documentation

◆ load_from_db()

CO_Security_ID::load_from_db (   $in_db_result)

This function sets up this instance, according to the DB-formatted associative array passed in.

Returns
true, if the instance was able to set itself up to the provided array.

Reimplemented from A_CO_DB_Table_Base.

Definition at line 63 of file co_security_id.class.php.

63  {
64  $ret = parent::load_from_db($in_db_result);
65 
66  if ($ret) {
67  $this->read_security_id = $this->id(); // These are always the case, regardless of what anyone else says.
68  $this->write_security_id = -1;
69  $this->class_description = 'This is a security class for IDs.';
70  }
71 
72  return $ret;
73  }

References A_CO_DB_Table_Base\id().

Here is the call graph for this function:

◆ security_exemption()

CO_Security_ID::security_exemption ( )

This weird little function allows a creator to once -and only once- add an ID to itself, as long as that ID is for this object. This is a "Heisenberg" query. Once it's called, the security exemption is gone.

returns true, if the security exemption was on.

Definition at line 82 of file co_security_id.class.php.

82  {
84  $this->_special_first_time_security_exemption = false;
85 
86  return $ret;
87  }

References $_special_first_time_security_exemption.

◆ user_can_read()

CO_Security_ID::user_can_read ( )

This is an overload, because we also want to make sure that only cleared manager objects get to see this (or God, of course).

Returns
true, if the current logged-in user has read permission on this record.

Reimplemented from A_CO_DB_Table_Base.

Definition at line 94 of file co_security_id.class.php.

94  {
95  $ret = parent::user_can_read();
96 
97  if ($ret) {
98  $ret = false;
99  // We make double-damn sure that only cleared managers can see this.
100  $item = $this->get_access_object()->get_login_item();
101  if ($this->get_access_object()->god_mode() || (isset($item) && ($item instanceof CO_Login_Manager))) {
102  $exemption = in_array($this->id(), $item->ids());
103 
104  $ret = ($this->get_access_object()->god_mode() || $exemption);
105  }
106  }
107 
108  return $ret;
109  }

References A_CO_DB_Table_Base\get_access_object().

Here is the call graph for this function:

Member Data Documentation

◆ $_special_first_time_security_exemption

CO_Security_ID::$_special_first_time_security_exemption
protected

Definition at line 39 of file co_security_id.class.php.

Referenced by security_exemption().