Page MenuHomePhabricator

Support bulk editing object policies
Open, WishlistPublic

Assigned To
None
Authored By
shadowhand
Mar 25 2014, 6:19 PM
Tokens
"Mountain of Wealth" token, awarded by Kwisatz."Burninate" token, awarded by timor."Party Time" token, awarded by spawnlt."Like" token, awarded by tomekj2ee."Like" token, awarded by michaeloa.

Description

The bulk editor currently does not support adjusting object policies, so you can't use it to (for example) change the visibility of a large number of tasks.

After T10973, the bulk editor side of this is fairly easy. The UI side -- where we need to render a policy selector control dynamically in pure Javascript -- is not.

In the meantime, a possible workaround is that all modern *.edit API methods do support policy editing, so you may be able to use the API, rather than the bulk editor, to make sweeping policy changes.


Originally

The action menu in the bulk editor has no option for "Change Policy" / "Change Visibility" / etc

Event Timeline

shadowhand raised the priority of this task from to Needs Triage.
shadowhand updated the task description. (Show Details)
shadowhand added a project: Maniphest.
shadowhand added a subscriber: shadowhand.
epriestley added a subscriber: epriestley.

We should add "Change view policy" and "Change edit policy" actions here. I think these are straightforward.

I found the tricky part.... :) See D8677

Aside from being a bit of a corner / long tail case, implementing this is tricky business - see D8677. As such, putting to low priority and will circle back eventually.

In D8677, @epriestley mentioned a 5 line script to bulk adjust policies - any chance of this being made available and/or made part of the command line tools? I'm planning on making my phab install a bit more public, but would like to make most of the old tasks/revisions only visible within the core team.

You should be able to do something like this:

<?php

require_once 'scripts/__init_script__.php';

foreach (id(new LiskMigrationIterator(new ManiphestTask()) as $task) {
  $id = $task->getID();
  echo "Updating task {$id}...\n";

  $task->setViewPolicy(/* Policy Goes Here */);

  // uncomment this when satisfied with the script behavior, to persist changes
  // $task->save();
}

Drop that in phabricator/ and run it with php -f script.php.

To figure out what the policy value should be, set some task to the desired policy, then examine the row in the database: SELECT viewPolicy FROM phabricator_maniphest.maniphest_task WHERE id = 123456

<?php

require_once 'scripts/__init_script__.php';

foreach (id(new LiskMigrationIterator(new ManiphestTask())) as $task) {
  $id = $task->getID();
  echo "Updating task {$id}...\n";

  $task->setViewPolicy(/* Policy Goes Here */);

  // uncomment this when satisfied with the script behavior, to persist changes
  // $task->save();
}

Slight syntax correction, for the record.

btrahan added a subscriber: btrahan.
epriestley renamed this task from Maniphest batch editor does not allow bulk modification of visibility to Support bulk editing object policies.Jan 19 2018, 11:03 PM
epriestley lowered the priority of this task from Low to Wishlist.
epriestley updated the task description. (Show Details)
epriestley edited projects, added ApplicationEditor; removed Maniphest.