private function serializeTools(Role $role, $workspaceId)
    {
        $tools = [];
        $workspace = $this->om->getRepository(Workspace::class)->findBy(['uuid' => $workspaceId]);
        $orderedTools = $this->orderedToolRepo->findBy(['workspace' => $workspace]);

        foreach ($orderedTools as $orderedTool) {
            $toolRights = $this->toolRightsRepo->findBy(['role' => $role, 'orderedTool' => $orderedTool], ['id' => 'ASC']);
            $mask = 0 < count($toolRights) ? $toolRights[0]->getMask() : 0;
            $toolName = $orderedTool->getTool()->getName();
            $tools[$toolName] = [];

            foreach (ToolMaskDecoder::$defaultActions as $action) {
                $actionValue = ToolMaskDecoder::$defaultValues[$action];
                $tools[$toolName][$action] = $mask & $actionValue ? true : false;
            }
        }

        return count($tools) > 0 ? $tools : new \stdClass();
    }
private function serializeTools(Role $role, $workspaceId)
    {
        $tools = [];
        $workspace = $this->om->getRepository(Workspace::class)->findBy(['uuid' => $workspaceId]);
        $orderedTools = $this->orderedToolRepo->findBy(['workspace' => $workspace]);

        foreach ($orderedTools as $orderedTool) {
            $toolRights = $this->toolRightsRepo->findBy(['role' => $role, 'orderedTool' => $orderedTool], ['id' => 'ASC']);
            $mask = 0 < count($toolRights) ? $toolRights[0]->getMask() : 0;
            $toolName = $orderedTool->getTool()->getName();
            $tools[$toolName] = [];

            foreach (ToolMaskDecoder::$defaultActions as $action) {
                $actionValue = ToolMaskDecoder::$defaultValues[$action];
                $tools[$toolName][$action] = $mask & $actionValue ? true : false;
            }
        }

        return count($tools) > 0 ? $tools : new \stdClass();
    }
private function serializeTools ( Role $ role , $ workspaceId ) { $ tools = [ ] ; $ workspace = $ this -> om -> getRepository ( Workspace :: class ) -> findBy ( [ 'uuid' => $ workspaceId ] ) ; $ orderedTools = $ this -> orderedToolRepo -> findBy ( [ 'workspace' => $ workspace ] ) ; foreach ( $ orderedTools as $ orderedTool ) { $ toolRights = $ this -> toolRightsRepo -> findBy ( [ 'role' => $ role , 'orderedTool' => $ orderedTool ] , [ 'id' => 'ASC' ] ) ; $ mask = 0 < count ( $ toolRights ) ? $ toolRights [ 0 ] -> getMask ( ) : 0 ; $ toolName = $ orderedTool -> getTool ( ) -> getName ( ) ; $ tools [ $ toolName ] = [ ] ; foreach ( ToolMaskDecoder :: $ defaultActions as $ action ) { $ actionValue = ToolMaskDecoder :: $ defaultValues [ $ action ] ; $ tools [ $ toolName ] [ $ action ] = $ mask & $ actionValue ? true : false ; } } return count ( $ tools ) > 0 ? $ tools : new \ stdClass ( ) ; }
Serialize role tools rights.

@param Role   $role
@param string $workspaceId

@return array
Serialize role tools rights .