// REMOVED AS WE'RE NOT USING THIS // bool IMetaWeblog.SetPostCategories(string postid, string username, string password, MTCategory[] cat) // { // for (int i = 0; i < cat.Length; i++) // { // MTCategory mcat; // mcat = cat[i]; // Item iv = Item.GetItem(Convert.ToInt32(postid), _portalId, ItemType.Article.GetId(), false); // Tag t = Tag.GetTag(mcat.categoryName, _portalId); // //if this item tag relationship already existed for another versionID don't increment the count; // if (!ItemTag.CheckItemTag(iv.ItemId, Convert.ToInt32(t.TagId))) // { // t.TotalItems++; // t.Save(); // } // //it.ItemVersionId = i.ItemVersionId; // //ad the itemtag relationship // ItemTag.AddItemTag(iv.ItemVersionId, Convert.ToInt32(t.TagId)); // } // throw new XmlRpcFaultException(0, Localization.GetString("FailedAuthentication.Text", LocalResourceFile)); // } ///<summary> /// Authenticate user /// </summary> /// <param name="username">UserName</param> /// <param name="password">Password</param> private DotNetNuke.Entities.Users.UserInfo Authenticate(string username, string password) { // Check user credentials using form authentication // Check the portal alias to verify where the request is coming from and set portalid UserLoginStatus loginStatus = UserLoginStatus.LOGIN_FAILURE; DotNetNuke.Entities.Users.UserInfo objUser = UserController.ValidateUser(PortalId, username, password, string.Empty, string.Empty, string.Empty, ref loginStatus); if (loginStatus == UserLoginStatus.LOGIN_FAILURE || loginStatus == UserLoginStatus.LOGIN_USERLOCKEDOUT || loginStatus == UserLoginStatus.LOGIN_USERNOTAPPROVED) { throw new InvalidCredentialException(Localization.GetString("FailedAuthentication.Text", this.LocalResourceFile)); } // Check for the author/admin roles in Publish var hostController = HostController.Instance; if (!objUser.IsInRole(hostController.GetString(Utility.PublishAuthorRole + PortalId)) && !objUser.IsInRole(hostController.GetString(Utility.PublishAdminRole + PortalId))) { throw new InvalidCredentialException(Localization.GetString("FailedAuthentication.Text", this.LocalResourceFile)); } return(objUser); }
/// <param name="moduleId"></param> /// <param name="tabId"></param> /// <param name="permissionKey">You can use the constants, but for modules there are only /// those two</param> /// <returns></returns> public static bool canUserAccessModule(UserInfo user, int portalId, int tabId, ModuleInfo moduleInfo, string permissionKey) { var retVal = false; string permissionsString = null; if (moduleInfo.InheritViewPermissions) { var tabPermissionController = new TabPermissionController(); var tabPermissionCollection = tabPermissionController.GetTabPermissionsCollectionByTabID(tabId, portalId); permissionsString = tabPermissionController.GetTabPermissions(tabPermissionCollection, permissionKey); } else { var modulePermissionController = new ModulePermissionController(); var permissionCollection = modulePermissionController.GetModulePermissionsCollectionByModuleID(moduleInfo.ModuleID, tabId); permissionsString = modulePermissionController.GetModulePermissions(permissionCollection, permissionKey); } char[] splitter = { ';' }; var roles = permissionsString.Split(splitter); foreach (var role in roles) { if (role.Length > 0) { if (user != null && user.IsInRole(role)) retVal = true; else if (user == null && role.ToLower().Equals("all users")) retVal = true; } } return retVal; }
internal User LoadUser(DotNetNuke.Entities.Users.UserInfo dnnUser) { PortalSettings _portalSettings = PortalController.GetCurrentPortalSettings(); User u = new User(); DotNetNuke.Entities.Users.UserInfo cu = dnnUser; u.UserId = cu.UserID; u.UserName = cu.Username; u.IsSuperUser = cu.IsSuperUser; u.IsAdmin = cu.IsInRole(_portalSettings.AdministratorRoleName); u.DateCreated = cu.Membership.CreatedDate; u.DateUpdated = cu.Membership.LastActivityDate; u.FirstName = cu.FirstName; u.LastName = cu.LastName; u.DisplayName = cu.DisplayName; u.Email = cu.Email; u.UserRoles = GetRoleIds(cu, _portalSettings.PortalId); //RolesToString(cu.Roles) if (cu.IsSuperUser) { u.UserRoles += Globals.DefaultAnonRoles + _portalSettings.AdministratorRoleId + ";"; } Social social = new Social(); u.UserRoles += "|" + cu.UserID + "|" + social.ActiveSocialGroups(cu.UserID, _portalSettings.PortalId) + "|"; if (!cu.IsSuperUser) { u.Properties = GetUserProperties(dnnUser); } return(u); }
// <summary> /// Kiem tra user hien tai chi co quyen view /// </summary> /// <param name="pUserInfo">UserInfo</param> public static bool checkViewRole(DotNetNuke.Entities.Users.UserInfo pUserInfo) { if (pUserInfo.IsSuperUser) { return(false); } return(pUserInfo.IsInRole(ConfigurationManager.AppSettings["Role_DC"])); }
public HttpResponseMessage Roles_AddRemove(int userid, string role, string mode) { int v_Current_Portal_ID = this.ActiveModule.PortalID; //Getting user info DotNetNuke.Entities.Users.UserInfo v_UserInfo = DotNetNuke.Entities.Users.UserController.GetUserById(v_Current_Portal_ID, userid); if (v_UserInfo != null) { RoleController v_RoleController = new RoleController(); RoleInfo v_RoleInfo = v_RoleController.GetRoleByName(v_Current_Portal_ID, role); if (v_RoleInfo != null) { if (v_UserInfo.IsInRole(v_RoleInfo.RoleName) && mode == "remove") { RoleController.DeleteUserRole(v_UserInfo, v_RoleInfo, this.PortalSettings, false); return(Request.CreateResponse(HttpStatusCode.OK, "ok role removed")); } if (v_UserInfo.IsInRole(v_RoleInfo.RoleName) == false && mode == "add") { v_RoleController.AddUserRole(v_Current_Portal_ID, userid, v_RoleInfo.RoleID, DateTime.MinValue); return(Request.CreateResponse(HttpStatusCode.OK, "ok role added")); } } else { return(Request.CreateResponse(HttpStatusCode.InternalServerError, "No such role with that RoleName")); } } else { return(Request.CreateResponse(HttpStatusCode.InternalServerError, "No such user with that Id")); } return(Request.CreateResponse(HttpStatusCode.OK, "ok")); }
/// <summary> /// Determine, if accessing user is Administrator. /// </summary> /// <param name="accessingUser">userinfo of the user to query.</param> /// <returns>true, if user is portal administrator or superuser.</returns> private bool isAdminUser(ref UserInfo accessingUser) { if (accessingUser == null || accessingUser.UserID == -1) { return(false); } if (string.IsNullOrEmpty(this._administratorRoleName)) { PortalInfo ps = PortalController.Instance.GetPortal(accessingUser.PortalID); this._administratorRoleName = ps.AdministratorRoleName; } return(accessingUser.IsInRole(this._administratorRoleName) || accessingUser.IsSuperUser); }
//returns true if user is in at least one role from a comma separated list of roles public bool UserIsInListOfRoles(UserInfo user, string listOfRoles) { bool result = false; string[] arrlistOfRoles = listOfRoles.Split(new char[] { ',' }); foreach (string role in arrlistOfRoles) { if (user.IsInRole(role.Trim())) { result = true; break; } } return result; }
/// <remarks>Source/Template from SecurityContext.canUserAccessModule()</remarks> private static bool CanUserViewTab(UserInfo user, int portalId, int tabId, string permissionKey = "VIEW") { //var retVal = false; var tabPermissionController = new TabPermissionController(); var tabPermissionCollection = tabPermissionController.GetTabPermissionsCollectionByTabID(tabId, portalId); var permissionsString = tabPermissionController.GetTabPermissions(tabPermissionCollection, permissionKey); char[] splitter = { ';' }; var roles = permissionsString.Split(splitter); foreach (var role in roles.Where(role => role.Length > 0)) { if (user != null && user.IsInRole(role)) return true; if (role.ToLower().Equals("all users")) return true; } return false; }
private static bool IsAdminUser(PortalSettings portalSettings, UserInfo accessingUser, UserInfo targetUser) { bool isAdmin = false; if (accessingUser != null) { // Is Super User? isAdmin = accessingUser.IsSuperUser; if (!isAdmin && targetUser.PortalID != -1) { // Is Administrator var administratorRoleName = portalSettings != null ? portalSettings.AdministratorRoleName : PortalController.Instance.GetPortal(targetUser.PortalID).AdministratorRoleName; isAdmin = accessingUser.IsInRole(administratorRoleName); } } return(isAdmin); }
private bool IsAdminUser(UserInfo accessingUser) { bool isAdmin = false; if (accessingUser != null) { //Is Super User? isAdmin = accessingUser.IsSuperUser; if (!isAdmin && user.PortalID != -1) { //Is Administrator if (String.IsNullOrEmpty(administratorRoleName)) { PortalInfo ps = new PortalController().GetPortal(user.PortalID); administratorRoleName = ps.AdministratorRoleName; } isAdmin = accessingUser.IsInRole(administratorRoleName); } } return(isAdmin); }
/// <summary> /// Determine, if accessing user is Administrator /// </summary> /// <param name="accessingUser">userinfo of the user to query</param> /// <returns>true, if user is portal administrator or superuser</returns> /// <history> /// 2007-10-20 [sleupold] added /// </history> private bool isAdminUser(ref UserInfo accessingUser) { if (accessingUser == null || accessingUser.UserID == -1) { return false; } if (String.IsNullOrEmpty(_administratorRoleName)) { PortalInfo ps = PortalController.Instance.GetPortal(accessingUser.PortalID); _administratorRoleName = ps.AdministratorRoleName; } return accessingUser.IsInRole(_administratorRoleName) || accessingUser.IsSuperUser; }
private bool HasSocialReplationship(UserInfo targetUser, UserInfo accessingUser, string extendedVisibility) { if (string.IsNullOrEmpty(extendedVisibility)) { return false; } var profileVisibility = new ProfileVisibility(PortalSettings.PortalId, extendedVisibility); var isVisible = accessingUser.UserID == targetUser.UserID; if (!isVisible) { //Relationships foreach (var relationship in profileVisibility.RelationshipVisibilities) { switch (relationship.RelationshipTypeId) { case (int)DefaultRelationshipTypes.Followers: isVisible = targetUser.Social.Following != null && targetUser.Social.Following.Status == RelationshipStatus.Accepted; break; case (int)DefaultRelationshipTypes.Friends: isVisible = targetUser.Social.Friend != null && targetUser.Social.Friend.Status == RelationshipStatus.Accepted; break; default: isVisible = targetUser.Social.UserRelationships.Any(userRelationship => (userRelationship.RelationshipId == relationship.RelationshipId && accessingUser.UserID == userRelationship.RelatedUserId && userRelationship.Status == RelationshipStatus.Accepted) ); break; } if (isVisible) { break; } } //Groups/Roles if (profileVisibility.RoleVisibilities.Any(role => accessingUser.IsInRole(role.RoleName))) { isVisible = true; } } return isVisible; }
protected void GenerateC2() { RV.LocalReport.ReportPath = MapPath("/DesktopModules/Turnero/Reports/ReportC2.rdlc"); List <ConnectionDispensario.Modelos.Reporting.C2Item> itemsC2 = new List <ConnectionDispensario.Modelos.Reporting.C2Item>(); //Buscar dentro de los usuarios que cumplan con el servicio if (Request["servicio"] != null) { //DotNetNuke.Entities.Portals.PortalController PC = new DotNetNuke.Entities.Portals.PortalController(); System.Collections.ArrayList AL = DotNetNuke.Entities.Users.UserController.GetUsers(0); for (int dia = 0; dia < DateTime.DaysInMonth(DateTime.Now.Year, DateTime.Now.Month); dia++) { itemsC2.Add(new ConnectionDispensario.Modelos.Reporting.C2Item()); itemsC2[dia].Dia = dia + 1; if (AL != null && itemsC2 != null) { for (int A = 0; A < AL.Count; A++) { DotNetNuke.Entities.Users.UserInfo UI = AL[A] as UserInfo; if (UI.IsInRole("Servicio:" + Request["servicio"]) == true) { ConnectionDispensario.Modelos.Reporting.C2 datosTemp = new ConnectionDispensario.Modelos.Reporting.C2(UI.UserID); itemsC2[dia].HorasAtencion += datosTemp.HorasAtencionPorDia[dia]; //Consiguiendo datos de la C1 del usuario A if (datosTemp.ItemsDeC1 != null) { for (int i = 0; i < datosTemp.ItemsDeC1.Count; i++) { if (dia + 1 == datosTemp.ItemsDeC1[i].FechaDeAtencion.Day) { if (datosTemp.ItemsDeC1[i].Menor1f == "X") { itemsC2[dia].Menor1f++; } if (datosTemp.ItemsDeC1[i].Menor1m == "X") { itemsC2[dia].Menor1m++; } if (datosTemp.ItemsDeC1[i].Ano1f == "X") { itemsC2[dia].Ano1f++; } if (datosTemp.ItemsDeC1[i].Ano1m == "X") { itemsC2[dia].Ano1m++; } if (datosTemp.ItemsDeC1[i].Ano2a4f == "X") { itemsC2[dia].Ano2a4f++; } if (datosTemp.ItemsDeC1[i].Ano2a4m == "X") { itemsC2[dia].Ano2a4m++; } if (datosTemp.ItemsDeC1[i].Ano5a9f == "X") { itemsC2[dia].Ano5a9f++; } if (datosTemp.ItemsDeC1[i].Ano5a9m == "X") { itemsC2[dia].Ano5a9m++; } if (datosTemp.ItemsDeC1[i].Ano10a14f == "X") { itemsC2[dia].Ano10a14f++; } if (datosTemp.ItemsDeC1[i].Ano10a14m == "X") { itemsC2[dia].Ano10a14m++; } if (datosTemp.ItemsDeC1[i].Ano15a49f == "X") { itemsC2[dia].Ano15a49f++; } if (datosTemp.ItemsDeC1[i].Ano15a49m == "X") { itemsC2[dia].Ano15a49m++; } if (datosTemp.ItemsDeC1[i].Ano50ymasf == "X") { itemsC2[dia].Ano50ymasf++; } if (datosTemp.ItemsDeC1[i].Ano50ymasm == "X") { itemsC2[dia].Ano50ymasf++; } if (datosTemp.ItemsDeC1[i].Controlembarazo == "X") { itemsC2[dia].TotalPregnant++; } } } } } } } } } ReportDataSource RDS = new ReportDataSource("DataSetC2", itemsC2); RV.LocalReport.DataSources.Add(RDS); RV.LocalReport.SetParameters(new ReportParameter[] { new ReportParameter("Establecimiento", "Dispensario Municipal \"Dr. H Weihmuller\""), new ReportParameter("Departamento", "Gral. San Martin"), new ReportParameter("NombreServicio", Request["servicio"].ToString()), new ReportParameter("CodigoEstablecimiento", "4200026"), new ReportParameter("CodigoServicio", "..."), new ReportParameter("Mes", DateTime.Today.Month.ToString()), new ReportParameter("Anio", DateTime.Today.Year.ToString()) }); }
private static UserLoginStatus ValidateLogin(string username, string authType, UserInfo user, UserLoginStatus loginStatus, string password, ref bool bValid, int portalId) { if (loginStatus != UserLoginStatus.LOGIN_USERLOCKEDOUT && (loginStatus != UserLoginStatus.LOGIN_USERNOTAPPROVED || user.IsInRole("Unverified Users"))) { if (authType == "DNN") { if (user.IsSuperUser) { if (ValidateUser(username, password)) { loginStatus = UserLoginStatus.LOGIN_SUPERUSER; bValid = true; } } else { if (ValidateUser(username, password)) { loginStatus = UserLoginStatus.LOGIN_SUCCESS; bValid = true; } } } else { if (user.IsSuperUser) { loginStatus = UserLoginStatus.LOGIN_SUPERUSER; bValid = true; } else { loginStatus = UserLoginStatus.LOGIN_SUCCESS; bValid = true; } } } return loginStatus; }
private bool CheckAccessLevel(ProfilePropertyDefinition property, UserInfo accessingUser) { var isAdminUser = IsAdminUser(accessingUser); //Use properties visible property but admins and hosts can always see the property var isVisible = property.Visible || isAdminUser; if (isVisible && !isAdminUser) { switch (property.ProfileVisibility.VisibilityMode) { case UserVisibilityMode.FriendsAndGroups: isVisible = IsUser(accessingUser); if(!isVisible) { //Relationships foreach (Relationship relationship in property.ProfileVisibility.RelationshipVisibilities) { if (user.Social.UserRelationships.Any(userRelationship => (userRelationship.RelationshipId == relationship.RelationshipId && accessingUser.UserID == userRelationship.RelatedUserId) )) { isVisible = true; break; } } //Groups/Roles if (property.ProfileVisibility.RoleVisibilities.Any(role => accessingUser.IsInRole(role.RoleName))) { isVisible = true; } } break; case UserVisibilityMode.AllUsers: // property is visible to everyone so do nothing break; case UserVisibilityMode.MembersOnly: // property visible if accessing user is a member isVisible = IsMember(accessingUser); break; case UserVisibilityMode.AdminOnly: //accessing user not admin user so property is hidden (unless it is the user him/herself) isVisible = IsUser(accessingUser); break; } } return isVisible; }
private void DisplayOrderData(int portalId, UserInfo userInfo, String entryId) { var strOut = "***ERROR*** Invalid Data"; if (Utils.IsNumeric(entryId) && entryId != "0") { var orderData = new OrderData(portalId, Convert.ToInt32(entryId)); if (orderData.PurchaseInfo.TypeCode == "ORDER") { strOut = "***ERROR*** Invalid Security"; if (userInfo.UserID == orderData.UserId || userInfo.IsInRole(StoreSettings.ManagerRole) || userInfo.IsInRole(StoreSettings.EditorRole)) { //check the payment provider for a print url var shippingprovider = orderData.PurchaseInfo.GetXmlProperty("genxml/extrainfo/genxml/radiobuttonlist/shippingprovider"); if (shippingprovider != "") { var shipprov = ShippingInterface.Instance(shippingprovider); if (shipprov != null) { if (_template == "printdeliverylabel.html") { var printurl = shipprov.GetDeliveryLabelUrl(orderData.PurchaseInfo); if (printurl != "") Response.Redirect(printurl); } } } // not provider label, so print template var templCtrl = NBrightBuyUtils.GetTemplateGetter(_theme); var strTempl = templCtrl.GetTemplateData(_template, Utils.GetCurrentCulture(), true, true, true, StoreSettings.Current.Settings()); strOut = GenXmlFunctions.RenderRepeater(orderData.PurchaseInfo, strTempl, "", "XMLData", Utils.GetCurrentCulture(), StoreSettings.Current.Settings()); if (_template.EndsWith(".xsl")) strOut = XslUtils.XslTransInMemory(orderData.PurchaseInfo.XMLData, strOut); } } } var l = new Literal(); l.Text = strOut; phData.Controls.Add(l); }
private void PopulateClientData(int userId) { _clientInfo = new NBrightInfo(true); _clientInfo.ItemID = userId; _clientInfo.UserId = userId; _clientInfo.PortalId = PortalId; _userInfo = UserController.GetUserById(PortalId, userId); if (_userInfo != null) { Exists = true; _clientInfo.ModifiedDate = _userInfo.Membership.CreatedDate; foreach (var propertyInfo in _userInfo.GetType().GetProperties()) { if (propertyInfo.CanRead) { var pv = propertyInfo.GetValue(_userInfo, null); if (pv == null) pv = ""; _clientInfo.SetXmlProperty("genxml/textbox/" + propertyInfo.Name.ToLower(), pv.ToString()); } } foreach (DotNetNuke.Entities.Profile.ProfilePropertyDefinition p in _userInfo.Profile.ProfileProperties) { _clientInfo.SetXmlProperty("genxml/textbox/" + p.PropertyName.ToLower(), p.PropertyValue); } _clientInfo.AddSingleNode("membership", "", "genxml"); foreach (var propertyInfo in _userInfo.Membership.GetType().GetProperties()) { if (propertyInfo.CanRead) { var pv = propertyInfo.GetValue(_userInfo.Membership, null); if (pv != null) _clientInfo.SetXmlProperty("genxml/membership/" + propertyInfo.Name.ToLower(), pv.ToString()); } } if (_userInfo.IsInRole(StoreSettings.ClientEditorRole)) { _clientInfo.SetXmlProperty("genxml/checkbox/clienteditorrole", "True"); } else { _clientInfo.SetXmlProperty("genxml/checkbox/clienteditorrole", "False"); } var objCtrl = new NBrightBuyController(); DataRecord = objCtrl.GetByType(PortalId, -1, "CLIENT", _userInfo.UserID.ToString("")); if (DataRecord == null) { DataRecord = new NBrightInfo(true); DataRecord.ItemID = -1; DataRecord.UserId = _userInfo.UserID; DataRecord.PortalId = PortalId; DataRecord.ModuleId = -1; DataRecord.TypeCode = "CLIENT"; } DiscountCodes = GetEntityList("discountcodes"); VoucherCodes = GetEntityList("vouchercodes"); } }
private static void ProcessSecurityRole(UserInfo user, PortalSettings settings, string roleName, out bool? roleAllowed) { roleAllowed = null; //permissions strings are encoded with Deny permissions at the beginning and Grant permissions at the end for optimal performance if (!String.IsNullOrEmpty(roleName)) { //Deny permission if (roleName.StartsWith("!")) { //Portal Admin cannot be denied from his/her portal (so ignore deny permissions if user is portal admin) if (settings != null && !(settings.PortalId == user.PortalID && settings.AdministratorId == user.UserID)) { string denyRole = roleName.Replace("!", ""); if (denyRole == Globals.glbRoleAllUsersName || user.IsInRole(denyRole)) { roleAllowed = false; } } } else //Grant permission { if (roleName == Globals.glbRoleAllUsersName || user.IsInRole(roleName)) { roleAllowed = true; } } } }
/// <summary> /// Returns true if a user is in the SexyContent Designers group /// </summary> /// <param name="user"></param> /// <returns></returns> public static bool IsInSexyContentDesignersGroup(UserInfo user) { return user.IsInRole(SexyContentGroupName); }
private void DisplayOrderData(int portalId, UserInfo userInfo, String entryId) { var strOut = "***ERROR*** Invalid Data"; if (Utils.IsNumeric(entryId) && entryId != "0") { var orderData = new OrderData(portalId, Convert.ToInt32(entryId)); if (orderData.PurchaseInfo.TypeCode == "ORDER") { strOut = "***ERROR*** Invalid Security"; if (_scode == orderData.PurchaseInfo.GetXmlProperty("genxml/securitycode") || userInfo.UserID == orderData.UserId || userInfo.IsInRole(StoreSettings.ManagerRole) || userInfo.IsInRole(StoreSettings.EditorRole)) { //check the payment provider for a print url var shippingprovider = orderData.PurchaseInfo.GetXmlProperty("genxml/extrainfo/genxml/radiobuttonlist/shippingprovider"); if (shippingprovider != "") { var shipprov = ShippingInterface.Instance(shippingprovider); if (shipprov != null) { if (_printtype == "shiplabel") { var printurl = shipprov.GetDeliveryLabelUrl(orderData.PurchaseInfo); if (printurl != "") Response.Redirect(printurl); } } } // No print label, so print template specified. var obj = new NBrightInfo(true); obj.PortalId = PortalSettings.Current.PortalId; obj.ModuleId = 0; obj.Lang = Utils.GetCurrentCulture(); obj.GUIDKey = _printtype; obj.ItemID = -1; strOut = NBrightBuyUtils.RazorTemplRender("printorder.cshtml", 0, "", obj, "/DesktopModules/NBright/NBrightBuy", _theme, Utils.GetCurrentCulture(), StoreSettings.Current.Settings()); } } } var l = new Literal(); l.Text = strOut; phData.Controls.Add(l); }
/// <summary> /// Update information of the user (if user is administrator is not possible change the password) /// This Method also update the user information in DNN /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void RadGrid1_UpdateCommand(object sender, GridCommandEventArgs e) { if (e.CommandName == RadGrid.UpdateCommandName) { if (e.Item is GridEditableItem) { GridEditableItem editItem = (GridEditableItem)e.Item; TextBox txtUserId = (TextBox)editItem.FindControl("txtUserId"); int userId; if (txtUserId.Text == string.Empty) { userId = 0; } else { userId = Convert.ToInt32(txtUserId.Text); } // Get controls RadTextBox txtEmail = (RadTextBox)editItem.FindControl("txtEmail"); RadTextBox txtFirstName = (RadTextBox)editItem.FindControl("txtFirstName"); RadTextBox txtLastName = (RadTextBox)editItem.FindControl("txtLastName"); RadTextBox txtPhone = (RadTextBox)editItem.FindControl("txtTelephone"); RadTextBox txtAddress = (RadTextBox)editItem.FindControl("txtAddress"); RadTextBox txtLinkedIn = (RadTextBox)editItem.FindControl("txtLinkedIn"); RadTextBox txtGoogle = (RadTextBox)editItem.FindControl("txtGoogle"); RadTextBox txtTwitter = (RadTextBox)editItem.FindControl("txtTwitter"); RadTextBox txtFacebook = (RadTextBox)editItem.FindControl("txtFacebook"); RadTextBox txtSkype = (RadTextBox)editItem.FindControl("txtSkypeName"); RadComboBox ddLanguage = (RadComboBox)editItem.FindControl("ddLanguage"); RadComboBox ddCustomerType = (RadComboBox)editItem.FindControl("ddCustomerType"); RadComboBox ddNexsoEnrolment = (RadComboBox)editItem.FindControl("ddNexsoEnrolment"); RadComboBox ddUserTheme = (RadComboBox)editItem.FindControl("ddUserTheme"); RadComboBox ddUserBeneficiaries = (RadComboBox)editItem.FindControl("ddUserBeneficiaries"); RadComboBox ddUserSector = (RadComboBox)editItem.FindControl("ddUserSector"); RadTextBox txtOtherSocialNetwork = (RadTextBox)editItem.FindControl("txtOtherSocialNetwork"); CheckBox chkNotifications = (CheckBox)editItem.FindControl("chkNotifications"); RadTextBox txtPassword = (RadTextBox)editItem.FindControl("txtPassword"); if (userId == 0) { if (txtEmail.Text != string.Empty) { int totalUsers = 0; UserController.GetUsersByUserName(PortalId, txtEmail.Text, 1, 1, ref totalUsers); if (totalUsers == 0) { //Update DNN Information var objUser = new DotNetNuke.Entities.Users.UserInfo(); objUser.AffiliateID = Null.NullInteger; objUser.Email = txtEmail.Text; objUser.FirstName = txtFirstName.Text; objUser.IsSuperUser = false; objUser.LastName = txtLastName.Text; objUser.PortalID = PortalController.GetCurrentPortalSettings().PortalId; objUser.Username = txtEmail.Text; objUser.DisplayName = txtFirstName.Text + " " + txtLastName.Text; objUser.Membership.LockedOut = false; objUser.Membership.Password = txtPassword.Text; objUser.Membership.Email = objUser.Email; objUser.Membership.Username = objUser.Username; objUser.Membership.UpdatePassword = false; objUser.Membership.LockedOut = false; objUser.Membership.Approved = true; DotNetNuke.Security.Membership.UserCreateStatus objCreateStatus = DotNetNuke.Entities.Users.UserController.CreateUser(ref objUser); if (objCreateStatus == DotNetNuke.Security.Membership.UserCreateStatus.Success) { UserInfo myDnnUser = objUser; myDnnUser.Profile.InitialiseProfile(myDnnUser.PortalID); myDnnUser.Profile.SetProfileProperty("FirstName", txtFirstName.Text); myDnnUser.Profile.SetProfileProperty("LastName", txtLastName.Text); UserController.UpdateUser(myDnnUser.PortalID, myDnnUser); //Update Nexso information userPropertyComponent = new UserPropertyComponent(objUser.UserID); //Update DNN roles if (!objUser.IsInRole("Registered Users")) { var oDnnRoleController = new RoleController(); RoleInfo oCurrentRole = oDnnRoleController.GetRoleByName(this.PortalId, "Registered Users"); oDnnRoleController.AddUserRole(this.PortalId, objUser.UserID, oCurrentRole.RoleID, System.DateTime.Now.AddDays(-1), DotNetNuke.Common.Utilities.Null.NullDate); } if (!objUser.IsInRole("NexsoUser")) { var oDnnRoleController = new RoleController(); RoleInfo oCurrentRole = oDnnRoleController.GetRoleByName(this.PortalId, "NexsoUser"); oDnnRoleController.AddUserRole(this.PortalId, objUser.UserID, oCurrentRole.RoleID, System.DateTime.Now.AddDays(-1), DotNetNuke.Common.Utilities.Null.NullDate); } ExistEmail = false; } else { ExistEmail = true; return; } } else { ExistEmail = true; return; } } else { return; } } else { userPropertyComponent = new UserPropertyComponent(userId); if (txtEmail.Text != string.Empty) { UserInfo myDnnUser = DotNetNuke.Entities.Users.UserController.GetUser(PortalSettings.PortalId, userId, true); myDnnUser.Profile.InitialiseProfile(myDnnUser.PortalID); myDnnUser.Profile.SetProfileProperty("FirstName", txtFirstName.Text); myDnnUser.Profile.SetProfileProperty("LastName", txtLastName.Text); if (!myDnnUser.IsInRole("Administrators")) { if (txtPassword.Text != string.Empty) { MembershipUser usr = Membership.GetUser(myDnnUser.Username, false); if (usr.IsLockedOut == true) { usr.UnlockUser(); } string resetPassword = usr.ResetPassword(); bool sw = usr.ChangePassword(resetPassword, txtPassword.Text); } } // myDnnUser.Profile.SetProfileProperty("Password", txtPassword.Text); UserController.UpdateUser(myDnnUser.PortalID, myDnnUser); if (!myDnnUser.IsInRole("NexsoUser")) { var oDnnRoleController = new RoleController(); RoleInfo oCurrentRole = oDnnRoleController.GetRoleByName(this.PortalId, "NexsoUser"); oDnnRoleController.AddUserRole(this.PortalId, myDnnUser.UserID, oCurrentRole.RoleID, System.DateTime.Now.AddDays(-1), DotNetNuke.Common.Utilities.Null.NullDate); } } } userPropertyComponent.UserProperty.FirstName = txtFirstName.Text; userPropertyComponent.UserProperty.LastName = txtLastName.Text; userPropertyComponent.UserProperty.Telephone = txtPhone.Text; userPropertyComponent.UserProperty.email = txtEmail.Text; userPropertyComponent.UserProperty.SkypeName = txtSkype.Text; userPropertyComponent.UserProperty.Twitter = txtTwitter.Text; userPropertyComponent.UserProperty.FaceBook = txtFacebook.Text; userPropertyComponent.UserProperty.Google = txtGoogle.Text; userPropertyComponent.UserProperty.LinkedIn = txtLinkedIn.Text; userPropertyComponent.UserProperty.Address = txtAddress.Text; userPropertyComponent.UserProperty.Agreement = "A001"; userPropertyComponent.UserProperty.AllowNexsoNotifications = Convert.ToInt32(chkNotifications.Checked); if (ddCustomerType.SelectedValue != string.Empty) { userPropertyComponent.UserProperty.CustomerType = Convert.ToInt32(ddCustomerType.SelectedValue); } if (ddNexsoEnrolment.SelectedValue != string.Empty) { userPropertyComponent.UserProperty.NexsoEnrolment = Convert.ToInt32(ddNexsoEnrolment.SelectedValue); } if (ddLanguage.SelectedValue != string.Empty) { userPropertyComponent.UserProperty.Language = Convert.ToInt32(ddLanguage.SelectedValue); } if (userPropertyComponent.Save() > 0) { SaveChkControl("Theme", ddUserTheme, userPropertyComponent.UserProperty.UserId); SaveChkControl("Beneficiaries", ddUserBeneficiaries, userPropertyComponent.UserProperty.UserId); SaveChkControl("Sector", ddUserSector, userPropertyComponent.UserProperty.UserId); } if (editItem.ItemIndex != -1) { this.grdManageUsers.MasterTableView.Items[editItem.ItemIndex].Edit = false; } else { e.Item.OwnerTableView.IsItemInserted = false; } this.grdManageUsers.MasterTableView.Rebind(); } } }
public static bool IsInRoles(UserInfo objUserInfo, PortalSettings settings, string roles) { //super user always has full access bool isInRoles = objUserInfo.IsSuperUser; if (!isInRoles) { if (roles != null) { //permissions strings are encoded with Deny permissions at the beginning and Grant permissions at the end for optimal performance foreach (string role in roles.Split(new[] { ';' })) { if (!String.IsNullOrEmpty(role)) { //Deny permission if (role.StartsWith("!")) { //Portal Admin cannot be denied from his/her portal (so ignore deny permissions if user is portal admin) if (!(settings.PortalId == objUserInfo.PortalID && settings.AdministratorId == objUserInfo.UserID)) { string denyRole = role.Replace("!", ""); if (denyRole == Globals.glbRoleAllUsersName || objUserInfo.IsInRole(denyRole)) { break; } } } else //Grant permission { if (role == Globals.glbRoleAllUsersName || objUserInfo.IsInRole(role)) { isInRoles = true; break; } } } } } } return isInRoles; }
private bool IsAdminUser(UserInfo accessingUser) { bool isAdmin = false; if (accessingUser != null) { //Is Super User? isAdmin = accessingUser.IsSuperUser; if (!isAdmin && user.PortalID != -1) { //Is Administrator if (String.IsNullOrEmpty(administratorRoleName)) { PortalInfo ps = new PortalController().GetPortal(user.PortalID); administratorRoleName = ps.AdministratorRoleName; } isAdmin = accessingUser.IsInRole(administratorRoleName); } } return isAdmin; }
internal virtual bool IsAdminOrHost(UserInfo userInfo) { return userInfo.IsSuperUser || userInfo.IsInRole(TestablePortalSettings.Instance.AdministratorRoleName); }
public string GetProperty(string propertyName, string format, CultureInfo formatProvider, UserInfo accessingUser, Scope accessLevel, ref bool propertyNotFound) { string retVal = ""; switch (propertyName.ToLower()) { case "all": int moduleId = _moduleContext.ModuleId; int portalId = _moduleContext.PortalId; int tabId = _moduleContext.TabId; ModuleInfo module = new ModuleController().GetModule(moduleId, tabId); dynamic properties = new ExpandoObject(); System.IO.FileInfo fi = new System.IO.FileInfo(HttpContext.Current.Server.MapPath("~/" + _moduleContext.Configuration.ModuleControl.ControlSrc.Replace(".html", "") + ".resx")); string physResourceFile = fi.DirectoryName + "/App_LocalResources/" + fi.Name; string relResourceFile = "/DesktopModules/" + module.DesktopModule.FolderName + "/App_LocalResources/" + fi.Name; if (File.Exists(physResourceFile)) { using (var rsxr = new ResXResourceReader(physResourceFile)) { var res = rsxr.OfType<DictionaryEntry>() .ToDictionary( entry => entry.Key.ToString().Replace(".", "_"), entry => Localization.GetString(entry.Key.ToString(), relResourceFile)); properties.Resources = res; } } else { properties.Resources = physResourceFile + " not found"; } properties.Settings = _moduleContext.Settings; properties.Editable = _moduleContext.EditMode && _moduleContext.IsEditable; properties.Admin = accessingUser.IsInRole(PortalSettings.Current.AdministratorRoleName); properties.ModuleId = moduleId; properties.PortalId = portalId; properties.UserId = accessingUser.UserID; properties.HomeDirectory = PortalSettings.Current.HomeDirectory.Substring(1); properties.RawUrl = HttpContext.Current.Request.RawUrl; List<string> languages = new List<string>(); LocaleController lc = new LocaleController(); Dictionary<string, Locale> loc = lc.GetLocales(_moduleContext.PortalId); foreach (KeyValuePair<string, Locale> item in loc) { string cultureCode = item.Value.Culture.Name; languages.Add(cultureCode); } properties.Languages = languages; properties.CurrentLanguage = System.Threading.Thread.CurrentThread.CurrentCulture.Name; retVal = JsonConvert.SerializeObject(properties); break; case "view": retVal = (string)_moduleContext.Settings["View"]; if (String.IsNullOrEmpty(retVal)) retVal = "View.html"; break; case "list": retVal = (string)_moduleContext.Settings["List"]; if (String.IsNullOrEmpty(retVal)) retVal = "List.html"; break; } return retVal; }
/// <summary> /// Add new user to the data base /// </summary> /// <returns></returns> private int AddUser() { int totalUsers = 0; UserController.GetUsersByUserName(PortalId, txtEmail.Text, 1, 1, ref totalUsers); if (totalUsers == 0) { var objUser = new DotNetNuke.Entities.Users.UserInfo(); objUser.AffiliateID = Null.NullInteger; objUser.Email = ValidateSecurity.ValidateString(txtEmail.Text, false); objUser.FirstName = ValidateSecurity.ValidateString(txtFirstName.Text, false); objUser.IsSuperUser = false; objUser.LastName = ValidateSecurity.ValidateString(txtLastName.Text, false); objUser.PortalID = PortalController.GetCurrentPortalSettings().PortalId; objUser.Username = ValidateSecurity.ValidateString(txtEmail.Text, false); objUser.DisplayName = ValidateSecurity.ValidateString(txtFirstName.Text, false) + " " + ValidateSecurity.ValidateString(txtLastName.Text, false); objUser.Membership.Password = txtPassword.Text; objUser.Membership.Email = objUser.Email; objUser.Membership.Username = objUser.Username; objUser.Membership.UpdatePassword = false; objUser.Membership.LockedOut = true; if (userId == -1000) { objUser.Membership.Approved = true; //pero impersonation } else { objUser.Membership.Approved = true; //regular creation } DotNetNuke.Security.Membership.UserCreateStatus objCreateStatus = DotNetNuke.Entities.Users.UserController.CreateUser(ref objUser); if (objCreateStatus == DotNetNuke.Security.Membership.UserCreateStatus.Success) { CompleteUserCreation(DotNetNuke.Security.Membership.UserCreateStatus.Success, objUser, true, IsRegister); //objUser.Profile.InitialiseProfile(objUser.PortalID); //objUser.Profile.Country = CountryStateCity1.SelectedCountry; //objUser.Profile.Street = txtAddress.Text; //objUser.Profile.City = CountryStateCity1.SelectedCity; //objUser.Profile.Region = CountryStateCity1.SelectedState; //objUser.Profile.PostalCode = txtPostalCode.Text; //objUser.Profile.Telephone = txtPhone.Text; //objUser.Profile.FirstName = txtFirstName.Text; //objUser.Profile.LastName = txtLastName.Text; ////the agreement is sgned on //objUser.Profile.SetProfileProperty("Agreement", "A001"); //UserController.UpdateUser(objUser.PortalID, objUser); UserPropertyComponent userProperty = new UserPropertyComponent(objUser.UserID); SaveProfile(userProperty.UserProperty); userProperty.Save(); if (!objUser.IsInRole("Registered Users")) { var oDnnRoleController = new RoleController(); RoleInfo oCurrentRole = oDnnRoleController.GetRoleByName(this.PortalId, "Registered Users"); oDnnRoleController.AddUserRole(this.PortalId, objUser.UserID, oCurrentRole.RoleID, System.DateTime.Now.AddDays(-1), DotNetNuke.Common.Utilities.Null.NullDate); } return(objUser.UserID); } else { lblMessage.ErrorMessage = Localization.GetString("ExistingUser", LocalResourceFile); lblMessage.IsValid = false; } } else { lblMessage.ErrorMessage = Localization.GetString("ExistingUser", LocalResourceFile); lblMessage.IsValid = false; } return(-1); }
internal virtual bool IsAdminOrHost(UserInfo userInfo) { return userInfo.IsSuperUser || userInfo.IsInRole(PortalController.Instance.GetCurrentPortalSettings().AdministratorRoleName); }
bool IMetaWeblog.UpdatePost(string postid, string username, string password, Post post, bool publish) { LocatePortal(Context.Request); DotNetNuke.Entities.Users.UserInfo ui = Authenticate(username, password); if (ui.UserID > 0) { Article a = Article.GetArticle(Convert.ToInt32(postid), _portalId, true, true, true); a.Description = post.description; a.ArticleText = post.description; a.Name = post.title; a.VersionDescription = Localization.GetString("MetaBlogApi", LocalResourceFile); var pc = new List <Publish.Category>(); foreach (string s in post.categories) { Publish.Category c = Publish.Category.GetCategory(s, PortalId); pc.Add(c); } //remove all existing categories a.Relationships.Clear(); //add the parent category if (pc.Count > 0) { var irel = new ItemRelationship { RelationshipTypeId = Util.RelationshipType.ItemToParentCategory.GetId(), ParentItemId = pc[0].ItemId }; a.Relationships.Add(irel); } //add any extra categories if (pc.Count > 1) { for (int i = 1; i < pc.Count; i++) { var irel = new ItemRelationship { RelationshipTypeId = Util.RelationshipType.ItemToRelatedCategory.GetId(), ParentItemId = pc[i].ItemId }; a.Relationships.Add(irel); } } //remove existing tags a.Tags.Clear(); //check for tags if (post.mt_keywords.Trim() != string.Empty) { //split tags foreach (Tag t in Tag.ParseTags(post.mt_keywords, _portalId)) { ItemTag it = ItemTag.Create(); it.TagId = Convert.ToInt32(t.TagId, CultureInfo.InvariantCulture); a.Tags.Add(it); } } if (post.mt_excerpt != null && post.mt_excerpt.Trim() != string.Empty) { a.Description = post.mt_excerpt; } // handle approval process if (ModuleBase.UseApprovalsForPortal(_portalId)) { if (ui.IsInRole(HostController.Instance.GetString(Utility.PublishAdminRole + _portalId)) || ui.IsSuperUser) { a.ApprovalStatusId = ApprovalStatus.Approved.GetId(); } else if (ui.IsInRole(HostController.Instance.GetString(Utility.PublishAuthorRole + _portalId))) { a.ApprovalStatusId = ApprovalStatus.Waiting.GetId(); } } a.Save(ui.UserID); return(true); } throw new XmlRpcFaultException(0, Localization.GetString("FailedToUpdatePost.Text", LocalResourceFile)); }
private bool IsCommandAllowed(UserInfo user, string command) { var imageVisibility = !(user.IsSuperUser) || UserInfo.IsSuperUser; if (imageVisibility) { imageVisibility = !IsPortalAdministrator(user.UserID) && (!user.IsInRole(PortalSettings.AdministratorRoleName) || (PortalSecurity.IsInRole(PortalSettings.AdministratorRoleName))) && user.UserID != UserId; } if ((imageVisibility)) { switch (command) { case "Delete": if ((user.IsDeleted)) { imageVisibility = false; } break; case "Restore": case "Remove": imageVisibility = (user.IsDeleted); break; } } return imageVisibility; }
///<summary> /// Add a new blog post /// </summary> /// <param name="blogid">Blogid</param> /// <param name="username">username</param> /// <param name="password">password</param> /// <param name="post">post</param> /// <param name="publish">publish</param> string IMetaWeblog.AddPost(string blogid, string username, string password, Post post, bool publish) { LocatePortal(Context.Request); DotNetNuke.Entities.Users.UserInfo ui = Authenticate(username, password); if (ui != null) { //TODO: we need a default category for users, then we can allow theme detection in WLW var pc = new List <Publish.Category>(); foreach (string s in post.categories) { Publish.Category c = Publish.Category.GetCategory(s, PortalId); pc.Add(c); } //This only works for the first category, how should we handle other categories? if (pc.Count < 1) { Publish.Category c = Publish.Category.GetCategory(ModuleBase.DefaultCategoryForPortal(PortalId), PortalId); pc.Add(c); } if (pc.Count > 0) { //get description //string description = post.description.Substring(0,post.description.IndexOf(" //look for <!--pagebreak--> Article a = Article.Create(post.title, post.description, post.description, ui.UserID, pc[0].ItemId, pc[0].ModuleId, pc[0].PortalId); //TODO: check if dateCreated is a valid date //TODO: date Created is coming in as UTC time //TODO: re-enable Date created //a.StartDate = post.dateCreated.ToString(); a.VersionDescription = Localization.GetString("MetaBlogApi", LocalResourceFile); if (pc.Count > 1) { for (int i = 1; i < pc.Count; i++) { var irel = new ItemRelationship { RelationshipTypeId = Util.RelationshipType.ItemToRelatedCategory.GetId(), ParentItemId = pc[i].ItemId }; a.Relationships.Add(irel); } } //check for tags if (post.mt_keywords != null && post.mt_keywords.Trim() != string.Empty) { //split tags foreach (Tag t in Tag.ParseTags(post.mt_keywords, _portalId)) { ItemTag it = ItemTag.Create(); it.TagId = Convert.ToInt32(t.TagId, CultureInfo.InvariantCulture); a.Tags.Add(it); } } if (post.mt_excerpt != null && post.mt_excerpt.Trim() != string.Empty) { a.Description = post.mt_excerpt; } // handle approval process if (ModuleBase.UseApprovalsForPortal(_portalId)) { if (ui.IsInRole(HostController.Instance.GetString(Utility.PublishAdminRole + _portalId)) || ui.IsSuperUser) { a.ApprovalStatusId = ApprovalStatus.Approved.GetId(); } else if (ui.IsInRole(HostController.Instance.GetString(Utility.PublishAuthorRole + _portalId))) { a.ApprovalStatusId = ApprovalStatus.Waiting.GetId(); } } a.Save(ui.UserID); return(a.ItemId.ToString()); } throw new XmlRpcFaultException(0, Localization.GetString("PostCategoryFailed.Text", LocalResourceFile)); } throw new XmlRpcFaultException(0, Localization.GetString("FailedAuthentication.Text", LocalResourceFile)); }
/// <summary> /// Validates the roles. /// </summary> /// <param name="user">The user.</param> /// <param name="feedObj">The feed obj.</param> /// <returns><c>true</c> if XXXX, <c>false</c> otherwise</returns> private bool ValidateRoles(UserInfo user, Feed feedObj) { if(feedObj.Roles!="" && !user.IsSuperUser && !user.IsInRole("Administrators")) { bool isValid = false; foreach (string s in feedObj.Roles.Split(',')) { if(user.IsInRole(s.Trim()) || s.Trim()=="All Users") { isValid = true; break; } } return isValid; } return true; }
/// <summary> /// Add user to Nexso Database (userproperties), DotNetNuke Database(dnn_user) and roles to user /// </summary> /// <returns></returns> private int AddUser() { try { var eventlo = new DotNetNuke.Services.Log.EventLog.EventLogController(); int totalUsers = 0; UserController.GetUsersByUserName(PortalId, txtEmail.Text, 1, 1, ref totalUsers); if (totalUsers == 0) { var objUser = new DotNetNuke.Entities.Users.UserInfo(); objUser.AffiliateID = Null.NullInteger; objUser.Email = ValidateSecurity.ValidateString(txtEmail.Text, false); objUser.FirstName = ValidateSecurity.ValidateString(txtFirstName.Text, false); objUser.IsSuperUser = false; objUser.LastName = ValidateSecurity.ValidateString(txtLastName.Text, false); objUser.PortalID = PortalController.GetCurrentPortalSettings().PortalId; objUser.Username = ValidateSecurity.ValidateString(txtEmail.Text, false); objUser.DisplayName = ValidateSecurity.ValidateString(txtFirstName.Text, false) + " " + ValidateSecurity.ValidateString(txtLastName.Text, false); objUser.Membership.Password = txtPassword.Text; objUser.Membership.Email = objUser.Email; objUser.Membership.Username = objUser.Username; objUser.Membership.UpdatePassword = false; objUser.PortalID = PortalId; objUser.Membership.LockedOut = true; if (userId == -1000) { objUser.Membership.Approved = true; //pero impersonation } else { objUser.Membership.Approved = true; //regular creation } DotNetNuke.Security.Membership.UserCreateStatus objCreateStatus = DotNetNuke.Entities.Users.UserController.CreateUser(ref objUser); if (objCreateStatus == DotNetNuke.Security.Membership.UserCreateStatus.Success) { if (objUser != null) { CompleteUserCreation(DotNetNuke.Security.Membership.UserCreateStatus.Success, objUser, true, IsRegister); UserInfo myDnnUser = objUser; myDnnUser.Profile.InitialiseProfile(myDnnUser.PortalID); SaveProfile(myDnnUser); UserController.UpdateUser(myDnnUser.PortalID, myDnnUser); UserPropertyComponent userProperty = new UserPropertyComponent(objUser.UserID); if (userProperty.UserProperty != null) { currentUser = objUser; var ret = SaveProfile(userProperty.UserProperty); if (ret >= 0) { userProperty.Save(); } if (!objUser.IsInRole("Registered Users")) { var oDnnRoleController = new RoleController(); RoleInfo oCurrentRole = oDnnRoleController.GetRoleByName(this.PortalId, "Registered Users"); oDnnRoleController.AddUserRole(this.PortalId, objUser.UserID, oCurrentRole.RoleID, System.DateTime.Now.AddDays(-1), DotNetNuke.Common.Utilities.Null.NullDate); } if (!objUser.IsInRole("NexsoUser")) { var oDnnRoleController = new RoleController(); RoleInfo oCurrentRole = oDnnRoleController.GetRoleByName(this.PortalId, "NexsoUser"); oDnnRoleController.AddUserRole(this.PortalId, objUser.UserID, oCurrentRole.RoleID, System.DateTime.Now.AddDays(-1), DotNetNuke.Common.Utilities.Null.NullDate); } return(objUser.UserID); } else { eventlo.AddLog("NEXSO Object Null", "Trace NEXSO", PortalSettings, -1, DotNetNuke.Services.Log.EventLog.EventLogController.EventLogType.ADMIN_ALERT); } } else { eventlo.AddLog("Object null cration nexso", "Trace NEXSO", PortalSettings, -1, DotNetNuke.Services.Log.EventLog.EventLogController.EventLogType.ADMIN_ALERT); } } else { //lblMessage.ErrorMessage = Localization.GetString("ExistingUser", // LocalResourceFile); //lblMessage.IsValid = false; } } else { //lblMessage.ErrorMessage = Localization.GetString("ExistingUser", // LocalResourceFile); //lblMessage.IsValid = false; } } catch (Exception exc) //Module failed to load { Exceptions. ProcessModuleLoadException( this, exc); } return(-1); }