home / github

Menu
  • Search all tables
  • GraphQL API

issue_comments

Table actions
  • GraphQL API for issue_comments

7 rows where issue = 1175648453 and user = 9599 sorted by updated_at descending

✖
✖
✖

✎ View and edit SQL

This data as json, CSV (advanced)

Suggested facets: created_at (date), updated_at (date)

user 1

  • simonw · 7 ✖

issue 1

  • Extract out `check_permissions()` from `BaseView · 7 ✖

author_association 1

  • OWNER 7
id html_url issue_url node_id user created_at updated_at ▲ author_association body reactions issue performed_via_github_app
1074177827 https://github.com/simonw/datasette/issues/1675#issuecomment-1074177827 https://api.github.com/repos/simonw/datasette/issues/1675 IC_kwDOBm6k_c5ABqcj simonw 9599 2022-03-21T17:14:31Z 2022-03-21T17:14:31Z OWNER

Updated documentation: https://github.com/simonw/datasette/blob/e627510b760198ccedba9e5af47a771e847785c9/docs/internals.rst#await-ensure_permissionsactor-permissions

This method allows multiple permissions to be checked at onced. It raises a datasette.Forbidden exception if any of the checks are denied before one of them is explicitly granted.

This is useful when you need to check multiple permissions at once. For example, an actor should be able to view a table if either one of the following checks returns True or not a single one of them returns False:

That's pretty hard to understand! I'm going to open a separate issue to reconsider if this is a useful enough abstraction given how confusing it is.

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
Extract out `check_permissions()` from `BaseView 1175648453  
1074161523 https://github.com/simonw/datasette/issues/1675#issuecomment-1074161523 https://api.github.com/repos/simonw/datasette/issues/1675 IC_kwDOBm6k_c5ABmdz simonw 9599 2022-03-21T16:59:55Z 2022-03-21T17:00:03Z OWNER

Also calling that function permissions_allowed() is confusing because there is a plugin hook with a similar name already: https://docs.datasette.io/en/stable/plugin_hooks.html#permission-allowed-datasette-actor-action-resource

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
Extract out `check_permissions()` from `BaseView 1175648453  
1074158890 https://github.com/simonw/datasette/issues/1675#issuecomment-1074158890 https://api.github.com/repos/simonw/datasette/issues/1675 IC_kwDOBm6k_c5ABl0q simonw 9599 2022-03-21T16:57:15Z 2022-03-21T16:57:15Z OWNER

Idea: ds.permission_allowed() continues to just return True or False.

A new ds.ensure_permissions(...) method is added which raises a Forbidden exception if a check fails (hence the different name)`.

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
Extract out `check_permissions()` from `BaseView 1175648453  
1074156779 https://github.com/simonw/datasette/issues/1675#issuecomment-1074156779 https://api.github.com/repos/simonw/datasette/issues/1675 IC_kwDOBm6k_c5ABlTr simonw 9599 2022-03-21T16:55:08Z 2022-03-21T16:56:02Z OWNER

One benefit of the current design of check_permissions that raises an exception is that the exception includes information on WHICH of the permission checks failed. Returning just True or False loses that information.

I could return an object which evaluates to False but also carries extra information? Bit weird, I've never seen anything like that in other Python code.

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
Extract out `check_permissions()` from `BaseView 1175648453  
1074143209 https://github.com/simonw/datasette/issues/1675#issuecomment-1074143209 https://api.github.com/repos/simonw/datasette/issues/1675 IC_kwDOBm6k_c5ABh_p simonw 9599 2022-03-21T16:46:05Z 2022-03-21T16:46:05Z OWNER

The other difference though is that ds.permission_allowed(...) works against an actor, while check_permission() works against a request (though just to access request.actor).

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
Extract out `check_permissions()` from `BaseView 1175648453  
1074142617 https://github.com/simonw/datasette/issues/1675#issuecomment-1074142617 https://api.github.com/repos/simonw/datasette/issues/1675 IC_kwDOBm6k_c5ABh2Z simonw 9599 2022-03-21T16:45:27Z 2022-03-21T16:45:27Z OWNER

Though at that point check_permission is such a light wrapper around self.ds.permission_allowed() that there's little point in it existing at all.

So maybe check_permisions() becomes ds.permissions_allowed().

permission_allowed() v.s. permissions_allowed() is a bit of a subtle naming difference, but I think it works.

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
Extract out `check_permissions()` from `BaseView 1175648453  
1074141457 https://github.com/simonw/datasette/issues/1675#issuecomment-1074141457 https://api.github.com/repos/simonw/datasette/issues/1675 IC_kwDOBm6k_c5ABhkR simonw 9599 2022-03-21T16:44:09Z 2022-03-21T16:44:09Z OWNER

A slightly odd thing about these methods is that they either fail silently or they raise a Forbidden exception.

Maybe they should instead return True or False and the calling code could decide if it wants to raise the exception? That would make them more usable and a little less surprising.

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
Extract out `check_permissions()` from `BaseView 1175648453  

Advanced export

JSON shape: default, array, newline-delimited, object

CSV options:

CREATE TABLE [issue_comments] (
   [html_url] TEXT,
   [issue_url] TEXT,
   [id] INTEGER PRIMARY KEY,
   [node_id] TEXT,
   [user] INTEGER REFERENCES [users]([id]),
   [created_at] TEXT,
   [updated_at] TEXT,
   [author_association] TEXT,
   [body] TEXT,
   [reactions] TEXT,
   [issue] INTEGER REFERENCES [issues]([id])
, [performed_via_github_app] TEXT);
CREATE INDEX [idx_issue_comments_issue]
                ON [issue_comments] ([issue]);
CREATE INDEX [idx_issue_comments_user]
                ON [issue_comments] ([user]);
Powered by Datasette · Queries took 1022.251ms · About: github-to-sqlite
  • Sort ascending
  • Sort descending
  • Facet by this
  • Hide this column
  • Show all columns
  • Show not-blank rows