Source for file classes_permission.php

Documentation is available at classes_permission.php

  1. <?php
  2.  
  3. class permission extends b_object {
  4. //NOTE - object type definition "user types"
  5. var $name;
  6. var $constraintArray;
  7.  
  8. function permission( $constructID = NULL ) {
  9. $this->constraintArray = array();
  10. parent::b_object( $constructID, 'permissions' );
  11. if( $relationshipType =& $GLOBALS['core']->get_relationship_type( 'permission-constraint' ) && $relationships = $relationshipType->get_byValue( array( array( 'attribute'=>'primaryID', 'operator'=>'=', 'value'=>$this->id ), array( 'attribute'=>'secondaryID', 'operator'=>'=', 'value'=>$this->id ) ) ) ) {
  12. foreach( $relationships as $relationship ) {
  13. $related =& get_object( ($relationship->get_attribute('primaryID') == $this->id) ? $relationship->get_attribute('secondaryID') : $relationship->get_attribute('primaryID') );
  14. $this->constraintArray[$related->id] =& $related;
  15. }
  16. }
  17. }
  18. //NOTE: these functions are here to overload the base class functions if special data validation etc is needed
  19. //function &get_attribute( $attribute ) { }
  20. //function set_attribute( $attribute, $value ) { }
  21. //function set( $values ) { }
  22. //function set_db( $values ) { }
  23. //function set_object( $values ) { }
  24. //function delete() { }
  25. function get_contents( $navArray = NULL ) {
  26. //echos content for viewing / editing a single permission
  27. //NOTE: multi-dimensional constraint arrays need to be coded: permission = array( 'owner_constraint', 'array_constraints'=>array( <constraints> ) )
  28. if( $_GET['module'] ) { $module = 'module='.$_GET['module'].'&'; }
  29. $returnString;
  30. //open the form
  31. $returnString .='<form name="theForm" action="'.echo_url(true, false).'?'.$module.'object_type='.$this->type->get_attribute( 'type_name' ).'&object='.$this->id.'" method="post">';
  32.  
  33. //output toolbar and navigation
  34. $returnString .= '<div id="sidebar">'.get_nav_content($navArray).'</div>';
  35. //open the content div
  36. $returnString .= '<div id="sub_content">';
  37. //output title info
  38. $returnString .= $this->get_title();
  39. //output an errors in submitted form data
  40. $returnString .= error_text();
  41. //close the form
  42. $returnString .= '</form>';
  43. //output any relationships
  44. if( $this->id != '*new*' ) {
  45. $returnString .= $this->get_relationships_content();
  46. }
  47. //close the content div
  48. $returnString .= '</div>';
  49. return $returnString;
  50. }
  51.  
  52. function get_index() {
  53. return $this->name;
  54. }
  55.  
  56. function verify_set( $post ) {
  57. //verifies data before setting the object's values - returns an error array if problems are found
  58. if( allowed( 'edit permissions' ) ) {
  59. $this->set( $post );
  60. }
  61. }
  62. }
  63.  
  64. ?>

Documentation generated on Tue, 24 May 2005 03:57:13 -0400 by phpDocumentor 1.3.0RC3