hemanthray-gmail
-
8/26/2010 4:27:55 PM
Create a Group and add a User to it
I am trying to Create a group in kentico programmatically and a User to it. Here is the code i am Using but it doesn't add a Group into Kentico . Please correct if I am wrong
gi = new GroupInfo();
// Set properties
gi.GroupDisplayName = "New group2";
gi.GroupName = "NewGroup2";
gi.GroupSiteID = 2;
gi.GroupDescription = "";
gi.GroupApproveMembers = GroupApproveMembersEnum.AnyoneCanJoin;
gi.GroupAccess = SecurityAccessEnum.AllUsers;
gi.GroupApproved = true;
// gi.GroupApprovedByUserID = CurrentUser.UserID;
// gi.GroupCreatedByUserID = CurrentUser.UserID;
gi.AllowCreate = SecurityAccessEnum.GroupMembers;
gi.AllowDelete = SecurityAccessEnum.GroupMembers;
gi.AllowModify = SecurityAccessEnum.GroupMembers;
gi.GroupNodeGUID = Guid.Empty;
// Save object to database
GroupInfoProvider.SetGroupInfo(gi); gi = GroupInfoProvider.GetGroupInfo("NewGroup2", CMS.CMSHelper.CMSContext.CurrentSite.SiteName);
if (gi != null) { addUserToGrp(userAuth, gi.GroupID); }
Thanks A
|