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

Proposed Draft Scope #24

Open
dshanske opened this issue Jan 30, 2020 · 13 comments
Open

Proposed Draft Scope #24

dshanske opened this issue Jan 30, 2020 · 13 comments

Comments

@dshanske
Copy link
Member

This is a proposal to introduce an IndieAuth scope for Micropub called 'draft'. This would grant the user permission to create posts, but not publish them. posts would only be permitted in draft mode. I'm preparing to support this to my upgrade of scope capability in the relevant WordPress plugin.

@dshanske
Copy link
Member Author

Micropub for WordPress now supports this.

@jamietanna
Copy link

To confirm, would this mean that you would only be able to create/read/update posts that are in the draft status, and if you wanted to promote them to published posts, you would need i.e. the create scope?

@dshanske
Copy link
Member Author

@jamietanna Correct. No matter what status you passed in, everything would be set by your site as draft.

@jamietanna
Copy link

And is there a way to determine whether a Micropub server supports drafts? I seem to think yes, but I can't find a reference in the issue tracker off the top of my head

@jalcine
Copy link

jalcine commented Jul 25, 2020

Will look into implementing this. Tracking ticket will be https://git.jacky.wtf/indieweb/koype/issues/212

(Originally published at: https://v2.jacky.wtf/post/d38997c4-bdc4-4fe8-8940-6d843e505a20)

@jamietanna
Copy link

I've been using a separate Micropub server and then doing some manual validation of the post, but being able to do this with draft scopes may be better - although there's then the risk that a bug in my Micropub server implementation means a draft-only client could promote to the live site

@vikanezrimaya
Copy link

@jamietanna depending on how your tests run, may be mitigated by a test case that explicitly tries to post something with a "draft" scope and asserts that it is never shown to the public.

@aaronpk
Copy link
Member

aaronpk commented Jul 26, 2020

I just implemented this on my site, it was pretty straightforward.

Screen Shot 2020-07-25 at 6 27 38 PM

Now a client can ask for draft scope, or I can change a client's request for create with draft, and then all posts that client creates will be created as drafts instead of publishing them.

My internal implementation is basically: if the scope of this token contains draft, then always create the post as a draft.

I like this because it means I can be more confident in testing out random Micropub clients and not worry about them publishing posts to my website before I've had a chance to look at them.

Apps like iA Writer which already were setting post-status=draft in the Micropub request can now opt in to this draft scope during login as well.

@barryf
Copy link

barryf commented Oct 12, 2020

Micropublish now supports an optional draft scope when logging in. Posts are submitted to the server with post-status=draft.

@jamietanna
Copy link

I've also implemented this in my Micropub server:

  • when creating a post, and the draft scope is present, the post-status is forced to draft (even if it's set otherwise in the post)
  • when updating a post, and the draft scope is present, the update is only allowed when updating a draft post, otherwise returns insufficient_scope
  • delete/undelete returns insufficient_scope when the draft scope is present

(Originally published at: https://www.jvt.me/mf2/2021/02/sswpb/)

@dshanske
Copy link
Member Author

Updated the wiki... there are now 3 implementations of this on the server side, but only one on the client side. Wondering if, since this feature can be transparently supported by the server, but the client doesn't necessarily need to know about it, per @aaronpk 's implementation, if the normal client+server for stable applies?

Either way, looking at the variances in implementation... The commonalities seem to be that if you have the draft scope, all posts are forced to draft status, even if set otherwise.

The questions come at other decisions...although this could vary in implementations, worth discussing.

What happens if you request both a create and a draft scope. @jamietanna In your implementation, are you requiring the create/update scope + the draft scope? In my original thought on the matter, you would request the draft scope in lieu of create, and it would give you the ability to create draft posts only. I didn't give thought to updating and deleting.

Should you only be able to delete/update draft posts? Again, that could be an implementation detail, but it's worth discussing.

@paulrobertlloyd
Copy link

paulrobertlloyd commented Dec 2, 2022

Indiekit now supports this.

I started with @jamietanna’s permission model, but adapted it slightly leading me to implement the following:

  • when creating a post, and the draft scope is present, the post-status is forced to draft (even if it's set otherwise in the post)
  • when updating a post, and the draft scope is present, the update is only allowed when updating a draft post, otherwise returns insufficient_scope
  • when undeleting a post, and the draft scope is present, the post-status is forced to draft
  • deleting a post is not affected by the draft scope; you can only delete posts if you have the delete scope

Thinking about the combination of draft and delete scopes made my head spin for a bit, but then I realised these are mutually exclusive; draft needn’t be read as indication regarding overall permissions. If a user should not have permission to delete files, they should not be granted the delete scope.

That said, I’ve yet to implement much UI around creating posts, and none around editing or deleting posts, so this may change as I start to build that out.

Here’s my consent screen:

Screenshot 2022-12-02 at 17 47 19

The first 3 permissions are slightly in contradiction to each other; however selecting draft scope supersedes the first 2 (if you select create and draft you would still be able update posts, but only as described above; selecting that option would make no difference in this case).

I think this is fine...ish. I could possibly progressively enhance the form such that if you select the draft scope option, the create and update scopes get checked and disabled automatically.

@gRegorLove
Copy link
Member

gRegorLove commented Apr 7, 2024

indiebookclub requests draft scope now, in v0.1.2.

The new post form lets you select post-status "published" or "draft", defaulting to "published". If you have granted draft scope, it will default to "draft" instead.

I wasn't sure if the post-status=draft option should only appear when you've granted draft scope, so currently it's always available. I noticed micropublish.net does that as well, so thought it was a safe choice. I'm open to making updates to that, though. I included the note in that release post "Your Micropub server must understand the post-status property in order to handle draft posts" to hopefully make it more clear.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

8 participants