# \[Widget\] Menu based on group permission

**URL:** <https://meta.discourse.org/t/widget-menu-based-on-group-permission/91997>\
**Category:** Development\
**Created:** [July 10, 2018, 4:15pm UTC](https://meta.discourse.org/t/widget-menu-based-on-group-permission/91997 "2018-07-10T16:15:20Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![Falco](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/falco/32/179432_2.png) [@Falco](https://meta.discourse.org/u/Falco)\
**Post date:** [July 10, 2018, 4:51pm UTC](https://meta.discourse.org/t/widget-menu-based-on-group-permission/91997/2 "2018-07-10T16:51:43Z")

</div>

```plaintext
<script type="text/discourse-plugin" version="0.8">

    var u = api.getCurrentUser();

    if (u !== null) {
        u.findDetails().then(function (u) {
            if (u.groups.some(function (g) {
                return g.name === 'MyGroupName';
            })) {
                // User is member of the group
            }
        });
    }
</script>

```

This will incur in an extra network request for `.findDetails` but works.

---

_[View the full topic](https://meta.discourse.org/t/widget-menu-based-on-group-permission/91997)._
