Page MenuHomePhabricator

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"
    }
  }
}

Event Timeline

@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.