How to determine Category posting permissions from plugin templates

I’m aware you’re able to use topic.details.can_create_post to determine if a user can create a reply. It is used in the handlebars templates to determine if the “Reply” button is rendered.

I’m trying to determine the category permissions. For example, I want to avoid rendering my modified “Reply” button if the category requires TL3 to post replies.

I couldn’t find anything relating to this use case in howto

1 Like

Have you tried looking at prior art? Maybe look through the code of a plugin that leverages category permissions to work to see how it has been implemented.

No, I don’t know any plugins like that off the top of my head.

I haven’t found anything from what I can tell.

I did find this bit of code looking at the Discourse source, but I don’t think that the plugin-outlet I’m using has access to category.permissions.@each.permission_type
(In edit-category-security.js)

@discourseComputed("category.permissions.@each.permission_type")
  everyonePermission(permissions) {
    return permissions.findBy("group_name", "everyone");
  },
1 Like

The only exposed thing I’ve found so far is topic.category.permission which appears to either be 1 if you can post a New Topic, or null if you cannot.

1 Like