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

C# Permissions.PrincipalPermission类代码示例

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

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



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

示例1: EDocumentCommendationDelete

        public new void EDocumentCommendationDelete(EDocumentCommendation entity)
        {
            // check permission: admin
              PrincipalPermission permAdmin = new PrincipalPermission(Thread.CurrentPrincipal.Identity.Name, "Administrator");
              permAdmin.Demand();

              TraceCallEnterEvent.Raise();
              try
              {
            base.EDocumentCommendationDelete(entity);

            BusinessAuditEvent.Success();
            TraceCallReturnEvent.Raise();
            return;
              }
              catch (Exception ex)
              {
            ExceptionManager.Publish(ex);
            BusinessAuditEvent.Fail(
              new EventParameter("Exception", ex.ToString())
              );
            TraceCallReturnEvent.Raise(false);
            throw;
              }
        }
开发者ID:bmadarasz,项目名称:ndihelpdesk,代码行数:25,代码来源:EDocumentCommendationService.cs


示例2: NewsAttachmentDelete

        public new void NewsAttachmentDelete(NewsAttachment entity)
        {
            // check permission: admin
              PrincipalPermission permReg = new PrincipalPermission(Thread.CurrentPrincipal.Identity.Name, "Registered");
              PrincipalPermission permAdmin = new PrincipalPermission(Thread.CurrentPrincipal.Identity.Name, "Administrator");
              permReg.Union(permAdmin).Demand();

              TraceCallEnterEvent.Raise();
              try
              {
            FileDataContext fileDataContext = new FileDataContext();
            string ext = Path.GetExtension(entity.Path).ToLower();
            string fileName = entity.ID.ToString() + ext;
            fileDataContext.NewsAttachmentDelete(entity.NewsRef, fileName);
            base.NewsAttachmentDelete(entity);

            BusinessAuditEvent.Success();
            TraceCallReturnEvent.Raise();
            return;
              }
              catch (Exception ex)
              {
            ExceptionManager.Publish(ex);
            BusinessAuditEvent.Fail(
              new EventParameter("Exception", ex.ToString())
              );
            TraceCallReturnEvent.Raise(false);
            throw;
              }
        }
开发者ID:bmadarasz,项目名称:ndihelpdesk,代码行数:30,代码来源:NewsAttachmentService.cs


示例3: Page_Load

        protected void Page_Load(object sender, EventArgs e)
        {
            SetDefaultControls("btnGetRight", "");
              PrincipalPermission permReg = new PrincipalPermission(Context.User.Identity.Name, "Registered");
              permReg.Demand();

              if (!Page.IsPostBack)
              {
            IOrganisationService srvOrg = ServiceFactory.GetOrganisationService();

            //megnézzük hogy volt e szervezet kiválasztva (van e selectedOrgId)
            string selectedOrgId = Request["selectedOrgId"];

            if (selectedOrgId != null)
            {
              //lekérdezzük a kiválasztott szervezet adatait
              Organisation org = srvOrg.OrganisationSelect(new Guid(selectedOrgId));

              txtOrgInstitution.Text = org.Name;
              lblZipCode.Text = org.PostCode;
              lblTownShip.Text = org.City;
              lblAddress.Text = org.Address;

              lblOrganisationForm.Text = org.Department.IsNull ? "-" : org.Department.ToString();
            }
              }
        }
开发者ID:bmadarasz,项目名称:ndihelpdesk,代码行数:27,代码来源:OrganisationGetWriteRight.aspx.cs


示例4: testRoleBtn_Click

 //[PrincipalPermission(SecurityAction.Demand, Name="aa")]
 protected void testRoleBtn_Click(object sender, EventArgs e)
 {
     var aPermission = new PrincipalPermission("a", null);
     var bPermission = new PrincipalPermission("b", null);
     aPermission.Union(bPermission).Demand();
     //permission.Demand();
 }
开发者ID:kerosen,项目名称:Mockups,代码行数:8,代码来源:Default.aspx.cs


示例5: JobAnswerDelete

 public new void JobAnswerDelete(JobAnswer entity)
 {
     PrincipalPermission permReg = new PrincipalPermission(Thread.CurrentPrincipal.Identity.Name, "Registered");
       PrincipalPermission permAdmin = new PrincipalPermission(Thread.CurrentPrincipal.Identity.Name, "Administrator");
       permReg.Union(permAdmin).Demand();
       base.JobAnswerDelete(entity);
 }
开发者ID:bmadarasz,项目名称:ndihelpdesk,代码行数:7,代码来源:JobAnswerService.cs


示例6: Authorize

        public void Authorize()
        {
            string[] groups = null;
            Type serviceType = this.GetType();
            var configItem = WcfConfigManager.GetServiceConfig(serviceType);

            if (null != configItem)
            {
                groups = configItem.Item.AuthorizedGroups.Split(',');
            }

            if (null != groups)
            {
                PrincipalPermission[] pps = new PrincipalPermission[groups.Length];
                for (int i = 0; i < groups.Length; i++)
                {
                    pps[i] = new PrincipalPermission(null, groups[i]);
                }

                PrincipalPermission pp = pps[0];
                if (groups.Length > 0)
                {
                    for (int i = 1; i < groups.Length; i++)
                    {
                        pp = (PrincipalPermission)pp.Union(pps[i]);
                    }
                }
                pp.Demand();
            }
            else
                throw new SecurityException("Group is null");
        }
开发者ID:JackFong,项目名称:GenericWcfServiceHostAndClient,代码行数:32,代码来源:WcfServiceBase.cs


示例7: OfficerMethod

 public static void OfficerMethod()
 {
     string name = "��";
     string role = "ʿ��";
     PrincipalPermission principalPermission = new PrincipalPermission(name, role);
     principalPermission.Demand();
 }
开发者ID:anytao,项目名称:insidenet,代码行数:7,代码来源:RBSBase.cs


示例8: Page_Load

        protected void Page_Load(object sender, EventArgs e)
        {
            Response.Redirect("Default.aspx");
              SetTitle(" - Állásajánlatra jelentkezés rögzítése");
              SetDefaultControls("btnCreate", "txtMotivation");
              // Check permission: anybody can use this page
              PrincipalPermission permReg = new PrincipalPermission(Context.User.Identity.Name, "Registered");
              permReg.Demand();

              string jobId = Request["jobId"];
              m_sender = Request["sender"];
              if (jobId == null)
            throw new ApplicationException("Hiányzó kötelező paraméter: hirdetés azonosító.");

              m_srvJob = ServiceFactory.GetJobOfferService();
              m_JobId = new Guid(jobId);
              m_Job = m_srvJob.JobOfferSelect(m_JobId);

              if (!Page.IsPostBack)
              {
            RetreiveData();

            #region Attachement grid feltöltése

            ShowAttachementGrid();

            #endregion
              }
        }
开发者ID:bmadarasz,项目名称:ndihelpdesk,代码行数:29,代码来源:JobOfferAnswerCreate.aspx.cs


示例9: Page_Load

 protected void Page_Load(object sender, EventArgs e)
 {
     // Put user code to initialize the page here
       // Check permission: all registered user
       PrincipalPermission perm = new PrincipalPermission(Context.User.Identity.Name, "Registered");
       perm.Demand();
 }
开发者ID:bmadarasz,项目名称:ndihelpdesk,代码行数:7,代码来源:OfflineTool.aspx.cs


示例10: Authorize

        public void Authorize()
        {
            var serviceType = this.GetType();
            var configItem = Config.Get(serviceType);

            IList<string> groups = null;
            if (configItem != null)
            {
                groups = configItem.AuthorizedGroups;
            }

            if (groups == null)
            {
                throw new SecurityException("Group is null");
            }

            var pps = new PrincipalPermission[groups.Count];
            for (var i = 0; i < groups.Count; i++)
            {
                pps[i] = new PrincipalPermission(null, groups[i]);
            }

            var pp = pps[0];
            if (groups.Count> 0)
            {
                for (var i = 1; i < groups.Count; i++)
                {
                    pp = (PrincipalPermission)pp.Union(pps[i]);
                }
            }
            pp.Demand();
        }
开发者ID:RustyF,项目名称:EnergyTrading-Core,代码行数:32,代码来源:WcfServiceBase.cs


示例11: EmailSelectFiltered

        public EmailContainer EmailSelectFiltered(Email filter)
        {
            // Check permission: admin
              PrincipalPermission permAdmin = new PrincipalPermission(Thread.CurrentPrincipal.Identity.Name, "Administrator");
              permAdmin.Demand();

              TraceCallEnterEvent.Raise();
              try
              {
            EmailContainer result;
            DataSet entitySet = m_DataContext.ndihdEmailSelectFiltered(
              filter.Category,
              filter.FilterOnSentFrom,
              filter.FilterOnSentTo,
              filter.FilterOnActivityPrevention,
              filter.FilterOnActivityResearch,
              filter.FilterOnActivityRehabilitation,
              filter.FilterOnActivityOther,
              filter.FilterOnNDI,
              filter.FilterOnActivityAll
              );
            result = new EmailContainer(entitySet.Tables[0]);
            TraceCallReturnEvent.Raise();
            return result;
              }
              catch (Exception ex)
              {
            ExceptionManager.Publish(ex);
            TraceCallReturnEvent.Raise(false);
            throw;
              }
        }
开发者ID:bmadarasz,项目名称:ndihelpdesk,代码行数:32,代码来源:EmailService.cs


示例12: ContinuativeDelete

        public new void ContinuativeDelete(Continuative entity)
        {
            //check permission: Admin
              PrincipalPermission permAdm = new PrincipalPermission(Thread.CurrentPrincipal.Identity.Name, "Administrator");
              permAdm.Demand();

              TraceCallEnterEvent.Raise();
              try
              {
            base.ContinuativeDelete(entity);

            BusinessAuditEvent.Success(
              new EventParameter("ContinuativeID", entity.ID)
              );
            TraceCallReturnEvent.Raise();
            return;
              }
              catch (Exception ex)
              {
            ExceptionManager.Publish(ex);
            BusinessAuditEvent.Fail(
              new EventParameter("Exception", ex.ToString()),
              new EventParameter("ContinuativeID", entity.ID));
            TraceCallReturnEvent.Raise(false);
            throw;
              }
        }
开发者ID:bmadarasz,项目名称:ndihelpdesk,代码行数:27,代码来源:ContinuativeService.cs


示例13: PermissionStateUnrestricted

		public void PermissionStateUnrestricted () 
		{
			PrincipalPermission p = new PrincipalPermission (PermissionState.Unrestricted);
			Assert.IsNotNull (p, "PrincipalPermission(PermissionState.Unrestricted)");
			Assert.IsTrue (p.IsUnrestricted (), "IsUnrestricted");
			PrincipalPermission copy = (PrincipalPermission) p.Copy ();
			Assert.AreEqual (p.IsUnrestricted (), copy.IsUnrestricted (), "Copy.IsUnrestricted");
			// Note: Unrestricted isn't shown in XML
		}
开发者ID:nlhepler,项目名称:mono,代码行数:9,代码来源:PrincipalPermissionTest.cs


示例14: PermissionStateUnrestricted

		public void PermissionStateUnrestricted () 
		{
			PrincipalPermission p = new PrincipalPermission (PermissionState.Unrestricted);
			AssertNotNull ("PrincipalPermission(PermissionState.Unrestricted)", p);
			Assert ("IsUnrestricted", p.IsUnrestricted ());
			PrincipalPermission copy = (PrincipalPermission) p.Copy ();
			AssertEquals ("Copy.IsUnrestricted", p.IsUnrestricted (), copy.IsUnrestricted ());
			// Note: Unrestricted isn't shown in XML
		}
开发者ID:jjenki11,项目名称:blaze-chem-rendering,代码行数:9,代码来源:PrincipalPermissionTest.cs


示例15: CreatePermission

		// Method
		public override IPermission CreatePermission ()
		{
			PrincipalPermission perm = null;
			if (this.Unrestricted)
				perm = new PrincipalPermission (PermissionState.Unrestricted);
			else
				perm = new PrincipalPermission (name, role, authenticated);
			return perm;
		}
开发者ID:runefs,项目名称:Marvin,代码行数:10,代码来源:PrincipalPermissionAttribute.cs


示例16: Page_Load

 protected void Page_Load(object sender, EventArgs e)
 {
     // Check permission: all registered user
       PrincipalPermission perm = new PrincipalPermission(Context.User.Identity.Name, "Registered");
       perm.Demand();
       if (!Page.IsPostBack)
       {
     ShowGrid(gridCompetition, 0, null, null);
       }
 }
开发者ID:bmadarasz,项目名称:ndihelpdesk,代码行数:10,代码来源:CompetitionList.aspx.cs


示例17: Page_Load

        protected void Page_Load(object sender, EventArgs e)
        {
            Response.Redirect("Default.aspx");
              SetTitle(" - Keresés hirdetés jelentkezés adatai");
              SetDefaultControls("btnModify","");
              // Check permission: anybody can use this page
              PrincipalPermission permReg = new PrincipalPermission(Context.User.Identity.Name, "Registered");
              permReg.Demand();
              string jobId = Request["jobId"];
              m_sender = Request["sender"];
              m_subscriber = Request["subscriber"];

              if (jobId == null)
            throw new ApplicationException("Hiányzó kötelező paraméter: hirdetés azonosító.");
              if (m_sender == null)
            throw new ApplicationException("Hiányzó kötelező paraméter: hirdetés azonosító.");
              if (m_subscriber == null)
            throw new ApplicationException("Hiányzó kötelező paraméter: hirdetés azonosító.");

              if (m_subscriber != Context.User.Identity.Name && m_sender != Context.User.Identity.Name)
              {
            if (m_subscriber != Context.User.Identity.Name)
            {
              throw new SecurityException("Nem az ön jelentkezése, nem tekintheti meg az adatokat.");
            }
            if (m_sender != Context.User.Identity.Name)
            {
              throw new SecurityException("Nem az ön hirdetése, nem tekintheti meg az adatokat.");
            }
              }
              m_srvJob = ServiceFactory.GetJobFindService();
              m_JobId = new Guid(jobId);
              m_Job = m_srvJob.JobFindSelect(m_JobId);
              m_JobAnswer = m_srvJobAnswer.JobAnswerSelect(m_JobId, JobAnswerTypeEnum.FIN, m_subscriber,m_sender);
              if (!Page.IsPostBack)
              {
            RetreiveData();

            #region Egyéb dokumentumok grid feltöltése

            ShowAttachementGrid();

            #endregion
              }
              if (m_JobAnswer.SenderNameRef == Context.User.Identity.Name)
              {
            btnModify.Visible = false;
            tdUser.InnerHtml = "<BR/>Jelentkező adatai:";
              }
              else
              {
            btnModify.Visible = true;
            tdUser.InnerText = "Állást kereső személy adatai:";
              }
        }
开发者ID:bmadarasz,项目名称:ndihelpdesk,代码行数:55,代码来源:JobFindAnswerData.aspx.cs


示例18: PermissionStateNone

		public void PermissionStateNone () 
		{
			PrincipalPermission p = new PrincipalPermission (PermissionState.None);
			AssertNotNull ("PrincipalPermission(PermissionState.None)", p);
			Assert ("IsUnrestricted", !p.IsUnrestricted ());
			PrincipalPermission copy = (PrincipalPermission) p.Copy ();
			AssertEquals ("Copy.IsUnrestricted", p.IsUnrestricted (), copy.IsUnrestricted ());
			SecurityElement se = p.ToXml ();
			Assert ("ToXml-class", (se.Attributes ["class"] as string).StartsWith (className));
			AssertEquals ("ToXml-version", "1", (se.Attributes ["version"] as string));
		}
开发者ID:jjenki11,项目名称:blaze-chem-rendering,代码行数:11,代码来源:PrincipalPermissionTest.cs


示例19: PermissionStateNone

		public void PermissionStateNone () 
		{
			PrincipalPermission p = new PrincipalPermission (PermissionState.None);
			Assert.IsNotNull (p, "PrincipalPermission(PermissionState.None)");
			Assert.IsTrue (!p.IsUnrestricted (), "IsUnrestricted");
			PrincipalPermission copy = (PrincipalPermission) p.Copy ();
			Assert.AreEqual (p.IsUnrestricted (), copy.IsUnrestricted (), "Copy.IsUnrestricted");
			SecurityElement se = p.ToXml ();
			Assert.IsTrue ((se.Attributes ["class"] as string).StartsWith (className), "ToXml-class");
			Assert.AreEqual ("1", (se.Attributes ["version"] as string), "ToXml-version");
		}
开发者ID:nlhepler,项目名称:mono,代码行数:11,代码来源:PrincipalPermissionTest.cs


示例20: Page_Load

        protected void Page_Load(object sender, EventArgs e)
        {
            SetDefaultControls("btnModify", "");
              // Check permission: all registered user
              PrincipalPermission perm = new PrincipalPermission(Context.User.Identity.Name, "Registered");
              perm.Demand();
              SetTitle(" - Felhasználói adatok");
              if (!Page.IsPostBack)
              {

            RetreivData();
              }
        }
开发者ID:bmadarasz,项目名称:ndihelpdesk,代码行数:13,代码来源:UserData.aspx.cs



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C# Permissions.RegistryPermission类代码示例发布时间:2022-05-26
下一篇:
C# Permissions.KeyContainerPermissionAccessEntry类代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

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

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

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