public CatalogInteractionManager(AuthenticatedUserManager user)
 {
     #region Validate Parameters
     if (user == null)
     {
         throw new ArgumentNullException("user");
     }
     #endregion
     _authenticatedUserManager = user;
 }
예제 #2
0
        public static SettingsModel SaveConfiguredRoles(string role, string action, AuthenticatedUserManager user)
        {
            BOConfiguredRole configuredRole;

            if (user.ConfiguredRoleCollection == null)
            {
                user.ConfiguredRoleCollection.Fill();
            }

            configuredRole = user.ConfiguredRoleCollection[role];
            if (configuredRole == null)
            {
                configuredRole = new BOConfiguredRole();
                configuredRole.RoleName = role;
            }

            if (action == "AddRole")
            {
                configuredRole.Save(user.AuthenticatedUserSignature);
            }
            else
            {
                configuredRole.Delete();
            }
            return GetRoles(user);
        }
예제 #3
0
 public static SettingsModel SaveConfigurations(Dictionary<string, string> configurations, AuthenticatedUserManager user)
 {
     BOConfigurationCollection origConfigurations = user.ConfigurationCollection;
     origConfigurations.Fill();
     foreach (string key in configurations.Keys)
     {
         BOConfiguration configuration = origConfigurations[key];
         if (configuration != null)
         {
             configuration.PropertyName = key;
             configuration.PropertyValue = configurations[key];
             configuration.Save(user.AuthenticatedUserSignature);
         }
     }
     return GetConfigurations(user);
 }
예제 #4
0
        public static SettingsModel GetSecurityCatalogItems(AuthenticatedUserManager user, string path)
        {
            SettingsModel model = InitializeCatalog(user, CatalogModel.SRSAuthenticate(user));
            model.Catalog.AllItems.RemoveAll(item => item.ItemType != "Folder");
            model.Catalog.Catalogs.RemoveAll(item => item.ItemType != "Folder");
            model.AllowedRoleCollection = new StringCollection();
            model.DeniedRoleCollection = new StringCollection();
            foreach (CatalogModel catModel in model.Catalog.Catalogs)
            {
                catModel.Children.RemoveAll(item => item.ItemType != "Folder");
                foreach (CatalogModel catModel2 in catModel.Children)
                {
                    catModel2.Children.RemoveAll(item => item.ItemType != "Folder");
                }
            }

            if (path != string.Empty)
            {
                user.ConfiguredRoleCollection.Fill();
                user.UserAccessCollection.Fill();
                user.RoleAccessCollection.Fill();

                foreach (BOConfiguredRole securityRole in user.ConfiguredRoleCollection)
                {
                    BORoleAccess roleAccess = user.RoleAccessCollection[securityRole.RoleName, path];
                    if (roleAccess != null)
                    {
                        if (roleAccess.AccessState == AccessStateType.Allowed)
                        {
                            model.AllowedRoleCollection.Add(securityRole.RoleName);
                        }
                        else
                        {
                            model.DeniedRoleCollection.Add(securityRole.RoleName);
                        }
                    }
                    else
                    {
                        model.DeniedRoleCollection.Add(securityRole.RoleName);
                    }
                }

                model.UserCollection = user.UserAccessCollection.FilterForItemPath(path);
                model.RoleCollection = user.RoleAccessCollection.FilterForItemPath(path);
            }
            return model;
        }
예제 #5
0
 public static SettingsModel GetRoles(AuthenticatedUserManager user)
 {
     user.ConfiguredRoleCollection.Fill();
     SettingsModel model = new SettingsModel();
     model.ConfiguredRoles = user.ConfiguredRoleCollection;
     model.Roles = new StringCollection();
     model.Roles = AuthenticationManager.Authenticate(user.Username, user.Password, user.Domain).SecurityRoleCollection;
     foreach (BOConfiguredRole role in model.ConfiguredRoles)
     {
         if(model.Roles.Contains(role.RoleName))
         {
             model.Roles.Remove(role.RoleName);
         }
     }
     return model;
 }
예제 #6
0
        public static SettingsModel GetExportMappings(AuthenticatedUserManager user)
        {
            SettingsModel model = InitializeCatalog(user, CatalogModel.SRSAuthenticate(user));

            CatalogModel proxyCatalog = new CatalogModel();
            model.Catalog.Catalogs.RemoveAll(item => item.ItemType != "Folder" && item.ItemType !="Report");
            foreach (CatalogModel catModel in model.Catalog.Catalogs)
            {
                catModel.Children.RemoveAll(item => item.ItemType != "Folder" && item.ItemType != "Report");
                foreach (CatalogModel catModel2 in catModel.Children)
                {
                    catModel2.Children.RemoveAll(item => item.ItemType != "Folder" && item.ItemType != "Report");
                }
            }
            model.Catalog.Catalogs.RemoveAll(item => item.ItemType == "Folder" && item.Children.Count == 0);

            foreach (CatalogModel catModel in model.Catalog.Catalogs)
            {
                catModel.Catalogs.RemoveAll(item => item.ItemType == "Folder" && item.Children.Count == 0);
                foreach (CatalogModel catModel2 in model.Catalog.Catalogs)
                {
                    catModel2.Catalogs.RemoveAll(item => item.ItemType == "Folder" && item.Children.Count == 0);
                }
            }
            model.ExportMappings = new BOExportMapCollection();
            model.ExportMappings.Fill();

            model.ExportMapDisplayOptions = new StringCollection();
            model.ExportMapDisplayOptions.Add(Constants.ExportMapCatalogOptions.ExportAndView);
            model.ExportMapDisplayOptions.Add(Constants.ExportMapCatalogOptions.ExportOnly);
            return model;
        }
예제 #7
0
 /// <summary>
 /// Lets store the SRS Authid so that we wont need to relogin everytime we access SRS.
 /// This is used in web service in SRS
 /// </summary>
 public static ReportingServiceClient SRSAuthenticate(AuthenticatedUserManager user)
 {
     return user.CatalogInteractionManager.ReportingServiceClient;
 }
예제 #8
0
 private static SettingsModel InitializeCatalog(AuthenticatedUserManager user, ReportingServiceClient proxy)
 {
     SettingsModel model = new SettingsModel();
     model.Catalog = new CatalogModel();
     model.Catalog = CatalogModel.GetCatalogItems(user, proxy);
     return model;
 }
 public ExportMapManager(AuthenticatedUserManager owner)
 {
     _owner = owner;
 }
예제 #10
0
        /// <summary>
        /// Save the datasource in the SSRS.
        /// </summary>
        public void SaveDataSource(AuthenticatedUserManager user, string address)
        {
            //TODO: Need to add validation for each textboxes
            string datasourceName = string.Empty;
            string databaseName = string.Empty;
            string serverName = string.Empty;
            string userName = string.Empty;
            string password = string.Empty;
            string confirmPassword = string.Empty;
            bool canSave = true;

            foreach (var item in DataSourceItem.itemProperties)
            {
                switch (item.PropertyName)
                {
                    case "DatasourceName":
                        datasourceName = item.Value;
                        break;

                    case "DatabaseName":
                        databaseName = item.Value;
                        break;

                    case "ServerName":
                        serverName = item.Value;
                        break;

                    case "UserName":
                        userName = item.Value;
                        break;

                    case "Password":
                        password = item.Value;
                        break;

                    case "ConfirmPassword":
                        confirmPassword = item.Value;
                        break;
                }
            }
            //TODO: Add Validation in this part
            if (canSave)
            {
                user.CatalogInteractionManager.CreateDataSource(
                    datasourceName,
                    address,
                    "SQL",
                    serverName,
                    databaseName,
                    userName,
                    password,
                    confirmPassword,
                    true);
            }
            else
            {
                //Alert message: Incomplete information
            }
        }
예제 #11
0
 /// <summary>
 /// Gets all of the Report Parameters from the SRS.
 /// </summary>
 public void GetReportParameters(AuthenticatedUserManager user, ReportingServiceClient srsClient)
 {
     string address = Path.Substring(Path.IndexOf('/'));
     ReportParameters = user.CatalogInteractionManager.GetReportParameters(address, null, srsClient);
 }
예제 #12
0
 /// <summary>
 /// Gets the information of the catalog item
 /// </summary>
 public void GetItemProperty(AuthenticatedUserManager user)
 {
     string address = Path.Substring(Path.IndexOf('/'));
     ItemProperties = user.CatalogInteractionManager.LookupItemProperties(address);
 }
예제 #13
0
        /// <summary>
        /// Gets the Datasource from the SRS.
        /// </summary>
        public void GetDataSourceItem(AuthenticatedUserManager user, ReportingServiceClient srsProxy)
        {
            string address = Path.Substring(Path.IndexOf('/'));
            NDatasource datasource = user.CatalogInteractionManager.LookupDataSource(address, srsProxy);
            if (datasource != null)
            {
                DataSourceItem.itemProperties.Clear();

                DataSourceItem.ConnectionString = datasource.ConnectionString;
                DataSourceItem.itemProperties.Add(new DataSourceProperty(CatalogConstants.DataSourceProperties.Datasource, CatalogConstants.DataSourceLabels.DatasourceLabel, datasource.Name));
                DataSourceItem.itemProperties.Add(new DataSourceProperty(CatalogConstants.DataSourceProperties.Database, CatalogConstants.DataSourceLabels.DatabaseLabel, datasource.DatabaseName));
                DataSourceItem.itemProperties.Add(new DataSourceProperty(CatalogConstants.DataSourceProperties.Server, CatalogConstants.DataSourceLabels.ServerLabel, datasource.ServerName));
                DataSourceItem.itemProperties.Add(new DataSourceProperty(CatalogConstants.DataSourceProperties.Provider, CatalogConstants.DataSourceLabels.ProviderLabel, datasource.Provider));
                DataSourceItem.itemProperties.Add(new DataSourceProperty(CatalogConstants.DataSourceProperties.User, CatalogConstants.DataSourceLabels.UserNameLabel, datasource.UserName));
                DataSourceItem.itemProperties.Add(new DataSourceProperty(CatalogConstants.DataSourceProperties.Password, CatalogConstants.DataSourceLabels.Password, ""));
                DataSourceItem.itemProperties.Add(new DataSourceProperty(CatalogConstants.DataSourceProperties.ConfirmPassword, CatalogConstants.DataSourceLabels.ConfirmPassLabel, ""));
            }
            else
            {
                //Throw an error
                Error = new Exception(string.Format("No datasource property found in this path {0}.", address));
            }
        }
예제 #14
0
 /// <summary>
 /// Deletes the catalog item
 /// </summary>        
 public void DeleteItem(AuthenticatedUserManager user)
 {
     string address = Path.Substring(Path.IndexOf('/'));
     bool supressError = false;
     user.CatalogInteractionManager.DeleteCatalogItem(address, supressError, true);
 }
예제 #15
0
 public static SettingsModel SaveExportMapping(AuthenticatedUserManager user, string reportPath, string procName, string displayOption)
 {
     SettingsModel.ReportPath = string.Empty;
     ExportMapManager manager = new ExportMapManager(user);
     BOExportMap exportMap = new BOExportMap();
     exportMap.ProcName = procName;
     exportMap.ReportPath = reportPath;
     exportMap.DisplayOptions = displayOption;
     exportMap.DataSourcePath = manager.LookupDataSourceFromRdl(reportPath);
     exportMap.Save(user.AuthenticatedUserSignature);
     return SettingsModel.GetExportMappings(user);
 }
예제 #16
0
 public void FillReportStoredProcedures(AuthenticatedUserManager user, string reportPath)
 {
     ExportMapManager exportMapManager = new ExportMapManager(user);
     _reportStoredProcedures = exportMapManager.LookupStoredProcFromRdl(reportPath);
 }
예제 #17
0
 public static SettingsModel DeleteExportMapping(AuthenticatedUserManager user, string reportPath)
 {
     SettingsModel.ReportPath = string.Empty;
     BOExportMap exportMap = new BOExportMap();
     ExportMapManager manager = new ExportMapManager(user);
     exportMap = manager.FindAssociatedExportMap(reportPath, false);
     exportMap.Delete();
     return SettingsModel.GetExportMappings(user);
 }
예제 #18
0
        public static SettingsModel GetConfigurations(AuthenticatedUserManager user)
        {
            BOConfigurationCollection collection = user.ConfigurationCollection;
            collection.Fill();
            SettingsModel model = new SettingsModel();

            model.ApplicationConfigurations = new BOConfigurationCollection();

            #region appSettings value assignments
            model.ApplicationConfigurations.Add(new BOConfiguration() { PropertyName = Constants.AvailableApplicationSettings.StartupPageAddress });
            model.ApplicationConfigurations.Add(new BOConfiguration() { PropertyName = Constants.AvailableApplicationSettings.SMTPServer });
            model.ApplicationConfigurations.Add(new BOConfiguration() { PropertyName = Constants.AvailableApplicationSettings.SupportEmail });
            model.ApplicationConfigurations.Add(new BOConfiguration() { PropertyName = Constants.AvailableApplicationSettings.BaseUrl });
            model.ApplicationConfigurations.Add(new BOConfiguration() { PropertyName = Constants.AvailableApplicationSettings.MinimumUIYear });
            model.ApplicationConfigurations.Add(new BOConfiguration() { PropertyName = Constants.AvailableApplicationSettings.SRSBaseUrl });
            model.ApplicationConfigurations.Add(new BOConfiguration() { PropertyName = Constants.AvailableApplicationSettings.SRSReportExecutionPage });
            model.ApplicationConfigurations.Add(new BOConfiguration() { PropertyName = Constants.AvailableApplicationSettings.SRSReportExecutionServicePage });
            model.ApplicationConfigurations.Add(new BOConfiguration() { PropertyName = Constants.AvailableApplicationSettings.SRSReportServicePage });
            model.ApplicationConfigurations.Add(new BOConfiguration() { PropertyName = Constants.AvailableApplicationSettings.FTPServer });
            model.ApplicationConfigurations.Add(new BOConfiguration() { PropertyName = Constants.AvailableApplicationSettings.FTPPath });
            model.ApplicationConfigurations.Add(new BOConfiguration() { PropertyName = Constants.AvailableApplicationSettings.FTPUser });
            model.ApplicationConfigurations.Add(new BOConfiguration() { PropertyName = Constants.AvailableApplicationSettings.FTPPassword });
            model.ApplicationConfigurations.Add(new BOConfiguration() { PropertyName = Constants.AvailableApplicationSettings.CSVDelimiter });
            #endregion

            model.SubscriptionConfigurations = new BOConfigurationCollection();

            #region subscriptionSettings value assignments
            model.SubscriptionConfigurations.Add(new BOConfiguration() { PropertyName = Constants.AvailableSubscriptionSettings.ScheduleServiceSignature });
            model.SubscriptionConfigurations.Add(new BOConfiguration() { PropertyName = Constants.AvailableSubscriptionSettings.TimerQueuePollingInterval });
            model.SubscriptionConfigurations.Add(new BOConfiguration() { PropertyName = Constants.AvailableSubscriptionSettings.TimerQueueLoadingInterval });
            model.SubscriptionConfigurations.Add(new BOConfiguration() { PropertyName = Constants.AvailableSubscriptionSettings.TimerMaintenancePollingInterval });
            model.SubscriptionConfigurations.Add(new BOConfiguration() { PropertyName = Constants.AvailableSubscriptionSettings.MaxScheduleThreads });
            model.SubscriptionConfigurations.Add(new BOConfiguration() { PropertyName = Constants.AvailableSubscriptionSettings.HeadquartersTimeZone });
            model.SubscriptionConfigurations.Add(new BOConfiguration() { PropertyName = Constants.AvailableSubscriptionSettings.SubscriptionLogLevel });
            model.SubscriptionConfigurations.Add(new BOConfiguration() { PropertyName = Constants.AvailableSubscriptionSettings.SubscriptionNameFormat });
            model.SubscriptionConfigurations.Add(new BOConfiguration() { PropertyName = Constants.AvailableSubscriptionSettings.MaxReportFileAge });
            model.SubscriptionConfigurations.Add(new BOConfiguration() { PropertyName = Constants.AvailableSubscriptionSettings.MaxScheduleFailCount });
            model.SubscriptionConfigurations.Add(new BOConfiguration() { PropertyName = Constants.AvailableSubscriptionSettings.MaxScheduleQueueAge });
            model.SubscriptionConfigurations.Add(new BOConfiguration() { PropertyName = Constants.AvailableSubscriptionSettings.SubscriptionReportTimeout });
            model.SubscriptionConfigurations.Add(new BOConfiguration() { PropertyName = Constants.AvailableSubscriptionSettings.SubscriptionZipThreshold });
            model.SubscriptionConfigurations.Add(new BOConfiguration() { PropertyName = Constants.AvailableSubscriptionSettings.SubscriptionEmailAttachmentThreshold });
            #endregion

            foreach (BOConfiguration setting in collection)
            {
                if (model.ApplicationConfigurations[setting.PropertyName] != null)
                {
                    model.ApplicationConfigurations[setting.PropertyName].PropertyValue = setting.PropertyValue;
                    model.ApplicationConfigurations[setting.PropertyName].PropertyDescription = setting.PropertyDescription;
                }
            }
            foreach (BOConfiguration setting in collection)
            {
                if (model.SubscriptionConfigurations[setting.PropertyName] != null)
                {
                    model.SubscriptionConfigurations[setting.PropertyName].PropertyValue = setting.PropertyValue;
                    model.SubscriptionConfigurations[setting.PropertyName].PropertyDescription = setting.PropertyDescription;

                }
            }

            model.SubscriptionNameFormat = new List<string>()
            {
                Constants.SubscriptionNameFormats.NameDate,
                Constants.SubscriptionNameFormats.ReportDate,
                Constants.SubscriptionNameFormats.ReportNameDate
            };

            model.SubscriptionLogLevel = new Dictionary<int, string>()
            {
                {(int)TraceLevel.None, TraceLevel.None.ToString()},
                {(int)TraceLevel.Standard, TraceLevel.Standard.ToString()},
                {(int)TraceLevel.Verbose, TraceLevel.Verbose.ToString()}
            };
            return model;
        }
예제 #19
0
        /// <summary>
        /// Gets the catalog items from the SRS.
        /// </summary>
        public static CatalogModel GetCatalogItems(AuthenticatedUserManager user, ReportingServiceClient srsProxy)
        {
            CatalogModel final = new CatalogModel();
            NCatalogItemCollection catalogs = user.CatalogInteractionManager.LookupCatalogItems(null, true, true, srsProxy);
            List<CatalogModel> models = new List<CatalogModel>();

            foreach (NCatalogItem item in catalogs)
            {
                models.Add(ToModel(item));
            }
            final.AllItems = models;

            //Process Child
            List<CatalogModel> finalCatalog = new List<CatalogModel>();
            foreach (var parent in models)
            {
                parent.AllItems.Add(parent);
                if (parent.ItemType.Equals("Folder", StringComparison.OrdinalIgnoreCase))
                {
                    foreach (var child in models)
                    {
                        //check parents
                        if (child.Parent.Equals(parent.Path, StringComparison.OrdinalIgnoreCase))
                        {
                            parent.Children.Add(child);
                        }
                    }

                    if(parent.Parent.Equals("root", StringComparison.OrdinalIgnoreCase))
                    {
                        finalCatalog.Add(parent);
                    }
                }
            }
            final.Catalogs = finalCatalog;
            final.SRSProxy = srsProxy;
            return final;
        }