7

This question is a spinoff of my other question.

I think I already know the answer to this, but in case I missed it. Is there a way through the FogBugz plug-in API to access the members of a particular permissions group?

If not, may I suggest it for a future version of the API?

Fog Creek Case FC2040149

flag

2 Answers

2

Upvoted, since I would indeed like to see this in the public API. For the benefit of others needing this information, it is located in the PermissionGroup and PermissionGroupMembership tables. The database schema is documented at http://fogbugz.stackexchange.com/fogbugz-database-schema.

Remember, if you're going to query these tables directly, you're query will need IgnorePermissions set to true.

Example of getting available groups:


public System.Data.DataSet listGroups (CPluginApi api) {
    CSelectQuery groupQuery = api.Database.NewSelectQuery("PermissionGroup");
    groupQuery.IgnorePermissions = true;
    System.Data.DataSet groupDataSet = groupQuery.GetDataSet();
    return groupDataSet;
}

And getting the members of a group:


public System.Data.DataSet listGroupMembers (CPluginApi, ixPermissionGroup) {
    CSelectQuery groupMemberQuery = api.Database.NewSelectQuery("PermissionGroupMember");
    groupMemberQuery.AddWhere("ixPermissionGroup=@ixPermissionGroup");
    groupMemberQuery.SetParam("@ixPermissionGroup", ixPermissionGroup);
    groupMemberQuery.IgnorePermissions = true;
    System.Data.DataSet groupMemberDataSet = groupMemberQuery.GetDataSet();
    return groupDataSet;
}

Of course, if you want the names of the members, or want to query by the name of the group, then you'll want to do the appropriate joins and / or use the CPersonApi to get the name and details of the group member.

link|flag
2

We have a case open to consider this feature for a future release. Please up-vote this question (not this answer) to show your support for adding this feature.

link|flag

Your Answer

Not the answer you're looking for? Browse other questions tagged or ask your own question.