示例#1
0
        public override IReport FindReportByServerPath(string serverPath)
        {
            Serialization.ReportMetadata metadata = (Serialization.ReportMetadata)Serialization.ReportDefinitionLibraryMetadataCache.GetReportDefinitionLibraryMetadata(configurationFilename, typeof(Serialization.ReportMetadata));

            IReport report = null;

            foreach (Serialization.Report xmlReport in metadata.Report)
            {
                if (xmlReport.ReportProcessingLocation.ServerReport != null)
                {
                    if (xmlReport.ReportProcessingLocation.ServerReport.Path.Equals(serverPath))
                    {
                        report = LoadReport(xmlReport);
                        break;
                    }
                }
            }

            if (report == null)
            {
                throw new ReportNotFoundException("No such report: " + serverPath);
            }

            return(report);
        }
示例#2
0
        public override IReport FindReport(string id)
        {
            if (string.IsNullOrEmpty(id))
            {
                throw new ArgumentNullException("id", "Report ID cannot be null or empty");
            }

            Serialization.ReportMetadata reportMetadata = (Serialization.ReportMetadata)Serialization.ReportDefinitionLibraryMetadataCache.GetReportDefinitionLibraryMetadata(configurationFilename, typeof(Serialization.ReportMetadata));

            IReport report = null;

            foreach (Serialization.Report xmlReport in reportMetadata.Report)
            {
                if (xmlReport.Id.Equals(id))
                {
                    report = LoadReport(xmlReport);
                    break;
                }
            }

            if (report == null)
            {
                throw new ReportNotFoundException("No such report: " + id);
            }

            return(report);
        }
示例#3
0
        public override bool IsAuthorized(string id, int businessUnitId)
        {
            Serialization.ReportMetadata metadata = (Serialization.ReportMetadata)Serialization.ReportDefinitionLibraryMetadataCache.GetReportDefinitionLibraryMetadata(configurationFilename, typeof(Serialization.ReportMetadata));

            bool foundReport = false;

            bool authorized = false;

            foreach (Serialization.Report xmlReport in metadata.Report)
            {
                if (!xmlReport.Id.Equals(id))
                {
                    continue;
                }

                foundReport = true;

                if (xmlReport.Authorization == null)
                {
                    authorized = true;
                }
                else
                {
                    Acl <string> acl = new Acl <string>();

                    int i = 0, j = xmlReport.Authorization.Items.Length;

                    for (; i < j; i++)
                    {
                        string value = xmlReport.Authorization.Items[i];

                        switch (xmlReport.Authorization.ItemsElementName[i])
                        {
                        case Serialization.ItemsChoiceType.Allow:
                            acl.Install(AceType.Allow, new StringAce(value));
                            break;

                        case Serialization.ItemsChoiceType.Deny:
                            acl.Install(AceType.Deny, new StringAce(value));
                            break;
                        }
                    }

                    authorized = acl.Allow(businessUnitId.ToString(CultureInfo.InvariantCulture));
                }
            }

            if (!foundReport)
            {
                throw new ReportNotFoundException(id);
            }

            return(authorized);
        }
示例#4
0
        internal override void CompleteReport(Report report)
        {
            Serialization.ReportMetadata reportMetadata = (Serialization.ReportMetadata)Serialization.ReportDefinitionLibraryMetadataCache.GetReportDefinitionLibraryMetadata(configurationFilename, typeof(Serialization.ReportMetadata));

            foreach (Serialization.Report xmlReport in reportMetadata.Report)
            {
                if (xmlReport.Id.Equals(report.Id))
                {
                    report.ReportParameters         = GetReportParameters(xmlReport);;
                    report.ReportProcessingLocation = GetReportProcessingLocation(xmlReport);
                    report.Completed();
                    VerifyParameters(report);
                    break;
                }
            }
            return;
        }