Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Additional permissions #2739

Closed
ErisDS opened this issue May 13, 2014 · 9 comments · Fixed by #3312
Closed

Additional permissions #2739

ErisDS opened this issue May 13, 2014 · 9 comments · Fixed by #3312
Assignees
Labels
affects:api Affects the Ghost API

Comments

@ErisDS
Copy link
Member

ErisDS commented May 13, 2014

Related to #2600 and #2264:

003 needs to contain some additional permissions:

  • for mail (send, send test)
  • for tags (adding, editing, deleting)
  • for notifications (browsing, adding, deleting, and possibly fine grained reading of individual instances)

I suggest the following:

Tag

JSON API Admin Editor Author NoAuth
tag.browse y y y y
tag.read y y y y
tag.edit y y
tag.add y y y
tag.delete y y

Notification

JSON API Admin Editor Author NoAuth
notification.browse y
notification.add* y
notification.delete y

*add should probably be possible as an internal thing

Mail

JSON API Admin Editor Author NoAuth
mail.send y
mail.sendTest y
@ErisDS ErisDS added this to the 0.4 Ember.js milestone May 13, 2014
@halfdan
Copy link
Contributor

halfdan commented May 13, 2014

I am having trouble with the Notification permissions.

Once we have multi-user I think it is more than likely that apps would want to show persistent notifications (“Your article foo was published by $editor”). This would mean that notifications need to relate to a certain user. This user should then be allowed to delete the notification (so Admin + me).

Considering the “Please set up an email transport” notification on startup: A notification should only be shown for users in a certain role (in this case only for Admins) - an editor / author would not care about the notification (are they allowed to delete it though?).

I think a similar permission issue may arise with posts: Is an author allowed to delete his own posts (right now the answer is no)? What does an author do when he accidentally created a post - call an editor?

I think it would be beneficial to introduce a self permission for BREAD operations, meaning that I can execute those operations if I created the entity in question. A use-case for this might be for posts: An author cannot read posts unless they are his own.

@sebgie
Copy link
Contributor

sebgie commented May 14, 2014

I think it would be beneficial to introduce a self permission for BREAD operations, meaning that I can execute those operations if I created the entity in question.

This is already implemented and working (see #2264). An author is allowed to browse, read, edit and delete posts if author == self.

@sebgie
Copy link
Contributor

sebgie commented May 14, 2014

Additional permissions:

  • I think that tags could be allowed to be edited/deleted by the original creator? That would be the same behavior that is implemented for posts?
  • mail.send() is not only used by administrators. NoAuth needs to send emails for forgotten passwords. Maybe we need another API end point for forgotten passwords to keep it secure? Editor and Authors don't need to send emails now but I would add the permission so we could allow Apps to send emails with these roles?

@ErisDS
Copy link
Member Author

ErisDS commented May 14, 2014

I think the forgotten password email should count as an internal request?

@sebgie
Copy link
Contributor

sebgie commented May 14, 2014

I think the forgotten password email should count as an internal request?

Yeah I was thinking the same, otherwise everyone would be able to send emails from your blog. I would introduce a new mail API method (api.mail.sendPasswordReset) for that?

@halfdan
Copy link
Contributor

halfdan commented May 14, 2014

Why another API method? Can’t we reuse the existing one with { internal: true }?

@sebgie
Copy link
Contributor

sebgie commented May 14, 2014

Whatever you like best :-).

@ErisDS
Copy link
Member Author

ErisDS commented Jun 17, 2014

Also moving to MU as it is more relevant there.

@ErisDS ErisDS mentioned this issue Jul 1, 2014
26 tasks
@ErisDS ErisDS self-assigned this Jul 8, 2014
@ErisDS
Copy link
Member Author

ErisDS commented Jul 14, 2014

I made a wiki page to cover all the various permissions: https://github.com/TryGhost/Ghost/wiki/User-Roles-&-Permissions

ErisDS added a commit to ErisDS/Ghost that referenced this issue Jul 17, 2014
refs TryGhost#3283, refs TryGhost#2739, refs TryGhost#3096

- Renames permissions which didn't follow bread
- Adds permissions for notifications, mail and tags

Still todo:

- wire up the new permissions where they are needed
- add permissions for roles
ErisDS added a commit to ErisDS/Ghost that referenced this issue Jul 17, 2014
closes TryGhost#2739

- wraps the api endpoints for mail, notifications, and tags in a canThis
  check
- add internal context to internal calls
- updates tests
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
affects:api Affects the Ghost API
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants