61 $this->CachedMultyFS =
get_package(
'cached_multy_fs' ,
'last' , __FILE__ );
62 $this->GroupAccess =
get_package(
'permit::group_access' ,
'last' , __FILE__ );
63 $this->Link =
get_package(
'link' ,
'last' , __FILE__ );
64 $this->PermitAccess =
get_package(
'permit::permit_access' ,
'last' , __FILE__ );
65 $this->PermitAlgorithms =
get_package(
'permit::permit_algorithms' ,
'last' , __FILE__ );
66 $this->Security =
get_package(
'security' ,
'last' , __FILE__ );
67 $this->UserAccess =
get_package(
'user::user_access' ,
'last' , __FILE__ );
68 $this->UserAlgorithms =
get_package(
'user::user_algorithms' ,
'last' , __FILE__ );
98 $UserId = $this->Security->get_p(
'record_id' ,
'integer' );
99 $Permits = $this->Security->get_p(
'permits' ,
'command' , array() );
101 $HasPermits = $this->PermitAlgorithms->get_permits_for_object( $UserId ,
'user' ,
false );
102 foreach( $HasPermits as $p )
104 if(
in_array( $p , $Permits ) ===
false )
106 $p = $this->PermitAccess->get_permit_by_name( $p );
107 $this->Link->delete_link( $UserId , $p->id ,
'user' ,
'permit' );
111 foreach( $Permits as $p )
113 $this->PermitAccess->add_permit_for_object( $p , $UserId ,
'user' );
116 catch( Exception $e )
144 $UserId = $this->Security->get_p(
'record_id' ,
'integer' );
145 $Groups = $this->Security->get_p(
'groups' ,
'command' , array() );
147 $HasGroups = $this->GroupAccess->get_groups_for_object( $UserId ,
'user' );
148 foreach( $HasGroups as $g )
150 if(
in_array( $g , $Groups ) ===
false )
152 $g = $this->GroupAccess->get_group_by_name( $g );
153 $this->Link->delete_link( $UserId , $g->id ,
'user' ,
'group' );
157 foreach( $Groups as $p )
159 $this->GroupAccess->add_group_for_object( $p , $UserId ,
'user' );
162 catch( Exception $e )
190 $User = $this->UserAlgorithms->get_by_id(
191 $this->Security->get_p(
'user_permit_record_id' ,
'integer' )
193 $this->Output = $this->CachedMultyFS->get_template( __FILE__ ,
'permits_view.tpl' );
194 $this->Output = str_replace(
'{path}' , dirname( __FILE__ ) , $this->Output );
195 $this->Output = str_replace(
'{login}' , $User->login , $this->Output );
197 catch( Exception $e )
225 $User = $this->UserAlgorithms->get_by_id(
226 $this->Security->get_p(
'user_permit_record_id' ,
'integer' )
228 $this->Output = $this->CachedMultyFS->get_template( __FILE__ ,
'groups_view.tpl' );
229 $this->Output = str_replace(
'{path}' , dirname( __FILE__ ) , $this->Output );
230 $this->Output = str_replace(
'{login}' , $User->login , $this->Output );
232 catch( Exception $e )
266 $ContextSet->add_context( dirname( __FILE__ ).
'/conf/cfcx_change_permits_controller' );
267 $ContextSet->add_context( dirname( __FILE__ ).
'/conf/cfcx_change_groups_controller' );
268 $ContextSet->execute( $Options , $this , __FILE__ );
270 catch( Exception $e )
304 $ContextSet->add_context( dirname( __FILE__ ).
'/conf/cfcx_change_permits_view' );
305 $ContextSet->add_context( dirname( __FILE__ ).
'/conf/cfcx_change_groups_view' );
306 $ContextSet->execute( $Options , $this , __FILE__ );
308 return( $this->Output );
310 catch( Exception $e )