Skip to content
Snippets Groups Projects
Commit feac2f65 authored by Martin Haase's avatar Martin Haase
Browse files

Added event to fix TgExtra function getRights (Jira ticket TG-83)

git-svn-id: https://textgridlab.org/svn/textgrid/trunk/middleware/tgauth@2064 7c539038-3410-0410-b1ec-0f2a7bf1c452
parent a73e791b
No related branches found
No related tags found
No related merge requests found
...@@ -1079,25 +1079,59 @@ class RBACcore implements iRBACcore { ...@@ -1079,25 +1079,59 @@ class RBACcore implements iRBACcore {
// ## userOperationsOnObject ######################################## // ## userOperationsOnObject ########################################
public function userOperationsOnObject( $inUser, $inResource ) { public function userOperationsOnObject( $inUser, $inResource ) {
$context = false; // Possibly a Context-object
$arrAuthRole; // The users authorized roles $arrAuthRole; // The users authorized roles
$arrOperation = Array(); // The resulting operations $arrOperation = Array(); // The resulting operations
$arrTmpOperation; // Temporary array of operations $arrTmpOperation; // Temporary array of operations
$i = 0; // Loop $i = 0; // Loop
// Get the users authorized roles // If an interceptor is defined, we need to
$arrAuthRole = $this->authorizedRoles( $inUser, false ); // 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 // Create context
$arrTmpOperation = $this->roleOperationsOnObjectInternal( $arrAuthRole[$i], $inResource, true ); $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 // Use the returned context
// an array. $arrOperation = $context->getValue( "arrOperation" );
is_array( $arrTmpOperation ) ? $arrOperation = array_merge( $arrOperation, $arrTmpOperation ) : false; $continue = $context->getSecurityChain();
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment