# Access category/group permission in javascript

**URL:** https://meta.discourse.org/t/access-category-group-permission-in-javascript/199603
**Category:** Development
**Created:** [August 7, 2021, 4:58pm UTC](https://meta.discourse.org/t/access-category-group-permission-in-javascript/199603 "2021-08-07T16:58:30Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![oca](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/oca/32/156060_2.png) [@oca](https://meta.discourse.org/u/oca)
#### Post date: [August 7, 2021, 4:58pm UTC](https://meta.discourse.org/t/access-category-group-permission-in-javascript/199603/1 "2021-08-07T16:58:30Z")

</div>

Dear all,

I’m trying to make a component that would display in the category banner what are the groups that can read this category.

I’m imagining something like that:

```js
for (g of groups) {
    if (g.permission(category) > 0) {
       display(g);
    }
}

```

In order to do that, and by looking at other people’s code, I found out how to access the variable `category`, which was easy:

```js
const container = Discourse. __container__ ;
const controller = container.lookup('controller:navigation/category');
category = controller.get("category");

```

I’ve found out a way to access the group list:

```js
const container = Discourse. __container__ ;
const controller = container.lookup('controller:navigation/category');
groups = controller.get("site").get("groups");

```

But I can’t find a way to check compute/deduce if a group can access a category.  
`category.permission` does not give this information and each `group` has only 5 properties: the flair infos, the name and the id.

Can anyone give me a hint where I can read the information so that I can check for each group if it can access the category?

Thanks in advance.
