Example #1
0
        private void AccessDenied(AccessType accessType, EntityInfo entity, UserRecordPermission grantedPermissions)
        {
            if (!MustThrowOnDenied(accessType))
            {
                return;
            }
            var msg = StringHelper.SafeFormat("Actions(s) [{0}] denied for entity {1}, authority {2}.",
                                              accessType, entity, Context.User);
            var authEx = new AuthorizationException(msg, entity.EntityType, accessType, false, grantedPermissions, this);

            throw authEx;
        }
Example #2
0
        private void AccessDenied(AccessType accessType, EntityRecord record, EntityMemberInfo member = null)
        {
            if (!MustThrowOnDenied(accessType))
            {
                return;
            }
            var msg = StringHelper.SafeFormat("Actions(s) [{0}] denied for record {1}, user {2}",
                                              accessType, record.ToString(), Context.User);

            if (member != null)
            {
                msg += "(Property " + member.MemberName + ")";
            }
            var authEx = new AuthorizationException(msg, record.EntityInfo.EntityType, accessType, true, record.UserPermissions, this);

            throw authEx;
        }