Skip to content
This repository was archived by the owner on Apr 13, 2022. It is now read-only.
This repository was archived by the owner on Apr 13, 2022. It is now read-only.

addPermission() is undefined on the response from createContainer() #133

Open

Description

@AMWJ
  1. Call createContainer().
  2. On the promise returned, call a function with the returned data available in the parameter.

This parameter will not have a method addPermission

Activity

  1. dmitrizagidulin commented on Nov 21, 2016

    @dmitrizagidulin
    Contributor

    Hi Ariel, thanks for opening the issue!

    The current API for what you're describing (let's say, creating a container called notes and setting a "public read" permission on it) would be something like:

    client.createContainer('notes')
      .then(response => {
        return client.getPermissions(response.url)
      })
      .then(acls => {
        return acls
          .addPermission(solid.acl.EVERYONE, solid.acl.READ)
          // other .addPermission calls here
          .save()
      })
      .then(response => {
        // permissions modified.
      })

    Is your proposal here to add methods to the SolidResponse class that would enable you to call response.addPermission() directly, without having to getPermissions() beforehand?

  2. AMWJ commented on Nov 21, 2016

    @AMWJ
    Author

    @deiu indicated lacking this feature was a bug, although I may have misunderstood.

    Incidentally, I tried following the flow you described, but getPermissions didn't succeed in finding the acl files for the newly created container.

  3. dmitrizagidulin commented on Nov 21, 2016

    @dmitrizagidulin
    Contributor

    Ah, right, so, since one has just created the container, there wouldn't be a permission file for it.

    We should probably make this series of steps easier on the developer. And implement a convenience factory method, so you could do something like:

    client.createContainer('notes')
      .then(response => {
        return response.newAcl()
          .addPermission(solid.acl.EVERYONE, solid.acl.READ)
          // other .addPermission calls here
          .save()
      })
      .then(response => {
        // permissions modified.
      })
  4. dmitrizagidulin commented on Nov 22, 2016

    @dmitrizagidulin
    Contributor

    OK, so this depends on PR #129 being merged. Stand by.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions