Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FOUR-19940 Process Manager user can not see all Tasks #7684

Merged
merged 1 commit into from
Nov 5, 2024
Merged
Show file tree
Hide file tree
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
4 changes: 4 additions & 0 deletions ProcessMaker/Http/Controllers/Api/TaskController.php
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,10 @@ public function index(Request $request, $getTotal = false, User $user = null)
// Apply filter overdue
$query->overdue($request->input('overdue'));

if ($request->input('processesIManage') === 'true') {
$this->applyProcessManager($query, $user);
}

// If only the total is being requested (by a Saved Search), send it now
if ($getTotal === true) {
return $query->count();
Expand Down
15 changes: 15 additions & 0 deletions ProcessMaker/Traits/TaskControllerIndexMethods.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
use Illuminate\Support\Str;
use ProcessMaker\Filters\Filter;
use ProcessMaker\Managers\DataManager;
use ProcessMaker\Models\Process;
use ProcessMaker\Models\ProcessRequest;
use ProcessMaker\Models\ProcessRequestToken;
use ProcessMaker\Models\User;
Expand Down Expand Up @@ -319,4 +320,18 @@ private function applyForCurrentUser($query, $user)
->orWhereIn('id', $user->availableSelfServiceTaskIds());
});
}

public function applyProcessManager($query, $user)
{
$ids = Process::select(['id'])
->where('properties->manager_id', $user->id)
->where('status', 'ACTIVE')
->get()
->toArray();

$query->orWhere(function ($query) use ($ids) {
$query->whereIn('process_request_tokens.process_id', array_column($ids, 'id'))
->where('process_request_tokens.status', 'ACTIVE');
});
}
}
1 change: 1 addition & 0 deletions resources/js/tasks/components/ListMixin.js
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@ const ListMixin = {
}${filterParams
}${this.getSortParam()
}&non_system=true` +
`&processesIManage=${(this.processesIManage ? 'true' : 'false')}` +
advancedFilter +
this.columnsQuery,
{
Expand Down
4 changes: 2 additions & 2 deletions resources/js/tasks/components/TasksList.vue
Original file line number Diff line number Diff line change
Expand Up @@ -339,7 +339,7 @@ export default {
type: String,
default: "tasks",
},
verifyUrlToFalse: {
processesIManage: {
type: Boolean,
default: false
}
Expand Down Expand Up @@ -866,7 +866,7 @@ export default {
verifyURL(string) {
const currentUrl = window.location.href;
let isInUrl = currentUrl.includes(string);
if (this.verifyUrlToFalse) {
if (this.processesIManage) {
isInUrl = false;
}
return isInUrl;
Expand Down
Loading