private DotNetReportSettings GetSettings()
        {
            var settings = new DotNetReportSettings
            {
                ApiUrl              = ConfigurationManager.AppSettings["dotNetReport.apiUrl"],
                AccountApiToken     = ConfigurationManager.AppSettings["dotNetReport.accountApiToken"],    // Your Account Api Token from your http://dotnetreport.com Account
                DataConnectApiToken = ConfigurationManager.AppSettings["dotNetReport.dataconnectApiToken"] // Your Data Connect Api Token from your http://dotnetreport.com Account
            };

            // Populate the values below using your Application Roles/Claims if applicable

            settings.ClientId        = "";                  // You can pass your multi-tenant client id here to track their reports and folders
            settings.UserId          = "";                  // You can pass your current authenticated user id here to track their reports and folders
            settings.UserName        = "";
            settings.CurrentUserRole = new List <string>(); // Populate your current authenticated user's roles

            settings.Users           = new List <string>(); // Populate all your application's user, ex  { "Jane", "John" }
            settings.UserRoles       = new List <string>(); // Populate all your application's user roles, ex  { "Admin", "Normal" }
            settings.CanUseAdminMode = true;                // Set to true only if current user can use Admin mode to setup reports and dashboard

            // An example of populating Roles using MVC web security if available
            if (Roles.Enabled && User.Identity.IsAuthenticated)
            {
                settings.UserId          = User.Identity.Name;
                settings.CurrentUserRole = Roles.GetRolesForUser(User.Identity.Name).ToList();

                settings.Users     = Roles.GetAllRoles().SelectMany(x => Roles.GetUsersInRole(x)).ToList();
                settings.UserRoles = Roles.GetAllRoles().ToList();
            }

            return(settings);
        }
Exemplo n.º 2
0
        private DotNetReportSettings GetSettings()
        {
            var settings = new DotNetReportSettings
            {
                ApiUrl              = ConfigurationManager.AppSettings["dotNetReport.apiUrl"],
                AccountApiToken     = ConfigurationManager.AppSettings["dotNetReport.accountApiToken"],    // Your Account Api Token from your http://dotnetreport.com Account
                DataConnectApiToken = ConfigurationManager.AppSettings["dotNetReport.dataconnectApiToken"] // Your Data Connect Api Token from your http://dotnetreport.com Account
            };

            if (TempData["reportPrint"] != null && TempData["reportPrint"].ToString() == "true")
            {
                if (TempData["clientId"] != null)
                {
                    settings.ClientId = (string)TempData["clientId"];
                }
                if (TempData["userId"] != null)
                {
                    settings.UserId = (string)TempData["userId"];
                }
                settings.CurrentUserRole = (TempData["currentUserRole"] != null) ? ((string)TempData["currentUserRole"]).Split(',').ToList() : new List <string>();
                settings.DataFilters     = (TempData["dataFilters"] != null) ? JsonConvert.DeserializeObject <dynamic>((string)TempData["dataFilters"]) : new { };
                return(settings);
            }

            // Populate the values below using your Application Roles/Claims if applicable
            settings.ClientId        = "";                  // You can pass your multi-tenant client id here to track their reports and folders
            settings.UserId          = "";                  // You can pass your current authenticated user id here to track their reports and folders
            settings.UserName        = "";
            settings.CurrentUserRole = new List <string>(); // Populate your current authenticated user's roles

            settings.Users           = new List <string>(); // Populate all your application's user, ex  { "Jane", "John" }
            settings.UserRoles       = new List <string>(); // Populate all your application's user roles, ex  { "Admin", "Normal" }
            settings.CanUseAdminMode = true;                // Set to true only if current user can use Admin mode to setup reports and dashboard
            settings.DataFilters     = new { };             // add global data filters to apply as needed https://dotnetreport.com/kb/docs/advance-topics/global-filters/

            // An example of populating Roles using MVC web security if available
            if (Roles.Enabled && User.Identity.IsAuthenticated)
            {
                settings.UserId          = User.Identity.Name;
                settings.CurrentUserRole = Roles.GetRolesForUser(User.Identity.Name).ToList();

                settings.Users     = Roles.GetAllRoles().SelectMany(x => Roles.GetUsersInRole(x)).ToList();
                settings.UserRoles = Roles.GetAllRoles().ToList();
            }

            return(settings);
        }
Exemplo n.º 3
0
        public DotNetReportSettings GetSettings()
        {
            var settings = new DotNetReportSettings
            {
                ApiUrl              = Startup.StaticConfig.GetValue <string>("dotNetReport:apiUrl"),
                AccountApiToken     = Startup.StaticConfig.GetValue <string>("dotNetReport:accountApiToken"),    // Your Account Api Token from your http://dotnetreport.com Account
                DataConnectApiToken = Startup.StaticConfig.GetValue <string>("dotNetReport:dataconnectApiToken") // Your Data Connect Api Token from your http://dotnetreport.com Account
            };

            // Populate the values below using your Application Roles/Claims if applicable

            settings.ClientId        = "";                  // You can pass your multi-tenant client id here to track their reports and folders
            settings.UserId          = "";                  // You can pass your current authenticated user id here to track their reports and folders
            settings.UserName        = "";
            settings.CurrentUserRole = new List <string>(); // Populate your current authenticated user's roles

            settings.Users           = new List <string>(); // Populate all your application's user, ex  { "Jane", "John" }
            settings.UserRoles       = new List <string>(); // Populate all your application's user roles, ex  { "Admin", "Normal" }
            settings.CanUseAdminMode = true;                // Set to true only if current user can use Admin mode to setup reports and dashboard

            return(settings);
        }