Select to view content in your preferred language

Is it possible to prevent users from editing tasks in PRO

388
1
12-14-2023 01:20 PM
Alaind_Espaignet
Emerging Contributor

As a GIS Developer, I build PRO tasks for GIS editors. I then package the tasks along with a PRO project.

Is there a way to prevent users from editing the tasks I created and potentially breaking them?

I could not find a checkbox like "Prevent users from editing Tasks" or better still from editing those "prescribed" tasks.

I see the SDK has the concept of command filters:

https://github.com/Esri/arcgis-pro-sdk-community-samples/tree/master/Framework/CommandFilter

Is that the only way I could possibly achieve this?

Assuming the "Edit in Task Designer" is a "command" I could filter it out right?

But then how would I know what specific task the user is trying to  "Edit in Task Designer"  to forbid editing corporate/prescribed tasks yet allow them to create/edit their own.

I see the SDK has a Task assistant API allowing one to sniff out tasks in a project. But I see nothing along the lines of getting the current task in the task panel. Having this capability I could possibly use the task info to deduce its a prescribed task therefore filter out the "Edit in Task Designer" command or let it run.  

Surely someone else has this crazy requirement that seemingly defeats the purpose of tasks.

But they have a point someone could mess with and break a task they don't fully understand. 

Users can create/edit their own tasks but cannot muck with prescribed tasks. 

Attribute rules have a lock down mechanism. It seems strange there isn't something similar for Tasks.

Ideally they would be able to see the task steps in read only mode.

Did I miss a hidden checkbox somewhere?

Tags (2)
0 Kudos
1 Reply
Alaind_Espaignet
Emerging Contributor

Correction there is a way to detect the current open task

// find the first project task item which is openvar taskItem = Project.Current.GetItems<TaskProjectItem>().FirstOrDefault(t => t.IsOpen == true);
// if there isn't a project task item, returnif (taskItem == null)
  return;

if (taskItem.IsOpen)
{
  // close it
  // NOTE : The task item will also be removed from the project
  //At 2.x -
  //TaskAssistantModule.CloseTaskAsync(taskItem.TaskItemGuid);  TaskAssistantFactory.Instance.CloseTaskItemAsync(taskItem.TaskItemGuid);
}

 

0 Kudos