# Retrieve group membership of current user in a workflow

**URL:** <https://forum.knime.com/t/retrieve-group-membership-of-current-user-in-a-workflow/9257>\
**Category:** KNIME Server\
**Created:** [August 24, 2017, 9:33am UTC](https://forum.knime.com/t/retrieve-group-membership-of-current-user-in-a-workflow/9257 "2017-08-24T09:33:40Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![imagejan](https://forum-cdn.knime.com/user_avatar/forum.knime.com/imagejan/32/47_2.png) [@imagejan](https://forum.knime.com/u/imagejan)\
**Post date:** [August 24, 2017, 9:33am UTC](https://forum.knime.com/t/retrieve-group-membership-of-current-user-in-a-workflow/9257/1 "2017-08-24T09:33:40Z")

</div>

Hi all,

Is it possible to retrieve the list of groups the current user belongs to, when running a workflow in the web portal?

I would like to use that folder to choose a default input folder depending on group membership.

Cheers  
Jan

&nbsp;

---

<div class="post-metadata">

**Author:** ![Iris](https://forum-cdn.knime.com/user_avatar/forum.knime.com/iris/32/14_2.png) [@Iris](https://forum.knime.com/u/Iris)\
**Post date:** [August 24, 2017, 5:30pm UTC](https://forum.knime.com/t/retrieve-group-membership-of-current-user-in-a-workflow/9257/2 "2017-08-24T17:30:20Z")

</div>

Hi Jan,

this is possible with a REST call to the server.

with .../rest/v4/admin/users you get a list of all users.&nbsp;

Which also contains the groups a user belongs to.

Cheers, Iris&nbsp;

---

<div class="post-metadata">

**Author:** ![imagejan](https://forum-cdn.knime.com/user_avatar/forum.knime.com/imagejan/32/47_2.png) [@imagejan](https://forum.knime.com/u/imagejan)\
**Post date:** [August 25, 2017, 11:37am UTC](https://forum.knime.com/t/retrieve-group-membership-of-current-user-in-a-workflow/9257/3 "2017-08-25T11:37:17Z")

</div>

Hi Iris,

thanks for your reply. Unfortunately, it doesn't help for me, as it requires admin permissions, and I would like to get the group of the currently logged in user who doesn't have admin privileges. I also tried using the GET Request node, but it doesn't seem happy if I provide a port number in the URL, such as https://server.my.domain:8443/knime/rest/v4/admin/users

What's more, this call will only give the list of locally configured users, but what I'd need is the group membership of users who authenticated via LDAP (Active Directory integration).

Jan

&nbsp;

---

<div class="post-metadata">

**Author:** ![thor](https://forum-cdn.knime.com/user_avatar/forum.knime.com/thor/32/4_2.png) [@thor](https://forum.knime.com/u/thor)\
**Post date:** [August 25, 2017, 1:59pm UTC](https://forum.knime.com/t/retrieve-group-membership-of-current-user-in-a-workflow/9257/4 "2017-08-25T13:59:36Z")

</div>

The problem is there is no API for getting all groups in which a user is member of. There is only an API to check whether a user is in a certain group. Therefore we cannot provide this information via REST or any other means. The address that Iris mentioned is indeed only for the built-in user database and accesses it directly.

---

<div class="post-metadata">

**Author:** ![imagejan](https://forum-cdn.knime.com/user_avatar/forum.knime.com/imagejan/32/47_2.png) [@imagejan](https://forum.knime.com/u/imagejan)\
**Post date:** [August 25, 2017, 2:27pm UTC](https://forum.knime.com/t/retrieve-group-membership-of-current-user-in-a-workflow/9257/5 "2017-08-25T14:27:23Z")

</div>

Thanks, @thor, for the explanation.

That makes sense, I'd also be happy with just getting the current user name to test whether they belong to a specified group. I tried with workspace credentials and with an Input Credentials Quickform node, but I can't select the credentials flow variable in the GET Request node (it is however possible in the database connector nodes, but that doesn't help me).

Do you have any advice how to get at the user name?

Thanks  
Jan

&nbsp;

---

<div class="post-metadata">

**Author:** ![thor](https://forum-cdn.knime.com/user_avatar/forum.knime.com/thor/32/4_2.png) [@thor](https://forum.knime.com/u/thor)\
**Post date:** [September 1, 2017, 9:51am UTC](https://forum.knime.com/t/retrieve-group-membership-of-current-user-in-a-workflow/9257/6 "2017-09-01T09:51:24Z")

</div>

The _Extract Context Properties_ node should give you the current user's name.

---

<div class="post-metadata">

**Author:** ![imagejan](https://forum-cdn.knime.com/user_avatar/forum.knime.com/imagejan/32/47_2.png) [@imagejan](https://forum.knime.com/u/imagejan)\
**Post date:** [September 1, 2017, 1:10pm UTC](https://forum.knime.com/t/retrieve-group-membership-of-current-user-in-a-workflow/9257/7 "2017-09-01T13:10:04Z")

</div>

Oh, great, thanks! I had missed that node so far.

Thanks, and have a nice weekend :)

Jan

&nbsp;

---

<div class="post-metadata">

**Author:** ![imagejan](https://forum-cdn.knime.com/user_avatar/forum.knime.com/imagejan/32/47_2.png) [@imagejan](https://forum.knime.com/u/imagejan)\
**Post date:** [September 28, 2018, 1:35pm UTC](https://forum.knime.com/t/retrieve-group-membership-of-current-user-in-a-workflow/9257/8 "2018-09-28T13:35:38Z")

</div>

I finally have time to get back to this topic, and still have a remaining question:

> [@thor](#):
>
> There is only an API to check whether a user is in a certain group.

How can I do this from with KNIME? Given I have a specific _group name_ (from LDAP, not in the local database) and want to check whether the current user is a member of this group, can this be done using the REST API or by querying the current context? That information must be available somehow in the web portal, since authentication and workflow permissions can be set by group, right?

---

<div class="post-metadata">

**Author:** ![thor](https://forum-cdn.knime.com/user_avatar/forum.knime.com/thor/32/4_2.png) [@thor](https://forum.knime.com/u/thor)\
**Post date:** [September 28, 2018, 2:21pm UTC](https://forum.knime.com/t/retrieve-group-membership-of-current-user-in-a-workflow/9257/9 "2018-09-28T14:21:42Z")

</div>

This only works from within the web application, not from within an executor. Technically we could expose this as a REST resource but that seems rather bizarre to me.

---

<div class="post-metadata">

**Author:** ![system](https://forum-cdn.knime.com/uploads/default/original/1X/ab3ccf34482a0329361734a18199390177204f15.png) [@system](https://forum.knime.com/u/system)\
**Post date:** [June 23, 2023, 8:27pm UTC](https://forum.knime.com/t/retrieve-group-membership-of-current-user-in-a-workflow/9257/10 "2023-06-23T20:27:15Z")

</div>


