diff --git a/info.textgrid.middleware.tgauth.rbac/rbac/RBACcore.class.php b/info.textgrid.middleware.tgauth.rbac/rbac/RBACcore.class.php index 09e60c4acb82db4f9d91ef46d2f208096af7cb0c..3a538e0d33d176d742d586dd494786329e5dcec5 100755 --- a/info.textgrid.middleware.tgauth.rbac/rbac/RBACcore.class.php +++ b/info.textgrid.middleware.tgauth.rbac/rbac/RBACcore.class.php @@ -1079,25 +1079,59 @@ class RBACcore implements iRBACcore { // ## userOperationsOnObject ######################################## public function userOperationsOnObject( $inUser, $inResource ) { + $context = false; // Possibly a Context-object $arrAuthRole; // The users authorized roles $arrOperation = Array(); // The resulting operations $arrTmpOperation; // Temporary array of operations $i = 0; // Loop - // Get the users authorized roles - $arrAuthRole = $this->authorizedRoles( $inUser, false ); + // If an interceptor is defined, we need to + // provide a context and events + if( $this->interceptor ) { + + $context = new Context(); + + } + + + if( preg_match( "/.+/", $inUser ) ) { + + // Get the users authorized roles + $arrAuthRole = $this->authorizedRoles( $inUser, false ); - for( $i = 0; $i < sizeof( $arrAuthRole ); $i++ ) { + for( $i = 0; $i < sizeof( $arrAuthRole ); $i++ ) { + + // Get the operations the user has because of role i + $arrTmpOperation = $this->roleOperationsOnObjectInternal( $arrAuthRole[$i], $inResource, true ); + + + // Only merge the result of the above call if it really is + // an array. + is_array( $arrTmpOperation ) ? $arrOperation = array_merge( $arrOperation, $arrTmpOperation ) : false; + + } + + } + + + // ----------- + // -- EVENT -- + // The operations are ready to return, but + // maybe someone wants to add or remove one. + // ----------- + if( $this->interceptor ) { - // Get the operations the user has because of role i - $arrTmpOperation = $this->roleOperationsOnObjectInternal( $arrAuthRole[$i], $inResource, true ); + // Create context + $context->setValue( "arrOperation", $arrOperation ); + // Give away the context + $context = $this->interceptor->event( "userOperationsOnObject", "finish", $context ); - // Only merge the result of the above call if it really is - // an array. - is_array( $arrTmpOperation ) ? $arrOperation = array_merge( $arrOperation, $arrTmpOperation ) : false; + // Use the returned context + $arrOperation = $context->getValue( "arrOperation" ); + $continue = $context->getSecurityChain(); }