{"action":"created","issue":{"url":"https://api.github.com/repos/MarimerLLC/cslaforum/issues/289","repository_url":"https://api.github.com/repos/MarimerLLC/cslaforum","labels_url":"https://api.github.com/repos/MarimerLLC/cslaforum/issues/289/labels{/name}","comments_url":"https://api.github.com/repos/MarimerLLC/cslaforum/issues/289/comments","events_url":"https://api.github.com/repos/MarimerLLC/cslaforum/issues/289/events","html_url":"https://github.com/MarimerLLC/cslaforum/issues/289","id":196768509,"number":289,"title":"Execute not getting called consistently in AuthorizationRule","user":{"login":"JustinBourlier","id":21001552,"avatar_url":"https://avatars.githubusercontent.com/u/21001552?v=3","gravatar_id":"","url":"https://api.github.com/users/JustinBourlier","html_url":"https://github.com/JustinBourlier","followers_url":"https://api.github.com/users/JustinBourlier/followers","following_url":"https://api.github.com/users/JustinBourlier/following{/other_user}","gists_url":"https://api.github.com/users/JustinBourlier/gists{/gist_id}","starred_url":"https://api.github.com/users/JustinBourlier/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/JustinBourlier/subscriptions","organizations_url":"https://api.github.com/users/JustinBourlier/orgs","repos_url":"https://api.github.com/users/JustinBourlier/repos","events_url":"https://api.github.com/users/JustinBourlier/events{/privacy}","received_events_url":"https://api.github.com/users/JustinBourlier/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":10,"created_at":"2016-12-20T20:10:07Z","updated_at":"2016-12-24T14:37:08Z","closed_at":"2016-12-24T14:37:08Z","body":"I'm kind of pulling my hair out on this one, but quite frequently, my AuthorizationRule class isn't being called.  I have base.CacheResult = false;\r\n\r\nAny reason why this can happen?  It's not consistent, sometimes it calls it, sometimes it won't.  My control is in a telerik RadWindow, dunno if that would make any difference.\r\n\r\nBreakpoint is hitting HasPermission line, but \"Execute\" method isn't being called.\r\n\r\nMy HasPermission call:\r\nCsla.Rules.BusinessRules.HasPermission(AuthorizationActions.EditObject, businessObject.GetType())\r\n`\r\npublic class SummaryTopicAuthorization : AuthorizationRule\r\n    {\r\n        private AuthorizationActions _action;\r\n        private IPropertyInfo _property;\r\n        public SummaryTopicAuthorization(AuthorizationActions action, IPropertyInfo property) : base(action, property)\r\n        {\r\n            base.CacheResult = false;\r\n            _action = action;\r\n            _property = property;\r\n        }\r\n\r\n        public SummaryTopicAuthorization(AuthorizationActions action)\r\n            : base(action)\r\n        {\r\n            base.CacheResult = false;\r\n            _action = action;\r\n        }\r\n\r\n        protected override void Execute(AuthorizationContext context)\r\n        {\r\n            var summaryTopic = context.Target as CCAM.Business.SummaryTopic;\r\n\r\n            if (_action == AuthorizationActions.WriteProperty)\r\n                ExecuteWritePropertyAuthorization(context, summaryTopic);\r\n            if (_action == AuthorizationActions.EditObject)\r\n                ExecuteEditAuthorization(context, summaryTopic);\r\n        }\r\n\r\n        private void ExecuteEditAuthorization(AuthorizationContext context, Business.SummaryTopic summaryTopic)\r\n        {\r\n            var user = Csla.ApplicationContext.User;\r\n            var userIdentity = user.Identity as CustomIdentity;\r\n\r\n            if (summaryTopic != null)\r\n            {\r\n                if ((user.IsInRole(\"Relationship Manager\") || user.IsInRole(\"LOB Manager\")) && \r\n                    userIdentity.IsInLob(summaryTopic.SummaryMember.Cohort.BusinessGroup) &&\r\n                    summaryTopic.SummaryMember.SummaryStatusID != (int)Constants.SummaryStatus.Complete)\r\n                    context.HasPermission = true;\r\n\r\n                if (user.IsInRole(\"COG Manager\") || user.IsInRole(\"Reviewer\") &&\r\n                    summaryTopic.SummaryMember.SummaryStatusID != (int)Constants.SummaryStatus.Complete)\r\n                    context.HasPermission = true;\r\n            }\r\n        }\r\n\r\n        private void ExecuteWritePropertyAuthorization(AuthorizationContext context, Business.SummaryTopic summaryTopic)\r\n        {\r\n            var user = Csla.ApplicationContext.User;\r\n            var userIdentity = user.Identity as CustomIdentity;\r\n\r\n            if (summaryTopic.SummaryMember != null)\r\n            {\r\n                if (_property == Csla.Core.FieldManager.PropertyInfoManager.GetRegisteredProperty(summaryTopic.GetType(), \"LOBResponse\"))\r\n                {\r\n                    if ((user.IsInRole(\"LOB Manager\") || user.IsInRole(\"Relationship Manager\")) &&\r\n                        userIdentity.IsInLob(summaryTopic.SummaryMember.Cohort.BusinessGroup) &&\r\n                        summaryTopic.SummaryMember.SummaryStatusID == (int)Constants.SummaryStatus.InReview)\r\n                    {\r\n                        context.HasPermission = true;\r\n                    }\r\n\r\n                    if (user.IsInRole(\"COG Manager\") || user.IsInRole(\"Reviewer\"))\r\n                        context.HasPermission = true;\r\n                }\r\n            }\r\n        }\r\n    }\r\n`"},"comment":{"url":"https://api.github.com/repos/MarimerLLC/cslaforum/issues/comments/269086828","html_url":"https://github.com/MarimerLLC/cslaforum/issues/289#issuecomment-269086828","issue_url":"https://api.github.com/repos/MarimerLLC/cslaforum/issues/289","id":269086828,"user":{"login":"JustinBourlier","id":21001552,"avatar_url":"https://avatars.githubusercontent.com/u/21001552?v=3","gravatar_id":"","url":"https://api.github.com/users/JustinBourlier","html_url":"https://github.com/JustinBourlier","followers_url":"https://api.github.com/users/JustinBourlier/followers","following_url":"https://api.github.com/users/JustinBourlier/following{/other_user}","gists_url":"https://api.github.com/users/JustinBourlier/gists{/gist_id}","starred_url":"https://api.github.com/users/JustinBourlier/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/JustinBourlier/subscriptions","organizations_url":"https://api.github.com/users/JustinBourlier/orgs","repos_url":"https://api.github.com/users/JustinBourlier/repos","events_url":"https://api.github.com/users/JustinBourlier/events{/privacy}","received_events_url":"https://api.github.com/users/JustinBourlier/received_events","type":"User","site_admin":false},"created_at":"2016-12-24T14:37:08Z","updated_at":"2016-12-24T14:37:08Z","body":"Ohhhhhhhh, thank you so much for the explanation.  I was definitely using it all wrong.  It's basically like an HttpContext then, in that manner.  "}}
{"actor":{"display_login":"JustinBourlier"}}