• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# Users.UserInfo类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中ASC.Core.Users.UserInfo的典型用法代码示例。如果您正苦于以下问题:C# UserInfo类的具体用法?C# UserInfo怎么用?C# UserInfo使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



UserInfo类属于ASC.Core.Users命名空间,在下文中一共展示了UserInfo类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: AllowedActions

 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);
 }
开发者ID:Inzaghi2012,项目名称:teamlab.v7.5,代码行数:7,代码来源:UserProfileControl.ascx.cs


示例2: ProfileHelper

        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);
            }
        }
开发者ID:haoasqui,项目名称:ONLYOFFICE-Server,代码行数:35,代码来源:ProfileHelper.cs


示例3: SaveMobilePhone

        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;
        }
开发者ID:vipwan,项目名称:CommunityServer,代码行数:34,代码来源:SmsManager.cs


示例4: GetUser

        public static UserInfo GetUser(Guid userGuid)
        {
            UserInfo ui = new UserInfo();
            ui.FirstName = "User";
            ui.LastName = "Lost";

            return ui;
        }
开发者ID:Inzaghi2012,项目名称:teamlab.v7.5,代码行数:8,代码来源:NotFoundUser.cs


示例5: GetHTMLUserAvatar

        public static string GetHTMLUserAvatar(UserInfo user)
        {
            var imgPath = user.GetBigPhotoURL();
            if (imgPath != null)
                return "<img class=\"userMiniPhoto\" alt='' src=\"" + imgPath + "\"/>";

            return "";
        }
开发者ID:Inzaghi2012,项目名称:teamlab.v7.5,代码行数:8,代码来源:Global.cs


示例6: UserAccount

 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;            
 }
开发者ID:vipwan,项目名称:CommunityServer,代码行数:10,代码来源:UserAccount.cs


示例7: EmployeeWraper

 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);
 }
开发者ID:vipwan,项目名称:CommunityServer,代码行数:10,代码来源:EmployeeWraper.cs


示例8: EmployeeWraper

        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);
        }
开发者ID:haoasqui,项目名称:ONLYOFFICE-Server,代码行数:12,代码来源:EmployeeWraper.cs


示例9: DeletePost

        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);
        }
开发者ID:ridhouan,项目名称:teamlab.v6.5,代码行数:12,代码来源:BlogUserActivityPublisher.cs


示例10: SaveUser

        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;
        }
开发者ID:ridhouan,项目名称:teamlab.v6.5,代码行数:52,代码来源:DbUserService.cs


示例11: PrepareContext

 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;
 }
开发者ID:ridhouan,项目名称:teamlab.v6.5,代码行数:13,代码来源:Formatter.cs


示例12: GetFullUserName

 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;
 }
开发者ID:vipwan,项目名称:CommunityServer,代码行数:13,代码来源:DisplayUserSettings.cs


示例13: ToUser

		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;
		}
开发者ID:ridhouan,项目名称:teamlab.v6.5,代码行数:14,代码来源:ASCUserStore.cs


示例14: MakeUniqueName

        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;
        }
开发者ID:vipwan,项目名称:CommunityServer,代码行数:14,代码来源:UserManagerWrapper.cs


示例15: Page_Load

        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();
        }
开发者ID:ridhouan,项目名称:teamlab.v6.5,代码行数:48,代码来源:DiscussionAction.ascx.cs


示例16: EmployeeWraper

        ///<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
            }
        }
开发者ID:ridhouan,项目名称:teamlab.v6.5,代码行数:19,代码来源:EmployeeWraper.cs


示例17: Page_Load

        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);
        }
开发者ID:vipwan,项目名称:CommunityServer,代码行数:44,代码来源:Default.aspx.cs


示例18: SendInstallInfo

 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);
     }
 }
开发者ID:haoasqui,项目名称:ONLYOFFICE-Server,代码行数:41,代码来源:FirstTimeTenantSettings.cs


示例19: ProfileHelper

        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);
        }
开发者ID:Inzaghi2012,项目名称:teamlab.v7.5,代码行数:40,代码来源:ProfileHelper.cs


示例20: ActivateUser

        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);
        }
开发者ID:ridhouan,项目名称:teamlab.v6.5,代码行数:40,代码来源:ConfirmActivation.ascx.cs



注:本文中的ASC.Core.Users.UserInfo类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# Core.File类代码示例发布时间:2022-05-24
下一篇:
C# Tenants.Tenant类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap