cancel
Showing results for 
Search instead for 
Did you mean: 

ITK function to find default group of member

Creator
Creator

Hello,

 

Given a User_ID, I need to find the default group/Role object of the user.

 

First I try to get the user_tag , then from the user_tag I get groupmember information of the user.

For instance User_ID "Jonh_C" is a member of Development/Tester (Group/Role) and also a member of Management/Consultant and the user "John_C" has Default Group: Management.

So the ITK function SA_find_groupmember_by_user() returns 2 member_tags for User "John_C". Now I want to know which one of these tags has as group the default group. Which ITK function is available for that?

Thank you very much for helping.

 

const char *id = "tester";
tag_t user_tag = NULLTAG;
int num_of_members = 0;
tag_t *member_tags;

SA_find_user2(id, &user_tag);
SA_find_groupmember_by_user(user_tag, &num_of_members, &member_tags);

MEM_free(member_tags);

t

 

5 REPLIES

Re: ITK function to find default group of member

Solution Partner Phenom Solution Partner Phenom
Solution Partner Phenom

Hi,

 

SA_ask_user_login_group should give the default group for a valid user_tag.

 

Let us know if it works

 

Harish

Re: ITK function to find default group of member

Creator
Creator

Hi Harish,

 

SA_ask_user_login_group() returns the default group tag for a given user tag. From these 2 tags(User tag and defaultGroup tag) how can I find the groupmember tag?

For instance, I have user '0027' and the latter has default group 'Development'. From the user_id '0027' how do I get the GroupMember tag

 

User.png

 

Thank you.

Re: ITK function to find default group of member

Solution Partner Phenom Solution Partner Phenom
Solution Partner Phenom

Hi,

 

I think with user_tag you can identify groupmembers.

 

Let me double check my understanding. For a user, you are looking to identify:

- default group and

- groupmembers referencing the user

 

 

Harish

 

 

 

Re: ITK function to find default group of member

Creator
Creator

Hi,

 

Yes from the user_tag I can get the groupmembers tag by doing the following:

 

SA_find_user2(id, &user_tag);

SA_find_groupmember_by_user(user_tag, &num_of_members, &member_tags);

 

When a user is a groupmember of more than 1 group, the member_tags points to the array of tags and I want to identify the member_tag for the default group.

Thanks for helping.

Re: ITK function to find default group of member

Creator
Creator

Hello,

 

I found a way to get the default group of a member.

 

For instance User_ID "Jonh_C" is a member of Development/Tester (Group/Role) and also a member of Management/Consultant and the user "John_C" has Default Group: Management.

 

SA_find_user2(id, &user_tag);
SA_ask_user_login_group(user_tag, &default_group_tag); //Get default group of user

SA_find_groupmember_by_user(user_tag, &num_of_members, &member_tags); // Returns a list of groupmembers for the user

tag_t group_tag = NULLTAG, default_member_tag = NULLTAG;
for(int j=0; j<num_of_members; j++)
{
        SA_ask_groupmember_group(member_tags[j], &group_tag);
	if (default_group_tag == group_tag)
        {
		default_member_tag = member_tags[j];
		break;
	}
}