create conduit method for the creation of phabricator policy objects
Closed, ResolvedPublic

Description

@bd808: I can deploy newer upstream code for you.

That would be great to keep the proof of concept work moving forward.

With regard to policies, I've had considerable experience working with those. I can help write a custom conduit method that will generate the exact policy you need and return the phid for use with the repository edit api.

Is the content of the policy straightforward? I imagine it would be something like:

{
  "projects": "#repository-admins",
  "users": ["list", "usernames"]
}

Something straightforward like that isn't difficult at all to write.

That would also be most excellent. When the web gui is used the sort of policy I'm imagining looks a bit like this in the POST to Phab:

{
  "default": "deny",
  "rules": [
    {
      "action":"allow",
      "rule":"PhabricatorProjectsPolicyRule",
      "value":[
        "PHID-PROJ-74bt3nlwd4hl2ofmw77h"
      ]
    },
    {
      "action":"allow",
      "rule":"PhabricatorUsersPolicyRule",
      "value":[
        "PHID-USER-wzvm7msgcojlqmymu3vc",
        "PHID-USER-sikaw4dhyejwbfg2wujb"
      ]
    }
  ]
}

It's easy enough to look up the phids for things from their symbolic names.

And the response looks like:

{
  "error":null,
  "payload":{
    "phid":"PHID-PLCY-nsfusm6s3fmvw55ytam6",
    "info":{
      "name":"Custom Policy",
      "full":"Custom Policy",
      "icon":"fa-certificate"
    }
  }
}

Revisions and Commits

rPHEX phabricator-extensions
Restricted Differential Revision

Event Timeline

mmodell added a revision: Restricted Differential Revision.May 20 2016, 8:52 PM
bd808 added a revision: Restricted Differential Revision.May 25 2016, 2:56 AM

@bd808: is the current implementation satisfactory? Should this task be resolved?

@bd808: is the current implementation satisfactory? Should this task be resolved?

Yeah. It's working well. If I find an edge case I'll open a new bug about it. Thanks for your help on this.

The Cloud-Services project tag is not intended to have any tasks. Please check the list on https://phabricator.wikimedia.org/project/profile/832/ and replace it with a more specific project tag to this task. Thanks!