public static int GetUserGroup(int userID, string GroupID) { int inGroup = 0; string UsersGroups = ""; if (userID != 0) { Ektron.Cms.API.Common CommonApi = new Ektron.Cms.API.Common(); Ektron.Cms.API.User.User UserAPI = new Ektron.Cms.API.User.User(); Ektron.Cms.GroupData GroupData = new Ektron.Cms.GroupData(); //Number of Provider(" + System.Convert.ToString(UserAPI.GetUserGroupByName("<GROUP NAME>").GroupId) + ") Users: " + System.Convert.ToString(UserAPI.GetUserGroupByName("<GROUP NAME>").UserCount); Ektron.Cms.GroupData[] gData = UserAPI.GetGroupsUserIsIn(UserAPI.UserId, "GroupID"); foreach (Ektron.Cms.GroupData g in gData) { UsersGroups += g.GroupId + "',"; } string[] strGroupIDs = UsersGroups.Split(','); foreach (string strGroupID in strGroupIDs) { if (GroupID == strGroupID) { inGroup = 1; } if (strGroupID == "1") { inGroup = 2; } } } return inGroup; }
Last Updated on October 26, 2015