כיצד לקבוע הרשאות פרסום קטגוריה מתבניות תוספים

סיכום מבוסס בינה מלאכותית

In a discussion about determining category posting permissions from plugin templates, Connor_Parrish seeks a way to conditionally render a custom “Reply” button based on category-specific requirements (e.g., TL3). They note that while topic.details.can_create_post works for topic replies, no equivalent exists for category-level permissions. osioke suggests reviewing existing plugins that handle category permissions, though none are immediately known. Connor_Parrish reports no success finding relevant examples and references a Discourse source snippet using category.permissions.@each.permission_type, but doubts plugin-outlets have access to it. In post 4, they mention that only topic.category.permission is exposed — returning 1 if posting a new topic is allowed, or null otherwise — which doesn’t address reply permissions within a category. The thread remains unresolved, highlighting a gap in plugin API access for granular category permission checks.

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

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");
  },

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.