//Role Groups public abstract int CreateRoleGroup(RoleGroupInfo roleGroup);
public abstract void UpdateRoleGroup(RoleGroupInfo roleGroup);
/// ----------------------------------------------------------------------------- /// <summary> /// Update a RoleGroup /// </summary> /// <param name="roleGroup">The RoleGroup to update</param> /// <history> /// [cnurse] 03/28/2006 created /// [jlucarino] 02/26/2009 added LastModifiedByUserID parameter /// </history> /// ----------------------------------------------------------------------------- public override void UpdateRoleGroup(RoleGroupInfo roleGroup) { dataProvider.UpdateRoleGroup(roleGroup.RoleGroupID, roleGroup.RoleGroupName, roleGroup.Description, UserController.Instance.GetCurrentUserInfo().UserID); ClearRoleGroupCache(roleGroup.PortalID); }
public HttpResponseMessage EditRoleGroup(NewRoleGroupDTO roleGroupName) { try { DotNetNuke.Security.Roles.RoleController oDnnRoleController = new DotNetNuke.Security.Roles.RoleController(); RoleGroupInfo oRoleGroup = new RoleGroupInfo(); oRoleGroup.PortalID = this.PortalSettings.PortalId; oRoleGroup.RoleGroupName = "DVC_" + roleGroupName.Name; oRoleGroup.RoleGroupID = roleGroupName.RoleGroupID; oRoleGroup.Description = ""; if (oRoleGroup.RoleGroupID == -1) { DotNetNuke.Security.Roles.RoleController.AddRoleGroup(oRoleGroup); } else { DotNetNuke.Security.Roles.RoleController.UpdateRoleGroup(oRoleGroup); } return Request.CreateResponse(HttpStatusCode.OK); } catch (Exception exc) { Exceptions.LogException(exc); return Request.CreateErrorResponse(HttpStatusCode.InternalServerError, exc); } }
/// <summary> /// Update a RoleGroup /// </summary> /// <param name="roleGroup">The RoleGroup to update</param> /// <history> /// [cnurse] 03/28/2006 created /// </history> public override void UpdateRoleGroup( RoleGroupInfo roleGroup ) { dataProvider.UpdateRoleGroup( roleGroup.RoleGroupID, roleGroup.RoleGroupName, roleGroup.Description ); }
/// ----------------------------------------------------------------------------- /// <summary> /// Deletes a Role Group. /// </summary> /// <param name="objRoleGroupInfo">The RoleGroup to Delete.</param> /// ----------------------------------------------------------------------------- public static void DeleteRoleGroup(RoleGroupInfo objRoleGroupInfo) { provider.DeleteRoleGroup(objRoleGroupInfo); EventLogController.Instance.AddLog(objRoleGroupInfo, PortalController.Instance.GetCurrentPortalSettings(), UserController.Instance.GetCurrentUserInfo().UserID, string.Empty, EventLogController.EventLogType.USER_ROLE_DELETED); }
/// <summary> /// Adds a Role Group /// </summary> /// <param name="objRoleGroupInfo">The RoleGroup to Add</param> /// <returns>The Id of the new role</returns> public static int AddRoleGroup(RoleGroupInfo objRoleGroupInfo) { return(provider.CreateRoleGroup(objRoleGroupInfo)); }
/// ----------------------------------------------------------------------------- /// <summary> /// cmdUpdate_Click runs when the update Button is clicked /// </summary> /// <remarks> /// </remarks> /// <history> /// [cnurse] 9/10/2004 Updated to reflect design changes for Help, 508 support /// and localisation /// [jlucarino] 2/26/2009 Added CreatedByUserID and LastModifiedByUserID /// </history> /// ----------------------------------------------------------------------------- private void cmdUpdate_Click(object sender, EventArgs e) { try { if (Page.IsValid) { var objRoleGroupInfo = new RoleGroupInfo(); objRoleGroupInfo.PortalID = PortalId; objRoleGroupInfo.RoleGroupID = RoleGroupID; objRoleGroupInfo.RoleGroupName = txtRoleGroupName.Text; objRoleGroupInfo.Description = txtDescription.Text; if (RoleGroupID == -1) { try { RoleController.AddRoleGroup(objRoleGroupInfo); } catch { UI.Skins.Skin.AddModuleMessage(this, Localization.GetString("DuplicateRoleGroup", LocalResourceFile), ModuleMessage.ModuleMessageType.RedError); return; } Response.Redirect(Globals.NavigateURL(TabId, "")); } else { RoleController.UpdateRoleGroup(objRoleGroupInfo); Response.Redirect(Globals.NavigateURL(TabId, "", "RoleGroupID=" + RoleGroupID)); } } } catch (Exception exc) //Module failed to load { Exceptions.ProcessModuleLoadException(this, exc); } }
/// <summary> /// Deletes a Role Group /// </summary> /// <param name="objRoleGroupInfo">The RoleGroup to Delete</param> public static void DeleteRoleGroup(RoleGroupInfo objRoleGroupInfo) { provider.DeleteRoleGroup(objRoleGroupInfo); }
/// <summary> /// Updates a Role Group /// </summary> /// <param name="objRoleGroupInfo">The RoleGroup to Update</param> public static void UpdateRoleGroup(RoleGroupInfo objRoleGroupInfo) { provider.UpdateRoleGroup(objRoleGroupInfo); }
/// <summary> /// Adds a Role Group /// </summary> /// <param name="objRoleGroupInfo">The RoleGroup to Add</param> /// <returns>The Id of the new role</returns> public static int AddRoleGroup(RoleGroupInfo objRoleGroupInfo) { return provider.CreateRoleGroup(objRoleGroupInfo); }
public abstract void DeleteRoleGroup( RoleGroupInfo roleGroup );
/// ----------------------------------------------------------------------------- /// <summary> /// Adds a Role Group /// </summary> /// <param name="objRoleGroupInfo">The RoleGroup to Add</param> /// <returns>The Id of the new role</returns> /// <history> /// [cnurse] 01/03/2006 Created /// </history> /// ----------------------------------------------------------------------------- public static int AddRoleGroup(RoleGroupInfo objRoleGroupInfo) { EventLogController.Instance.AddLog(objRoleGroupInfo, PortalController.Instance.GetCurrentPortalSettings(), UserController.Instance.GetCurrentUserInfo().UserID, "", EventLogController.EventLogType.USER_ROLE_CREATED); return(provider.CreateRoleGroup(objRoleGroupInfo)); }
/// ----------------------------------------------------------------------------- /// <summary> /// CreateRoleGroup persists a RoleGroup to the Data Store /// </summary> /// <remarks> /// </remarks> /// <param name="roleGroup">The RoleGroup to persist to the Data Store.</param> /// <returns>The Id of the new role.</returns> /// <history> /// [cnurse] 03/28/2006 created /// [jlucarino] 02/26/2009 added CreatedByUserID parameter /// </history> /// ----------------------------------------------------------------------------- public override int CreateRoleGroup(RoleGroupInfo roleGroup) { var roleGroupId = dataProvider.AddRoleGroup(roleGroup.PortalID, roleGroup.RoleGroupName, roleGroup.Description, UserController.GetCurrentUserInfo().UserID); ClearRoleGroupCache(roleGroup.PortalID); return roleGroupId; }
/// ----------------------------------------------------------------------------- /// <summary> /// DeleteRoleGroup deletes a RoleGroup from the Data Store /// </summary> /// <param name="roleGroup">The RoleGroup to delete from the Data Store.</param> /// <history> /// [cnurse] 03/28/2006 created /// </history> /// ----------------------------------------------------------------------------- public override void DeleteRoleGroup(RoleGroupInfo roleGroup) { dataProvider.DeleteRoleGroup(roleGroup.RoleGroupID); }
/// ----------------------------------------------------------------------------- /// <summary> /// CreateRoleGroup persists a RoleGroup to the Data Store /// </summary> /// <remarks> /// </remarks> /// <param name="roleGroup">The RoleGroup to persist to the Data Store.</param> /// <returns>The Id of the new role.</returns> /// <history> /// [cnurse] 03/28/2006 created /// [jlucarino] 02/26/2009 added CreatedByUserID parameter /// </history> /// ----------------------------------------------------------------------------- public override int CreateRoleGroup(RoleGroupInfo roleGroup) { return(Convert.ToInt32(dataProvider.AddRoleGroup(roleGroup.PortalID, roleGroup.RoleGroupName, roleGroup.Description, UserController.GetCurrentUserInfo().UserID))); }
/// ----------------------------------------------------------------------------- /// <summary> /// Update a RoleGroup. /// </summary> /// <param name="roleGroup">The RoleGroup to update.</param> /// ----------------------------------------------------------------------------- public override void UpdateRoleGroup(RoleGroupInfo roleGroup) { this.dataProvider.UpdateRoleGroup(roleGroup.RoleGroupID, roleGroup.RoleGroupName.Trim(), (roleGroup.Description ?? string.Empty).Trim(), UserController.Instance.GetCurrentUserInfo().UserID); this.ClearRoleGroupCache(roleGroup.PortalID); }
public void btGo_Click(object sender, EventArgs e) { //Setup Child Page - Main View/Activity TabInfo tab = CreatePage(PortalSettings.ActiveTab, PortalId, TabId, "Group Activity", false); //Add Module to Child Page int groupViewModuleId = AddModule(tab, PortalId, "Social Groups", "ContentPane"); int journalModuleId = AddModule(tab, PortalId, "Journal", "ContentPane"); int consoleId = AddModule(tab, PortalId, "Console", "RightPane"); var mc = new ModuleController(); ModuleInfo groupConsoleModule = mc.GetModule(consoleId, tab.TabID); TabInfo memberTab = CreatePage(PortalSettings.ActiveTab, PortalId, tab.TabID, "Members", false); mc.CopyModule(groupConsoleModule, memberTab, "RightPane", true); ModuleInfo groupViewModule = mc.GetModule(groupViewModuleId, tab.TabID); mc.CopyModule(groupViewModule, memberTab, "ContentPane", true); AddModule(memberTab, PortalId, "DotNetNuke.Modules.MemberDirectory", "ContentPane"); //List Settings var modules = new ModuleController(); modules.UpdateTabModuleSetting(TabModuleId, Constants.GroupLoadView, GroupMode.List.ToString()); modules.UpdateTabModuleSetting(TabModuleId, Constants.GroupViewPage, tab.TabID.ToString(CultureInfo.InvariantCulture)); //Default Social Groups var defaultGroup = RoleController.GetRoleGroupByName(PortalId, Constants.DefaultGroupName); var groupId = -2; if (defaultGroup != null) { groupId = defaultGroup.RoleGroupID; } else { var groupInfo = new RoleGroupInfo(); groupInfo.PortalID = PortalId; groupInfo.RoleGroupName = Constants.DefaultGroupName; groupInfo.Description = Constants.DefaultGroupName; groupId = RoleController.AddRoleGroup(groupInfo); } modules.UpdateTabModuleSetting(TabModuleId, Constants.DefaultRoleGroupSetting, groupId.ToString()); Response.Redirect(Request.RawUrl); }
/// ----------------------------------------------------------------------------- /// <summary> /// Update a RoleGroup /// </summary> /// <param name="roleGroup">The RoleGroup to update</param> /// <history> /// [cnurse] 03/28/2006 created /// [jlucarino] 02/26/2009 added LastModifiedByUserID parameter /// </history> /// ----------------------------------------------------------------------------- public override void UpdateRoleGroup(RoleGroupInfo roleGroup) { dataProvider.UpdateRoleGroup(roleGroup.RoleGroupID, roleGroup.RoleGroupName, roleGroup.Description, UserController.GetCurrentUserInfo().UserID); }
/// ----------------------------------------------------------------------------- /// <summary> /// Updates a Role Group /// </summary> /// <param name="roleGroup">The RoleGroup to Update</param> /// <history> /// [cnurse] 01/03/2006 Created /// </history> /// ----------------------------------------------------------------------------- public static void UpdateRoleGroup(RoleGroupInfo roleGroup) { UpdateRoleGroup(roleGroup, false); }
/// ----------------------------------------------------------------------------- /// <summary> /// Adds a Role Group /// </summary> /// <param name="objRoleGroupInfo">The RoleGroup to Add</param> /// <returns>The Id of the new role</returns> /// <history> /// [cnurse] 01/03/2006 Created /// </history> /// ----------------------------------------------------------------------------- public static int AddRoleGroup(RoleGroupInfo objRoleGroupInfo) { var objEventLog = new EventLogController(); objEventLog.AddLog(objRoleGroupInfo, PortalController.GetCurrentPortalSettings(), UserController.GetCurrentUserInfo().UserID, "", EventLogController.EventLogType.USER_ROLE_CREATED); return provider.CreateRoleGroup(objRoleGroupInfo); }
public HttpResponseMessage GetAllGroups() { try { var portalId = PortalSettings.PortalId; var filteredRoleGroups = string.Empty; int loginStatus = 1; if (UserInfo == null || (UserInfo != null && UserInfo.UserID < 1)) { loginStatus = 0; // you can only get information if you're logged in Exceptions.LogException(new AccessViolationException("Unauthorized attempt to access GetAllGroups API end point")); // return 404 error simply to discourage hacking return Request.CreateResponse(HttpStatusCode.OK, loginStatus); } // get all role groups var roleGroups = Controllers.RoleController.GetRoleGroups(portalId); if (UserInfo.IsInRole(PortalSettings.AdministratorRoleName) || UserInfo.IsSuperUser) { // return ALL role groups filteredRoleGroups = roleGroups.ToJson(); } else { // get a listing of the unique role group IDs var roleGroupIds = roleGroups.Select(g => g.RoleGroupID).ToList(); var userRoles = Controllers.RoleController.GetUserRoles(UserInfo); // filter the role groups by only those that have a matching role for the user var filteredRoleGroupIds = userRoles.Where(r => roleGroupIds.Contains(r.RoleGroupID)).Select(r => r.RoleGroupID).ToList(); // return only the role groups that the user is a part of var uncleanRoleGroups = roleGroups.Where(g => filteredRoleGroupIds.Contains(g.RoleGroupID)); // remove any roles that the user is not a part of, and system roles var roleGroupsToReturn = new List<RoleGroupInfo>(); foreach (var group in uncleanRoleGroups.ToList()) { var newGroup = new RoleGroupInfo(); newGroup = group; foreach (var role in newGroup.Roles.ToList()) { var roleInfo = (RoleInfo) role.Value; if (roleInfo.IsSystemRole || !UserInfo.IsInRole(roleInfo.RoleName) || roleInfo.Status.ToString() == "Disabled") { newGroup.Roles.Remove(role.Key); } } roleGroupsToReturn.Add(newGroup); } filteredRoleGroups = roleGroupsToReturn.ToJson(); } return Request.CreateResponse(HttpStatusCode.OK, filteredRoleGroups); } catch (Exception exc) { Exceptions.LogException(exc); return Request.CreateErrorResponse(HttpStatusCode.InternalServerError, exc); } }
/// ----------------------------------------------------------------------------- /// <summary> /// Deletes a Role Group /// </summary> /// <param name="objRoleGroupInfo">The RoleGroup to Delete</param> /// <history> /// [cnurse] 01/03/2006 Created /// </history> /// ----------------------------------------------------------------------------- public static void DeleteRoleGroup(RoleGroupInfo objRoleGroupInfo) { provider.DeleteRoleGroup(objRoleGroupInfo); var objEventLog = new EventLogController(); objEventLog.AddLog(objRoleGroupInfo, PortalController.GetCurrentPortalSettings(), UserController.GetCurrentUserInfo().UserID, "", EventLogController.EventLogType.USER_ROLE_DELETED); }
public abstract void DeleteRoleGroup(RoleGroupInfo roleGroup);
/// ----------------------------------------------------------------------------- /// <summary> /// Serializes the role groups /// </summary> /// <param name="writer">An XmlWriter</param> /// <param name="portalID">The Id of the Portal</param> /// <history> /// [cnurse] 03/18/2008 Created /// </history> /// ----------------------------------------------------------------------------- public static void SerializeRoleGroups(XmlWriter writer, int portalID) { //Serialize Role Groups writer.WriteStartElement("rolegroups"); foreach (RoleGroupInfo objRoleGroup in GetRoleGroups(portalID)) { CBO.SerializeObject(objRoleGroup, writer); } //Serialize Global Roles var globalRoleGroup = new RoleGroupInfo(Null.NullInteger, portalID, true) { RoleGroupName = "GlobalRoles", Description = "A dummy role group that represents the Global roles" }; CBO.SerializeObject(globalRoleGroup, writer); writer.WriteEndElement(); }
//Role Groups public abstract int CreateRoleGroup( RoleGroupInfo roleGroup );
public abstract void UpdateRoleGroup( RoleGroupInfo roleGroup );
public static void UpdateRoleGroup(RoleGroupInfo roleGroup, bool includeRoles) { provider.UpdateRoleGroup(roleGroup); var objEventLog = new EventLogController(); objEventLog.AddLog(roleGroup, PortalController.GetCurrentPortalSettings(), UserController.GetCurrentUserInfo().UserID, "", EventLogController.EventLogType.USER_ROLE_UPDATED); if (includeRoles) { foreach (RoleInfo role in roleGroup.Roles.Values) { TestableRoleController.Instance.UpdateRole(role); objEventLog.AddLog(role, PortalController.GetCurrentPortalSettings(), UserController.GetCurrentUserInfo().UserID, "", EventLogController.EventLogType.ROLE_UPDATED); } } }
/// ----------------------------------------------------------------------------- /// <summary> /// DeleteRoleGroup deletes a RoleGroup from the Data Store /// </summary> /// <param name="roleGroup">The RoleGroup to delete from the Data Store.</param> /// <history> /// [cnurse] 03/28/2006 created /// </history> /// ----------------------------------------------------------------------------- public override void DeleteRoleGroup(RoleGroupInfo roleGroup) { dataProvider.DeleteRoleGroup(roleGroup.RoleGroupID); ClearRoleGroupCache(roleGroup.PortalID); }
private static void CreateRoleGroup(RoleGroupInfo roleGroup) { RoleGroupInfo objRoleGroupInfo; RoleController objRoleController = new RoleController(); int roleGroupId = Null.NullInteger; //First check if the role exists objRoleGroupInfo = RoleController.GetRoleGroupByName(roleGroup.PortalID, roleGroup.RoleGroupName); if (objRoleGroupInfo == null) { roleGroup.RoleGroupID = RoleController.AddRoleGroup(roleGroup); } else { roleGroup.RoleGroupID = objRoleGroupInfo.RoleGroupID; } }
/// ----------------------------------------------------------------------------- /// <summary> /// CreateRoleGroup persists a RoleGroup to the Data Store /// </summary> /// <remarks> /// </remarks> /// <param name="roleGroup">The RoleGroup to persist to the Data Store.</param> /// <returns>The Id of the new role.</returns> /// <history> /// [cnurse] 03/28/2006 created /// [jlucarino] 02/26/2009 added CreatedByUserID parameter /// </history> /// ----------------------------------------------------------------------------- public override int CreateRoleGroup(RoleGroupInfo roleGroup) { return Convert.ToInt32(dataProvider.AddRoleGroup(roleGroup.PortalID, roleGroup.RoleGroupName, roleGroup.Description, UserController.GetCurrentUserInfo().UserID)); }
/// ----------------------------------------------------------------------------- /// <summary> /// DeleteRoleGroup deletes a RoleGroup from the Data Store. /// </summary> /// <param name="roleGroup">The RoleGroup to delete from the Data Store.</param> /// ----------------------------------------------------------------------------- public override void DeleteRoleGroup(RoleGroupInfo roleGroup) { this.dataProvider.DeleteRoleGroup(roleGroup.RoleGroupID); this.ClearRoleGroupCache(roleGroup.PortalID); }
/// <summary> /// CreateRoleGroup persists a RoleGroup to the Data Store /// </summary> /// <remarks> /// </remarks> /// <param name="roleGroup">The RoleGroup to persist to the Data Store.</param> /// <returns>A Boolean indicating success or failure.</returns> /// <history> /// [cnurse] 03/28/2006 created /// </history> public override int CreateRoleGroup( RoleGroupInfo roleGroup ) { roleGroup.RoleGroupID = Convert.ToInt32( dataProvider.AddRoleGroup( roleGroup.PortalID, roleGroup.RoleGroupName, roleGroup.Description ) ); return 1; }