Allow EditEngine forms to be marked as "edit" forms


Allow EditEngine forms to be marked as "edit" forms

Ref T9132. Ref T9908. This attempts to move us forward on answering this question:

Which form gets used when a user clicks "Edit Task"?

One answer is "the same form that was used to create the task". There are several problems with that:

  • The form might not exist anymore.
  • The user might not have permission to see it.
  • Some of the fields might be hidden, essentially preventing them from being edited.
  • We have to store the value somewhere and old tasks won't have a value.
  • Any instructions on the form probably don't apply to edits.

One answer is "force the default, full form". That's not as problematic, but it means we have no ability to create limited access users who see fewer fields.

The answer in this diff is:

  • Forms can be marked as "edit forms".
  • We take the user to the first edit form they have permission to see, from a master list.

This allows you to create several forms like:

  • Advanced Edit Form (say, all fields -- visible to administrators).
  • Basic Edit Form (say, no policies -- visible to trusted users).
  • Noob Edit Form (say, no policies, priorities, or status -- visible to everyone).

Then you can give everyone access to "noob", some people access to "basic", and a few people access to "advanced".

This might only be part of the answer. In particular, you can still use any edit form you can see, so we could do these things in the future:

  • Give you an option to switch to a different form if you want.
  • Save the form the task was created with, and use that form by default.

If we do pursue those, we can fall back to this behavior if there's a problem with them (e.g., original form doesn't exist or wasn't recorded).

There's also no "reorder" UI yet, that'll be coming in the next diff.

I'm also going to try to probably make the "create" and "edit" stuff a little more consistent / less weird in a bit.

Test Plan: Marked various forms as edit forms or not edit forms, made edits, hit permissions errors, etc.

Reviewers: chad

Reviewed By: chad

Maniphest Tasks: T9132, T9908

Differential Revision: https://secure.phabricator.com/D14702