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

C# Principal类代码示例

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

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



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

示例1: HasPermission

        public bool HasPermission(Principal principal, AclType aclType)
        {
            if (principal == null)
            {
                throw new ArgumentNullException("principal");
            }

            bool hasPermission = false;

            // if the principal and owner are the same, there is no need to
            // go to the DB

            if (principal.PrincipalId == this.Owner.PrincipalId)
            {
                hasPermission = true;
            }
            else
            {
                AclType permissions = AclsDbInteractor.Instance.GetAcls(this.ResourceId, GetActorId(), principal.PrincipalId);
                if (permissions != AclType.None)
                {
                    if ((permissions | aclType) == aclType)
                    {
                        hasPermission = true;
                    }
                }
            }

            return hasPermission;
        }
开发者ID:ratnazone,项目名称:ratna,代码行数:30,代码来源:Resource.cs


示例2: ControlBusquedaSocio

 public ControlBusquedaSocio(Principal principal, Operaciones operacion)
 {
     InitializeComponent();
     ConfiguracionComponentes();
     this.principal = principal;
     this.operacion = operacion;
 }
开发者ID:Fhernd,项目名称:CUPI2.NET-APO1-N4-ClubSocial,代码行数:7,代码来源:ControlBusquedaSocio.cs


示例3: ControlAfiliacion

        /// <summary>
        /// Crea un nuevo control de afiliación.
        /// </summary>
        /// <param name="principal">Referencia al formulario principal de la aplicación.</param>
        public ControlAfiliacion(Principal principal)
        {
            InitializeComponent();
            ConfiguracionComponentes();

            this.principal = principal;
        }
开发者ID:Fhernd,项目名称:CUPI2.NET-APO1-N4-ClubSocial,代码行数:11,代码来源:ControlAfiliacion.cs


示例4: ContrasenatextBox_KeyDown

        private void ContrasenatextBox_KeyDown(object sender, KeyEventArgs e)
        {
            if (e.KeyCode == Keys.Enter)
            {
               registro.NombreUsuario = NombretextBox.Text;
                registro.Contrasena = ContrasenatextBox.Text;

                if (registro.Login())
                {
                    if (NombretextBox.Text == registro.NombreUsuario && ContrasenatextBox.Text == registro.Contrasena)
                    {
                        Principal principal = new Principal();
                        principal.Show();
                        this.Visible = false;
                    }

                }
                else
                {

                    errorProvider.SetError(NombretextBox, "Usuario Incorrecto");
                    errorProvider.SetError(ContrasenatextBox, "Contrasena Incorrecta");

                }
            }
        }
开发者ID:elnata93,项目名称:CocoaExport,代码行数:26,代码来源:Login.cs


示例5: DatosPersonales

 public DatosPersonales(Principal p, Usuario us)
 {
     InitializeComponent();
     this.usuario = us;
     this.padre = p;
     //Pongo para que el cursor aparezca en el campo EMAIL
     emailTextBox.Select();
 }
开发者ID:jorgeeliecerballesteros,项目名称:controldeacceso,代码行数:8,代码来源:DatosPersonales.cs


示例6: AdUser

 public AdUser(Principal principal, IEnumerable<Principal> groups)
 {
     Name = principal.DisplayName;
     Login = principal.SamAccountName;
     Mail = principal.GetMail();
     Phone = principal.GetPhone();
     Company = principal.GetCompany();
     AdGroups = groups.Select(x => new AdGroup { Name = x.DisplayName, Code = x.SamAccountName }).ToArray();
 }
开发者ID:RenanMOliveira1,项目名称:AdAuthenticator,代码行数:9,代码来源:AdUser.cs


示例7: GetDirectoryEntry

        public static DirectoryEntry GetDirectoryEntry(Principal principal)
        {
            if (principal == null)
            {
                throw new ArgumentNullException("principal", "Value cannot be null!");
            }

            return principal.GetUnderlyingObject() as DirectoryEntry;
        }
开发者ID:Eugene-Ishkov,项目名称:RestService,代码行数:9,代码来源:LdapPrincipalManager.cs


示例8: ImmutableAuthentication

        /**
     * Constructor that accepts both a principal and a map.
     * 
     * @param principal Principal representing user
     * @param attributes Authentication attributes map.
     * @throws IllegalArgumentException if the principal is null.
     */
        public ImmutableAuthentication(Principal principal,
                                       Dictionary<string, Object> attributes)
            : base(principal, new Dictionary<string, object>())
        {
            //base(principal, attributes == null || attributes.isEmpty()
            //    ? EMPTY_MAP : Collections.unmodifiableMap(attributes));

            this.authenticatedDate = System.DateTime.Now;
        }
开发者ID:CSharpDev,项目名称:Dev.All,代码行数:16,代码来源:ImmutableAuthentication.cs


示例9: PrincipalSearcher

        public PrincipalSearcher(Principal queryFilter)
        {
            if (null == queryFilter)
                throw new ArgumentException(String.Format(CultureInfo.CurrentCulture, StringResources.InvalidNullArgument, "queryFilter"));

            _ctx = queryFilter.Context;
            this.QueryFilter = queryFilter; // use property to enforce "no persisted principals" check

            SetDefaultPageSizeForContext();
        }
开发者ID:chcosta,项目名称:corefx,代码行数:10,代码来源:PrincipalSearcher.cs


示例10: AdMember

 /// <summary>
 /// Constructor that instantiates an AdMember object with the attribute values of
 /// the specified Principal.
 /// </summary>
 /// <param name="member"></param>
 public AdMember(Principal member)
 {
     this.Description = member.Description;
     this.DisplayName = member.DisplayName;
     this.DistinguishedName = member.DistinguishedName;
     this.Guid = member.Guid.ToString();
     this.Name = member.Name;
     this.SamAccountName = member.SamAccountName;
     this.Sid = member.Sid.Value;
     this.UserPrincipalName = member.UserPrincipalName;
 }
开发者ID:UAResLife,项目名称:AdApiService,代码行数:16,代码来源:AdMember.cs


示例11: Add_Command

    protected void Add_Command(object sender, CommandEventArgs e)
    {
        Control c = ((Control)sender).Parent;
        String FacultyId = ((DropDownList)c.FindControl("FacultyId")).SelectedValue;
        int Priority = int.Parse(((TextBox)c.FindControl("Priority")).Text);

        Principal p = new Principal();
        p.FacultyId = FacultyId;
        p.Priority = Priority;
        p.Save();
        GridView1.DataBind();
    }
开发者ID:sriharshakappala,项目名称:online-leave-planner,代码行数:12,代码来源:Principal.aspx.cs


示例12: timer1_Tick

 private void timer1_Tick(object sender, EventArgs e)
 {
     counter++;
     if (counter > 3) 
     {
         Principal P = new Principal();
         P.Show();
         P.FormClosed += P_FormClosed;
         this.Hide();
         timer1.Stop();
     }
 }
开发者ID:pernengo,项目名称:AutoForm,代码行数:12,代码来源:Splash.cs


示例13: GetByPriority

 public static Principal GetByPriority(int Priority)
 {
     DataTable dt = Database.ExecuteQuery("SELECT * FROM Principal WHERE Priority=" + Priority );
     if (dt != null && dt.Rows.Count == 1)
     {
         Principal p = new Principal();
         p.FacultyId = dt.Rows[0][0].ToString();
         p.Priority = int.Parse(dt.Rows[0][1].ToString());
         return p;
     }
     return null;
 }
开发者ID:sriharshakappala,项目名称:online-leave-planner,代码行数:12,代码来源:Principal.cs


示例14: CreateActiveDirectoryUser

 private static ActiveDirectoryUser CreateActiveDirectoryUser(Principal principal)
 {
     using (var userPrincipal = principal as UserPrincipal)
     {
         return new ActiveDirectoryUser
             {
                 UserAccount = userPrincipal.SamAccountName,
                 DisplayName = userPrincipal.DisplayName,
                 Sid = userPrincipal.Sid,
                 Email = userPrincipal.Description // TODO: If use AD, than map from EmailAddress field.
             };
     }
 }
开发者ID:ProcessingFinancialInformation,项目名称:TFIP,代码行数:13,代码来源:ActiveDirectoryHelper.cs


示例15: Main

 /// <summary>
 /// The main entry point for the application.
 /// </summary>
 static void Main(string[] args)
 {
     using (MenuInicial serve = new MenuInicial())
     {
         if (serve.ShowDialog() == DialogResult.OK)
         {
             sProgramIpDoServidor = MenuInicial.sIpdoServidor;
             using (Principal game = new Principal())
             {
                 game.Run();
             }
         }
     }
 }
开发者ID:EduardoPicettiTorezan,项目名称:Trabalho_RMI_Game,代码行数:17,代码来源:Program.cs


示例16: Application_AcquireRequestState

        protected void Application_AcquireRequestState(object sender, EventArgs e)
        {
            var cookies = Context.Request.Cookies;
            var session = Context.Session;

            Principal principal = null;

            if (cookies[CookieHelper.AuthCookieName] != null)
            {
                var authCookieData = cookies[CookieHelper.AuthCookieName].Value;

                if (authCookieData != null)
                {
                    try
                    {
                        var authCookieTicket = FormsAuthentication.Decrypt(authCookieData);

                        if (!authCookieTicket.Expired)
                        {
                            var authUserData = new AuthUserData();

                            if (authUserData.Import(authCookieTicket.UserData))
                            {
                                var isAuthenticated = false;

                                if (session.IsNewSession || session.SessionID != authUserData.SessionId)
                                {
                                    isAuthenticated = false;
                                }
                                else
                                {
                                    isAuthenticated = true;
                                }

                                principal = new Principal(authUserData.UserId.ToString(), isAuthenticated)
                                {
                                    UserId = authUserData.UserId
                                };
                            }
                        }
                    }
                    catch (Exception exception)
                    {

                    }
                }
            }

            Context.User = principal;
        }
开发者ID:jovanMeshkov,项目名称:swappler,代码行数:50,代码来源:Global.asax.cs


示例17: Application_AuthenticateRequest

        protected void Application_AuthenticateRequest(object sender, EventArgs e)
        {
            if (!(HttpContext.Current.User == null)) {
                if (HttpContext.Current.User.Identity.IsAuthenticated) {
                    // Extract the forms authentication cookie
                    HttpCookie authCookie = Context.Request.Cookies[FormsAuthentication.FormsCookieName];
                    FormsAuthenticationTicket authTicket = FormsAuthentication.Decrypt(authCookie.Value);

                    // Get the UserID out of the cookie
                    User user = new User(authTicket.UserData);

                    Principal principal = new Principal(HttpContext.Current.User.Identity, user);
                    HttpContext.Current.User = principal;
                    System.Threading.Thread.CurrentPrincipal = principal;
                }
            }
        }
开发者ID:thardy,项目名称:iServe,代码行数:17,代码来源:Global.asax.cs


示例18: generate

        public string generate(Principal principal, Service service)
        {
            //try {
            // MessageDigest md = MessageDigest.getInstance("SHA");
            //md.update(service.getId().getBytes());
            //md.update(CONST_SEPARATOR);
            //md.update(principal.getId().getBytes());
            //md.update(CONST_SEPARATOR);

            //return Base64.encodeBase64String(md.digest(this.salt)).replaceAll(
            //    System.getProperty("line.separator"), "");
            //} catch ( NoSuchAlgorithmException e) {
            //    throw new RuntimeException(e);
            //}

            throw new NotImplementedException();
        }
开发者ID:CSharpDev,项目名称:Dev.All,代码行数:17,代码来源:ShibbolethCompatiblePersistentIdGenerator.cs


示例19: toADObject

        /// <summary>
        /// Converts a Princpal object (or anything descended from one) into the appropriate AD*** object.
        ///   UserPrincipal  -> ADUser
        ///   GroupPrincipal -> ADGroup
        /// </summary>
        /// <param name="source"></param>
        /// <returns></returns>
        public ADObject toADObject(Principal source)
        {
            ADObject result = null;

            if (source is UserPrincipal)
            {
                result = new ADUser(_connection, (UserPrincipal)source);
            }
            else if (source is GroupPrincipal)
            {
                result = new ADGroup(_connection, (GroupPrincipal)source);
            }
            else
            {
                throw new NotImplementedException("This type of principal has not yet been implemented");
            }

            return result;
        }
开发者ID:bolenc,项目名称:Active-Directory-Examples,代码行数:26,代码来源:ADObjectFactory.cs


示例20: IsAuthorized

        public override bool IsAuthorized(Principal user)
        {
            JContext jc = JContext.Current;

            if (!Independent && !jc.Context.Items["_has_controlpanel_permission_"].ToBoolean())
                return false;

            IArea area = jc.Area;

            string per = Permission;

            if (area["support_multi_site"].ToBoolean())
            {
                per = string.Format("{0}@{1}", per, jc.SiteId);
            }

            if (user != null && StringUtil.HasText(per))
                return user.HasPermission(per);

            return true;
        }
开发者ID:Aliceljm1,项目名称:kiss-project.web,代码行数:21,代码来源:ControlPanelItemAttribute.cs



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C# PrintTicket类代码示例发布时间:2022-05-24
下一篇:
C# PrimitiveTypeKind类代码示例发布时间: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