Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 15 additions & 7 deletions ProcessMaker/Providers/AuthServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -135,13 +135,11 @@ private function checkAllowedEndpoints(array $projectIds, string $currentPath):
{
$allowedEndpoints = [
'api',
'script/',
'designer/screens',
'processes/',
'designer/decision-tables',
'designer/data-sources',
];

$dataSourceClass = 'ProcessMaker\Packages\Connectors\DataSources\Models\DataSource';
$decisionTableClass = 'ProcessMaker\Package\PackageDecisionEngine\Models\DecisionTable';

// Get the assets associated with the user's projects
$projectAssets = DB::table('project_assets')
->select('asset_id', 'asset_type')
Expand All @@ -156,10 +154,20 @@ private function checkAllowedEndpoints(array $projectIds, string $currentPath):

// Check asset types and push to $allowedEndpoints
if ($assetType === Process::class) {
$allowedEndpoints[] = 'modeler/' . $assetId;
$allowedEndpoints[] = "modeler/{$assetId}";
} elseif ($assetType === Screen::class) {
$allowedEndpoints[] = 'designer/screen-builder/' . $assetId . '/edit';
$allowedEndpoints[] = "designer/screen-builder/{$assetId}/edit";
$allowedEndpoints[] = "designer/screens/{$assetId}/edit";
} elseif ($assetType === Script::class) {
$allowedEndpoints[] = "designer/scripts/{$assetId}/builder";
$allowedEndpoints[] = "designer/scripts/{$assetId}/edit";
}

if (class_exists($dataSourceClass) && $assetType === $dataSourceClass) {
$allowedEndpoints[] = "designer/data-sources/{$assetId}/edit";
}
if (class_exists($decisionTableClass) && $assetType === $decisionTableClass) {
$allowedEndpoints[] = "decision-tables/table-builder/{$assetId}/edit";
$allowedEndpoints[] = 'designer/scripts/' . $assetId . '/builder';
$allowedEndpoints[] = 'designer/scripts/' . $assetId . '/edit';
$allowedEndpoints[] = 'designer/scripts/preview';
Expand Down