ultimix
permit_controller.php
Go to the documentation of this file.
1 <?php
2 
3  /*
4  * This source code is a part of the Ultimix Project.
5  * It is distributed under BSD license. All other third side source code (like tinyMCE) is distributed under
6  * it's own license wich could be found from the corresponding files or sources.
7  * This source code is provided "as is" without any warranties or garanties.
8  *
9  * Have a nice day!
10  *
11  * @url http://ultimix.sorceforge.net
12  *
13  * @author Alexey "gdever" Dodonov
14  */
15 
27 
38  var $PermitAccess = false;
39  var $PermitAlgorithms = false;
40  var $Security = false;
41 
52  function __construct()
53  {
54  try
55  {
56  $this->PermitAccess = get_package( 'permit::permit_access' , 'last' , __FILE__ );
57  $this->PermitAlgorithms = get_package( 'permit::permit_algorithms' , 'last' , __FILE__ );
58  $this->Security = get_package( 'security' , 'last' , __FILE__ );
59  }
60  catch( Exception $e )
61  {
62  $a = func_get_args();_throw_exception_object( __METHOD__ , $a , $e );
63  }
64  }
65 
84  function set_permit( $Options )
85  {
86  try
87  {
88  $Permit = $this->Security->get_gp( 'permit' , 'command' );
89  $MasterType = $this->Security->get_gp( 'master_type' , 'command' );
90 
91  if( $this->Security->get_gp( 'ids' , 'set' ) )
92  {
93  $MasterId = explode( ',' , $this->Security->get_gp( 'ids' , 'string' ) );
94  }
95  else
96  {
97  $MasterId = array( $this->Security->get_gp( 'master_id' , 'integer' ) );
98  }
99 
100  $this->PermitAccess->set_permit_for_object( $Permit , $MasterId , $MasterType );
101  }
102  catch( Exception $e )
103  {
104  $a = func_get_args();_throw_exception_object( __METHOD__ , $a , $e );
105  }
106  }
107 
126  function delete_permit( $Options )
127  {
128  try
129  {
130  $Permit = $this->Security->get_gp( 'permit' , 'command' );
131  $MasterType = $this->Security->get_gp( 'master_type' , 'command' );
132 
133  if( $this->Security->get_gp( 'ids' , 'set' ) )
134  {
135  $MasterId = explode( ',' , $this->Security->get_gp( 'ids' , 'string' ) );
136  }
137  else
138  {
139  $MasterId = array( $this->Security->get_gp( 'master_id' , 'integer' ) );
140  }
141 
142  $this->PermitAccess->delete_permit_for_object( $Permit , $MasterId , $MasterType );
143  }
144  catch( Exception $e )
145  {
146  $a = func_get_args();_throw_exception_object( __METHOD__ , $a , $e );
147  }
148  }
149 
168  function toggle_permit( $Options )
169  {
170  try
171  {
172  $Permit = $this->Security->get_gp( 'permit' , 'command' );
173  $MasterType = $this->Security->get_gp( 'master_type' , 'command' );
174 
175  if( $this->Security->get_gp( 'ids' , 'set' ) )
176  {
177  $MasterId = explode( ',' , $this->Security->get_gp( 'ids' , 'string' ) );
178  }
179  else
180  {
181  $MasterId = array( $this->Security->get_gp( 'master_id' , 'integer' ) );
182  }
183 
184  $this->PermitAccess->toggle_permit_for_object( $Permit , $MasterId , $MasterType );
185  }
186  catch( Exception $e )
187  {
188  $a = func_get_args();_throw_exception_object( __METHOD__ , $a , $e );
189  }
190  }
191 
210  function on_after_delete_page( $Parameters )
211  {
212  try
213  {
214  $Object = $this->Security->get( get_field( $Parameters , 'page_name' ) , 'command' );
215 
216  $this->PermitAccess->delete_permits_for_page( $Object );
217  }
218  catch( Exception $e )
219  {
220  $a = func_get_args();_throw_exception_object( __METHOD__ , $a , $e );
221  }
222  }
223 
242  function controller( $Options )
243  {
244  try
245  {
246  $ContextSet = get_package_object( 'gui::context_set' , 'last' , __FILE__ );
247 
248  $ContextSet->add_context( dirname( __FILE__ ).'/conf/cfcx_set_permit' );
249 
250  $ContextSet->add_context( dirname( __FILE__ ).'/conf/cfcx_delete_permit' );
251 
252  $ContextSet->add_context( dirname( __FILE__ ).'/conf/cfcx_toggle_permit' );
253 
254  $ContextSet->execute( $Options , $this , __FILE__ );
255  }
256  catch( Exception $e )
257  {
258  $a = func_get_args();_throw_exception_object( __METHOD__ , $a , $e );
259  }
260  }
261  }
262 
263 ?>