コード例 #1
0
 public AllowedActions(UserInfo userInfo)
 {
     var isOwner = userInfo.IsOwner();
     var isMe = userInfo.IsMe();
     AllowAddOrDelete = SecurityContext.CheckPermissions(ASC.Core.Users.Constants.Action_AddRemoveUser) && (!isOwner || isMe);
     AllowEdit = SecurityContext.CheckPermissions(new UserSecurityProvider(userInfo.ID), ASC.Core.Users.Constants.Action_EditUser) && (!isOwner || isMe);
 }
コード例 #2
0
        public ProfileHelper(string userNameOrUserId)
        {
            if (SecurityContext.IsAuthenticated)
            {
                userNameOrUserId = String.IsNullOrEmpty(userNameOrUserId) ? SecurityContext.CurrentAccount.ID.ToString() : userNameOrUserId;
            }

            if (!String.IsNullOrEmpty(userNameOrUserId))
            {
                UserInfo = CoreContext.UserManager.GetUserByUserName(userNameOrUserId);
            }

            if (UserInfo == null || UserInfo.Equals(Constants.LostUser))
            {
                var userID = Guid.Empty;
                if (!String.IsNullOrEmpty(userNameOrUserId))
                {
                    try
                    {
                        userID = new Guid(userNameOrUserId);
                    }
                    catch
                    {
                        userID = SecurityContext.CurrentAccount.ID;
                    }
                }

                if (!CoreContext.UserManager.UserExists(userID))
                {
                    userID = SecurityContext.CurrentAccount.ID;
                }

                UserInfo = CoreContext.UserManager.GetUsers(userID);
            }
        }
コード例 #3
0
ファイル: SmsManager.cs プロジェクト: vipwan/CommunityServer
        public static string SaveMobilePhone(UserInfo user, string mobilePhone)
        {
            mobilePhone = GetPhoneValueDigits(mobilePhone);

            if (user == null || Equals(user, Constants.LostUser)) throw new Exception(Resource.ErrorUserNotFound);
            if (string.IsNullOrEmpty(mobilePhone)) throw new Exception(Resource.ActivateMobilePhoneEmptyPhoneNumber);
            if (!string.IsNullOrEmpty(user.MobilePhone) && user.MobilePhoneActivationStatus == MobilePhoneActivationStatus.Activated) throw new Exception(Resource.MobilePhoneMustErase);

            user.MobilePhone = mobilePhone;
            user.MobilePhoneActivationStatus = MobilePhoneActivationStatus.NotActivated;
            if (SecurityContext.IsAuthenticated)
            {
                CoreContext.UserManager.SaveUserInfo(user);
            }
            else
            {
                try
                {
                    SecurityContext.AuthenticateMe(ASC.Core.Configuration.Constants.CoreSystem);
                    CoreContext.UserManager.SaveUserInfo(user);
                }
                finally
                {
                    SecurityContext.Logout();
                }
            }

            if (StudioSmsNotificationSettings.Enable)
            {
                PutAuthCode(user, false);
            }

            return mobilePhone;
        }
コード例 #4
0
        public static UserInfo GetUser(Guid userGuid)
        {
            UserInfo ui = new UserInfo();
            ui.FirstName = "User";
            ui.LastName = "Lost";

            return ui;
        }
コード例 #5
0
ファイル: Global.cs プロジェクト: Inzaghi2012/teamlab.v7.5
        public static string GetHTMLUserAvatar(UserInfo user)
        {
            var imgPath = user.GetBigPhotoURL();
            if (imgPath != null)
                return "<img class=\"userMiniPhoto\" alt='' src=\"" + imgPath + "\"/>";

            return "";
        }
コード例 #6
0
ファイル: UserAccount.cs プロジェクト: vipwan/CommunityServer
 public UserAccount(UserInfo info, int tenant)
 {
     ID = info.ID;
     Name = UserFormatter.GetUserName(info);
     FirstName = info.FirstName;
     LastName = info.LastName;
     Title = info.Title;
     Tenant = tenant;
     Email = info.Email;            
 }
コード例 #7
0
 public EmployeeWraper(UserInfo userInfo)
 {
     Id = userInfo.ID;
     DisplayName = DisplayUserSettings.GetFullUserName(userInfo);
     if (!string.IsNullOrEmpty(userInfo.Title))
     {
         Title = userInfo.Title;
     }
     AvatarSmall = UserPhotoManager.GetSizedPhotoUrl(userInfo.ID, 64, 64);
 }
コード例 #8
0
        protected EmployeeWraper(UserInfo userInfo)
        {
            this.userInfo = userInfo;
            Id = userInfo.ID;

            if (!string.IsNullOrEmpty(userInfo.Title))
            {
                Title = userInfo.Title;
            }

            AvatarSmall = UserPhotoManager.GetSizedPhotoUrl(userInfo.ID, 64, 64);
        }
コード例 #9
0
        public static void DeletePost(Post post, UserInfo author)
        {
            var ua =
                ApplyCustomeActivityParams(
                    ComposeActivityByPost(post),
                    ASC.Blogs.Core.Resources.BlogsResource.UserActivity_DeletePost,
                    author.ID,
                    UserActivityConstants.ActivityActionType,
                    Constants.DeletePostBusinessValue);

            PublishInternal(ua);
        }
コード例 #10
0
        public UserInfo SaveUser(int tenant, UserInfo user)
        {
            if (user == null) throw new ArgumentNullException("user");
            if (string.IsNullOrEmpty(user.UserName)) throw new ArgumentOutOfRangeException("Empty username.");

            if (user.ID == default(Guid)) user.ID = Guid.NewGuid();
            user.LastModified = DateTime.UtcNow;
            user.Tenant = tenant;

            ExecAction(db =>
            {
                user.UserName = user.UserName.Trim();
                var q = Query("core_user", tenant)
                    .SelectCount()
                    .Where("username", user.UserName)
                    .Where(!Exp.Eq("id", user.ID.ToString()))
                    .Where("removed", false);
                var count = db.ExecScalar<int>(q);
                if (count != 0)
                {
                    throw new ArgumentOutOfRangeException("Duplicate username.");
                }

                var i = Insert("core_user", tenant)
                    .InColumnValue("id", user.ID.ToString())
                    .InColumnValue("username", user.UserName)
                    .InColumnValue("firstname", user.FirstName)
                    .InColumnValue("lastname", user.LastName)
                    .InColumnValue("sex", user.Sex)
                    .InColumnValue("bithdate", user.BirthDate)
                    .InColumnValue("status", user.Status)
                    .InColumnValue("title", user.Title)
                    .InColumnValue("department", user.Department)
                    .InColumnValue("workfromdate", user.WorkFromDate)
                    .InColumnValue("terminateddate", user.TerminatedDate)
                    .InColumnValue("contacts", user.ContactsToString())
                    .InColumnValue("email", string.IsNullOrEmpty(user.Email) ? user.Email : user.Email.Trim())
                    .InColumnValue("location", user.Location)
                    .InColumnValue("notes", user.Notes)
                    .InColumnValue("removed", user.Removed)
                    .InColumnValue("last_modified", user.LastModified)
                    .InColumnValue("activation_status", user.ActivationStatus)
                    .InColumnValue("culture", user.CultureName)
                    .InColumnValue("phone", user.MobilePhone)
                    .InColumnValue("phone_activation", user.MobilePhoneActivationStatus)
                    ;

                db.ExecNonQuery(i);
            });

            return user;
        }
コード例 #11
0
ファイル: Formatter.cs プロジェクト: ridhouan/teamlab.v6.5
 public static VelocityContext PrepareContext(UserActivity userActivity, UserInfo user)
 {
     var velocitycontext = new VelocityContext();
     velocitycontext.Put("activity", userActivity);
     velocitycontext.Put("url", CommonLinkUtility.GetFullAbsolutePath(userActivity.URL));
     velocitycontext.Put("user", user);
     velocitycontext.Put("displayName", user.DisplayUserName());
     velocitycontext.Put("userLink", CommonLinkUtility.GetFullAbsolutePath(CommonLinkUtility.GetUserProfile(user.ID, userActivity.ProductID)));
     velocitycontext.Put("moduleName", GetModuleName(userActivity));
     velocitycontext.Put("productName", GetProductName(userActivity));
     velocitycontext.Put("additionalData", userActivity.AdditionalData);
     return velocitycontext;
 }
コード例 #12
0
 public static string GetFullUserName(UserInfo userInfo, DisplayUserNameFormat format, bool withHtmlEncode)
 {
     if (userInfo == null)
     {
         return string.Empty;
     }
     if (!userInfo.ID.Equals(Guid.Empty) && !CoreContext.UserManager.UserExists(userInfo.ID))
     {
         return "profile removed";
     }
     var result = UserFormatter.GetUserName(userInfo, format);
     return withHtmlEncode ? result.HtmlEncode() : result;
 }
コード例 #13
0
ファイル: ASCUserStore.cs プロジェクト: ridhouan/teamlab.v6.5
		private User ToUser(UserInfo userInfo, string domain)
		{
			try
			{
				if (string.IsNullOrEmpty(userInfo.UserName)) return null;
				return new User(
					new Jid(userInfo.UserName.ToLowerInvariant() + "@" + domain.ToLowerInvariant()),
					ASCContext.Authentication.GetUserPasswordHash(userInfo.ID),
					ASCContext.UserManager.IsUserInGroup(userInfo.ID, Constants.GroupAdmin.ID)
				);
			}
			catch { }
			return null;
		}
コード例 #14
0
        private static string MakeUniqueName(UserInfo userInfo)
        {
            if (string.IsNullOrEmpty(userInfo.Email))
                throw new ArgumentException(Resources.Resource.ErrorEmailEmpty, "userInfo");

            var uniqueName = new MailAddress(userInfo.Email).User;
            var startUniqueName = uniqueName;
            var i = 0;
            while (!TestUniqueUserName(uniqueName))
            {
                uniqueName = string.Format("{0}{1}", startUniqueName, (++i).ToString(CultureInfo.InvariantCulture));
            }
            return uniqueName;
        }
コード例 #15
0
        protected void Page_Load(object sender, EventArgs e)
        {
            GetApiData();

            IsMobile = Core.Mobile.MobileDetector.IsRequestMatchesMobile(Context);

            fckEditor.BasePath = CommonControlsConfigurer.FCKEditorBasePath;
            fckEditor.ToolbarSet = "BlogToolbar";
            fckEditor.EditorAreaCSS = WebSkin.GetUserSkin().BaseCSSFileAbsoluteWebPath;
            fckEditor.Visible = !IsMobile;

            var discussionParticipants = new List<Participant>();
            
            if (Discussion != null)
            {
                discussionTitle.Text = Discussion.Title;
                if (!IsMobile)
                {
                    fckEditor.Value = Discussion.Content;
                }
                else
                {
                    discussionContent.Text = Discussion.Content;
                }
                
                recipients = NotifySource.Instance.GetSubscriptionProvider()
                    .GetRecipients(NotifyConstants.Event_NewCommentForMessage, String.Format("{0}_{1}", Discussion.UniqID, Discussion.Project.ID));

                discussionParticipants.AddRange(recipients.Select(r => Global.EngineFactory.GetParticipantEngine().GetByID(new Guid(r.ID))));
                Author = CoreContext.UserManager.GetUsers(Discussion.CreateBy);
            }
            else if (Project != null)
            {
                var projectParticipants = Global.EngineFactory.GetProjectEngine().GetTeam(Project.ID)
                    .OrderBy(p => p.UserInfo, UserInfoComparer.Default)
                    .ToList();
                discussionParticipants.AddRange(projectParticipants);
            }

            Author = CoreContext.UserManager.GetUsers(SecurityContext.CurrentAccount.ID);

            discussionParticipantRepeater.DataSource = discussionParticipants;
            discussionParticipantRepeater.DataBind();

            LoadDiscussionParticipantsSelector();

            LoadDiscussionFilesControl();
        }
コード例 #16
0
        ///<summary>
        ///</summary>
        ///<param name="userInfo"></param>
        protected EmployeeWraper(UserInfo userInfo)
        {
            _userInfo = userInfo;
            Id = userInfo.ID;


            Title = userInfo.Title;
            try
            {
                AvatarSmall = UserPhotoManager.GetSizedPhotoUrl(userInfo.ID, 64, 64);
            }
            catch
            {
                //Go to hell with these
            }
        }
コード例 #17
0
ファイル: RequestInfo.cs プロジェクト: ridhouan/teamlab.v6.5
		public RequestInfo(HttpRequest request)
		{
			try
			{
				if (!string.IsNullOrEmpty(request["uid"]))
				{
					UserId = new Guid(request["uid"]);
					if (UserId != Guid.Empty)
					{
						HasUser = true;
						UserIdAttribute = string.Format(CultureInfo.CurrentCulture, "&uid={0}", UserId);
						User = CoreContext.UserManager.GetUsers(UserId);
					}
				}
			}
			catch { }
		}
コード例 #18
0
        protected void Page_Load(object sender, EventArgs e)
        {
            userInfo = CoreContext.UserManager.GetUsers(SecurityContext.CurrentAccount.ID);
            IsAdmin = userInfo.IsAdmin();
            Actions = new AllowedActions(userInfo);

            var quota = TenantExtra.GetTenantQuota();
            IsFreeTariff = quota.Free && !quota.Open;

            _confirmationDeleteDepartmentPanel.Options.IsPopup = true;
            _resendInviteDialog.Options.IsPopup = true;
            _changeStatusDialog.Options.IsPopup = true;
            _changeTypeDialog.Options.IsPopup = true;
            _deleteUsersDialog.Options.IsPopup = true;
            _deleteProfileContainer.Options.IsPopup = true;

            var emptyContentForPeopleFilter = new EmptyScreenControl
                {
                    ID = "emptyContentForPeopleFilter",
                    ImgSrc = WebImageSupplier.GetAbsoluteWebPath("empty_screen_filter.png"),
                    Header = PeopleResource.NotFoundTitle,
                    Describe = PeopleResource.NotFoundDescription,
                    ButtonHTML = String.Format(@"<a class='clearFilterButton link dotline' href='javascript:void(0);' 
                                            onclick='ASC.People.PeopleController.resetAllFilters();'>{0}</a>",
                                               PeopleResource.ClearButton),
                    CssClass = "display-none"
                };

            emptyScreen.Controls.Add(emptyContentForPeopleFilter);


            var controlEmailChange = (UserEmailChange)LoadControl(UserEmailChange.Location);
            controlEmailChange.UserInfo = userInfo;
            userEmailChange.Controls.Add(controlEmailChange);

            loaderHolder.Controls.Add(LoadControl(LoaderPage.Location));
            userConfirmationDelete.Controls.Add(LoadControl(ConfirmationDeleteUser.Location));

            if (Actions.AllowEdit)
            {
                userPwdChange.Controls.Add(LoadControl(PwdTool.Location));
            }
            Title = HeaderStringHelper.GetPageTitle(PeopleResource.ProductName);
        }
コード例 #19
0
 public static void SendInstallInfo(UserInfo user)
 {
     try
     {
         StudioNotifyService.Instance.SendCongratulations(user);
     }
     catch (Exception error)
     {
         LogManager.GetLogger("ASC.Web").Error(error);
     }
     try
     {
         var url = WebConfigurationManager.AppSettings["web.install-url"];
         if (!string.IsNullOrEmpty(url))
         {
             var tenant = CoreContext.TenantManager.GetCurrentTenant();
             var q = new MailQuery
             {
                 Email = user.Email,
                 Id = CoreContext.Configuration.GetKey(tenant.TenantId),
                 Alias = tenant.TenantDomain,
             };
             var index = url.IndexOf("?v=");
             if (0 < index)
             {
                 q.Version = url.Substring(index + 3);
                 url = url.Substring(0, index);
             }
             using (var webClient = new WebClient())
             {
                 var values = new NameValueCollection();
                 values.Add("query", Signature.Create<MailQuery>(q, "4be71393-0c90-41bf-b641-a8d9523fba5c"));
                 webClient.UploadValues(url, values);
             }
         }
     }
     catch (Exception error)
     {
         LogManager.GetLogger("ASC.Web").Error(error);
     }
 }
コード例 #20
0
        public ProfileHelper(string id)
        {
            if (SecurityContext.IsAuthenticated)
            {
                id = String.IsNullOrEmpty(id) ? SecurityContext.CurrentAccount.ID.ToString() : id;
                ownInfo = CoreContext.UserManager.GetUsers(SecurityContext.CurrentAccount.ID);
            }

            if (!String.IsNullOrEmpty(id))
            {
                UserInfo = CoreContext.UserManager.GetUserByUserName(id);
            }

            if (UserInfo == null || UserInfo.Equals(Constants.LostUser))
            {
                if (!String.IsNullOrEmpty(id))
                {
                    try
                    {
                        userID = new Guid(id);
                    }
                    catch
                    {
                        userID = SecurityContext.CurrentAccount.ID;
                    }
                }

                if (!CoreContext.UserManager.UserExists(userID))
                {
                    userID = SecurityContext.CurrentAccount.ID;
                }
                UserInfo = CoreContext.UserManager.GetUsers(userID);
            }
            else
            {
                userID = UserInfo.ID;
            }

            userProfile = new MyUserProfile(userID);
        }
コード例 #21
0
        private void ActivateUser(UserInfo user, string newPwd)
        {
            try
            {
                //Set status to activated
                user.ActivationStatus = EmployeeActivationStatus.Activated;
                SecurityContext.AuthenticateMe(ASC.Core.Configuration.Constants.CoreSystem);
                CoreContext.UserManager.SaveUserInfo(user);
                if (!string.IsNullOrEmpty(newPwd))
                {
                    //set password if it's specified
                    SecurityContext.SetUserPassword(user.ID, newPwd);
                }
            }
            catch (Exception ex)
            {
                ShowError(ex.Message);
            }
            finally
            {
                SecurityContext.Logout(); //Logout from core system
            }
            //Login user
            try
            {
                var cookiesKey = SecurityContext.AuthenticateMe(user.ID.ToString(),
                                                                   CoreContext.Authentication.GetUserPasswordHash(user.ID));

                CookiesManager.SetCookies(CookiesType.UserID, user.ID.ToString());
                CookiesManager.SetCookies(CookiesType.AuthKey, cookiesKey);
               
            }
            catch (Exception exception)
            {
                ShowError(exception.Message);
                return;
            }
            UserOnlineManager.Instance.RegistryOnlineUser(SecurityContext.CurrentAccount.ID);
            WebItemManager.Instance.ItemGlobalHandlers.Login(SecurityContext.CurrentAccount.ID);
        }
コード例 #22
0
        public string RegisterTenant(TenantRegistrationInfo ri, out Tenant tenant)
        {
            tenant = null;

            if (ri == null) throw new ArgumentNullException("registrationInfo");
            if (string.IsNullOrEmpty(ri.Name)) throw new Exception("Community name can not be empty");
            if (string.IsNullOrEmpty(ri.Address)) throw new Exception("Community address can not be empty");

            if (string.IsNullOrEmpty(ri.Email)) throw new Exception("Account email can not be empty");
            if (string.IsNullOrEmpty(ri.FirstName)) throw new Exception("Account firstname can not be empty");
            if (string.IsNullOrEmpty(ri.LastName)) throw new Exception("Account lastname can not be empty");
            if (string.IsNullOrEmpty(ri.Password)) ri.Password = Crypto.GeneratePassword(6);

            // create tenant
            tenant = new Tenant(ri.Address.ToLowerInvariant())
            {
                Name = ri.Name,
                Language = ri.Culture.Name,
                TimeZone = ri.TimeZoneInfo,
            };
            tenant = tenantService.SaveTenant(tenant);

            // create user
            var user = new UserInfo()
            {
                UserName = ri.Email.Substring(0, ri.Email.IndexOf('@')),
                LastName = ri.LastName,
                FirstName = ri.FirstName,
                Email = ri.Email,
            };
            user = userService.SaveUser(tenant.TenantId, user);
            userService.SetUserPassword(tenant.TenantId, user.ID, ri.Password);
            userService.SaveUserGroupRef(tenant.TenantId, new UserGroupRef(user.ID, Constants.GroupAdmin.ID, UserGroupRefType.Contains));

            // save tenant owner
            tenant.OwnerId = user.ID;
            tenant = tenantService.SaveTenant(tenant);

            return CreateAuthenticationCookie(tenant.TenantId, user.ID);
        }
コード例 #23
0
        public static UserInfo AddUser(UserInfo userInfo, string password, bool afterInvite, bool notify)
        {
            if (userInfo == null) throw new ArgumentNullException("userInfo");

            CheckPasswordPolicy(password);

            if (!CheckUniqueEmail(userInfo.ID, userInfo.Email))
                throw new Exception(CustomNamingPeople.Substitute<Resources.Resource>("ErrorEmailAlreadyExists"));

            userInfo.UserName = MakeUniqueName(userInfo);
            if (!userInfo.WorkFromDate.HasValue)
            {
                userInfo.WorkFromDate = TenantUtil.DateTimeNow();
            }

            if (!afterInvite)
                userInfo.ActivationStatus = EmployeeActivationStatus.Pending;
            else
                userInfo.ActivationStatus = EmployeeActivationStatus.Activated;

            var newUserInfo = CoreContext.UserManager.SaveUserInfo(userInfo);
            CoreContext.Authentication.SetUserPassword(newUserInfo.ID, password);

            if ((newUserInfo.Status & EmployeeStatus.Active) == EmployeeStatus.Active && notify)
            {
                //NOTE: Notify user only if it's active
                if (afterInvite)
                {
                    StudioNotifyService.Instance.UserInfoAddedAfterInvite(newUserInfo, password);
                }
                else
                {
                    //Send user invite
                    StudioNotifyService.Instance.UserInfoActivation(newUserInfo);
                }
            }

            return newUserInfo;
        }
コード例 #24
0
        private UserInfo GetExportedUser(string line, IDictionary<int, PropertyInfo> mappedProperties, int fieldsCount)
        {
            var exportedUser = new UserInfo();
            exportedUser.ID = Guid.NewGuid();

            var dataFields = GetDataFields(line);
            for (int j = 0; j < Math.Min(fieldsCount, dataFields.Length); j++)
            {
                //Get corresponding property
                var propinfo = mappedProperties[j];
                if (propinfo != null)
                {
                    //Convert value
                    object value = ConvertFromString(dataFields[j], propinfo.PropertyType);
                    if (value != null)
                    {
                        propinfo.SetValue(exportedUser, value, new object[] { });
                    }
                }
            }
            return exportedUser;
        }
コード例 #25
0
        private void FillConacts(UserInfo userInfo)
        {
            var contacts = new List<Contact>();
            for (var i = 0; i < userInfo.Contacts.Count; i += 2)
            {
                if (i + 1 < userInfo.Contacts.Count)
                {
                    contacts.Add(new Contact(userInfo.Contacts[i], userInfo.Contacts[i + 1]));
                }
            }

            if (contacts.Any())
            {
                Contacts = contacts;
            }
        }
コード例 #26
0
        public EmployeeWraperFull(UserInfo userInfo, ApiContext context)
            : base(userInfo)
        {
            UserName = userInfo.UserName;
            IsVisitor = userInfo.IsVisitor();
            FirstName = userInfo.FirstName;
            LastName = userInfo.LastName;
            Birthday = (ApiDateTime)userInfo.BirthDate;

            if (userInfo.Sex.HasValue)
                Sex = userInfo.Sex.Value ? "male" : "female";

            Status = userInfo.Status;
            ActivationStatus = userInfo.ActivationStatus;
            Terminated = (ApiDateTime)userInfo.TerminatedDate;

            if (!string.IsNullOrEmpty(userInfo.Department))
                Department = userInfo.Department;

            WorkFrom = (ApiDateTime)userInfo.WorkFromDate;
            Email = userInfo.Email;

            if (!string.IsNullOrEmpty(userInfo.Location))
                Location = userInfo.Location;

            if (!string.IsNullOrEmpty(userInfo.Notes))
                Notes = userInfo.Notes;

            if (!string.IsNullOrEmpty(userInfo.MobilePhone))
                MobilePhone = userInfo.MobilePhone;

            MobilePhoneActivationStatus = userInfo.MobilePhoneActivationStatus;

            if (!string.IsNullOrEmpty(userInfo.CultureName))
                CultureName = userInfo.CultureName;

            FillConacts(userInfo);

            var groups = Core.CoreContext.UserManager.GetUserGroups(userInfo.ID).Select(x => new GroupWrapperSummary(x)).ToList();

            if (groups.Any())
                Groups = groups;

            try
            {
                if (CheckContext(context, "avatarSmall"))
                    AvatarSmall = UserPhotoManager.GetSmallPhotoURL(userInfo.ID);

                if (CheckContext(context, "avatarMedium"))
                    AvatarMedium = UserPhotoManager.GetMediumPhotoURL(userInfo.ID);

                if (CheckContext(context, "avatar"))
                    Avatar = UserPhotoManager.GetBigPhotoURL(userInfo.ID);
            }
            catch (Exception)
            {
            }

            try
            {
                IsOnline = false;
                IsAdmin = userInfo.IsAdmin();

                if (CheckContext(context, "listAdminModules"))
                {
                    var listAdminModules = userInfo.GetListAdminModules();

                    if (listAdminModules.Any())
                        ListAdminModules = listAdminModules;
                }

                IsOwner = userInfo.IsOwner();
            }
            catch (Exception)
            {
            }
        }
コード例 #27
0
 ///<summary>
 ///</summary>
 ///<param name="userInfo"></param>
 ///<exception cref="ArgumentException"></exception>
 public EmployeeWraperFull(UserInfo userInfo) : this(userInfo, null)
 {
    
 }
コード例 #28
0
        public static string GetUserParamsPair(UserInfo user)
        {
            if (user == null || string.IsNullOrEmpty(user.UserName))
                return "";

            return String.Format("{0}={1}", ParamName_UserUserName, HttpUtility.UrlEncode(user.UserName.ToLowerInvariant()));
        }
コード例 #29
0
 public void SendCongratulations(UserInfo u)
 {
     var tariff = CoreContext.TenantManager.GetTenantQuota(CoreContext.TenantManager.GetCurrentTenant().TenantId);
     client.SendNoticeToAsync(
         tariff != null && tariff.Trial ? Constants.ActionCongratulations : Constants.ActionCongratulationsNoTrial,
         null,
         RecipientFromEmail(new[] { u.Email.ToLower() }, false),
         new[] { EMailSenderName },
         null,
         new TagValue(Constants.TagUserName, u.DisplayUserName()),
         new TagValue(Constants.TagUserEmail, u.Email),
         new TagValue(Constants.TagMyStaffLink, GetMyStaffLink()),
         new TagValue(Constants.TagSettingsLink, CommonLinkUtility.GetAdministration(ManagementType.General)),
         new TagValue(Constants.TagInviteLink, CommonLinkUtility.GetConfirmationUrl(u.Email, ConfirmType.EmailActivation)),
         Constants.TagNoteStart,
         Constants.TagNoteEnd,
         new TagValue(CommonTags.WithPhoto, "links"));
 }
コード例 #30
0
 public void GuestInfoActivation(UserInfo newUserInfo)
 {
     if (newUserInfo.IsActive)
     {
         throw new ArgumentException("User is already activated!");
     }
     client.SendNoticeToAsync(
         Constants.ActionActivateGuests,
         null,
         RecipientFromEmail(new[] { newUserInfo.Email.ToLower() }, false),
         new[] { EMailSenderName },
         null,
         new TagValue(Constants.TagInviteLink, GenerateActivationConfirmUrl(newUserInfo)),
         new TagValue(Constants.TagUserName, newUserInfo.DisplayUserName()),
         CreateSendFromTag());
 }