コード例 #1
0
 public void Configure()
 {
     if (!FilesIntegration.IsRegisteredFileSecurityProvider(AttachmentEngine.Module, AttachmentEngine.Bunch))
     {
         FilesIntegration.RegisterFileSecurityProvider(AttachmentEngine.Module, AttachmentEngine.Bunch, new SecurityAdapterProvider());
     }
 }
コード例 #2
0
        public override void Init()
        {
            context = new ProductContext
            {
                MasterPageFile        = String.Concat(PathProvider.BaseVirtualPath, "Masters/BasicTemplate.Master"),
                DisabledIconFileName  = "product_disabled_logo.png",
                IconFileName          = "product_logo.png",
                LargeIconFileName     = "product_logolarge.png",
                DefaultSortOrder      = 30,
                SubscriptionManager   = new ProductSubscriptionManager(),
                SpaceUsageStatManager = new CRMSpaceUsageStatManager(),
                AdminOpportunities    = () => CRMCommonResource.ProductAdminOpportunities.Split('|').ToList(),
                UserOpportunities     = () => CRMCommonResource.ProductUserOpportunities.Split('|').ToList(),
            };

            if (!FilesIntegration.IsRegisteredFileSecurityProvider("crm", "crm_common"))
            {
                FilesIntegration.RegisterFileSecurityProvider("crm", "crm_common", new FileSecurityProvider());
            }
            if (!FilesIntegration.IsRegisteredFileSecurityProvider("crm", "opportunity"))
            {
                FilesIntegration.RegisterFileSecurityProvider("crm", "opportunity", new FileSecurityProvider());
            }

            SearchHandlerManager.Registry(new SearchHandler());

            GlobalConfiguration.Configuration.Routes.MapHttpRoute(
                name: "Twilio",
                routeTemplate: "twilio/{action}",
                defaults: new { controller = "Twilio", action = "index" });

            ClientScriptLocalization = new ClientLocalizationResources();
            DIHelper.Register();
        }
コード例 #3
0
        public override void Init()
        {
            context = new ProductContext
            {
                MasterPageFile        = String.Concat(PathProvider.BaseVirtualPath, "Masters/BasicTemplate.Master"),
                DisabledIconFileName  = "product_disabled_logo.png",
                IconFileName          = "product_logo.png",
                LargeIconFileName     = "product_logolarge.png",
                DefaultSortOrder      = 30,
                SubscriptionManager   = new ProductSubscriptionManager(),
                SpaceUsageStatManager = new CRMSpaceUsageStatManager(),
                AdminOpportunities    = () => CRMCommonResource.ProductAdminOpportunities.Split('|').ToList(),
                UserOpportunities     = () => CRMCommonResource.ProductUserOpportunities.Split('|').ToList(),
            };

            if (!FilesIntegration.IsRegisteredFileSecurityProvider("crm", "crm_common"))
            {
                FilesIntegration.RegisterFileSecurityProvider("crm", "crm_common", new FileSecurityProvider());
            }
            if (!FilesIntegration.IsRegisteredFileSecurityProvider("crm", "opportunity"))
            {
                FilesIntegration.RegisterFileSecurityProvider("crm", "opportunity", new FileSecurityProvider());
            }

            SearchHandlerManager.Registry(new SearchHandler());
        }
コード例 #4
0
        public override void Init(ProductContext productContext)
        {
            productContext.ThemesFolderVirtualPath = String.Concat(PathProvider.BaseVirtualPath, "App_Themes");
            productContext.ImageFolder             = "images";
            productContext.MasterPageFile          = String.Concat(PathProvider.BaseVirtualPath, "Masters/BasicTemplate.Master");
            productContext.DisabledIconFileName    = "product_disabled_logo.png";
            productContext.IconFileName            = "product_logo.png";
            productContext.LargeIconFileName       = "product_logolarge.png";
            productContext.UserActivityPublishers  = new List <IUserActivityPublisher>()
            {
                new TimeLinePublisher()
            };
            productContext.DefaultSortOrder      = 20;
            productContext.SubscriptionManager   = new ProductSubscriptionManager();
            productContext.SpaceUsageStatManager = new CRMSpaceUsageStatManager();
            productContext.AdminOpportunities    = GetAdminOpportunities;
            productContext.UserOpportunities     = GetUserOpportunities;

            if (!FilesIntegration.IsRegisteredFileSecurityProvider("crm", "crm_common"))
            {
                FilesIntegration.RegisterFileSecurityProvider("crm", "crm_common", new FileSecurityProvider());
            }

            _productContext = productContext;

            SearchHandlerManager.Registry(new SearchHandler());
        }
コード例 #5
0
        protected void Application_Start()
        {
            log4net.Config.XmlConfigurator.Configure();
            AreaRegistration.RegisterAllAreas();
            RegisterRoutes(RouteTable.Routes);

            var iisversion = GetIISVersion();

            if (iisversion != 0 && iisversion < 7)
            {
                AddMimeMapping(".png", "image/png");
                AddMimeMapping(".svg", "image/svg+xml");
            }

            DbRegistry.Configure();

            if (ConfigurationManager.AppSettings["resources.from-db"] == "true")
            {
                AssemblyWork.UploadResourceData(AppDomain.CurrentDomain.GetAssemblies());
                AppDomain.CurrentDomain.AssemblyLoad += (sender, args) => AssemblyWork.UploadResourceData(AppDomain.CurrentDomain.GetAssemblies());
            }

            //HACK: Register CRM and Projects file integrations
            if (!FilesIntegration.IsRegisteredFileSecurityProvider("projects", "project"))
            {
                FilesIntegration.RegisterFileSecurityProvider("projects", "project", new ASC.Projects.Engine.SecurityAdapterProvider());
            }

            if (!FilesIntegration.IsRegisteredFileSecurityProvider("crm", "crm_common"))
            {
                FilesIntegration.RegisterFileSecurityProvider("crm", "crm_common", new ASC.CRM.Core.FileSecurityProvider());
            }
        }
コード例 #6
0
        public void Configure()
        {
            FilesIntegration.RegisterFileSecurityProvider("projects", "project", new SecurityAdapterProvider());

            //Register prodjects' calendar events
            CalendarManager.Instance.RegistryCalendarProvider(ProjectApi.GetUserCalendars);
        }
コード例 #7
0
 /// <summary>
 /// </summary>
 /// <param name="context"></param>
 /// <param name="fileStorageService"></param>
 public DocumentsApi(ApiContext context, IFileStorageService fileStorageService)
 {
     _context            = context;
     _fileStorageService = fileStorageService;
     if (!FilesIntegration.IsRegisteredFileSecurityProvider("crm", "crm_common"))
     {
         FilesIntegration.RegisterFileSecurityProvider("crm", "crm_common", new FileSecurityProvider());
     }
 }
コード例 #8
0
        /// <summary>
        /// </summary>
        /// <param name="context"></param>
        /// <param name="fileStorageService"></param>
        public DocumentsApi(ApiContext context, IFileStorageService fileStorageService)
        {
            _context            = context;
            _fileStorageService = fileStorageService;
            //TODO: Why not to move this code to DAO???
            if (!DbRegistry.IsDatabaseRegistered(FileConstant.DatabaseId))
            {
                DbRegistry.RegisterDatabase(FileConstant.DatabaseId,
                                            WebConfigurationManager.ConnectionStrings[FileConstant.DatabaseId]);
            }

            if (!FilesIntegration.IsRegisteredFileSecurityProvider("crm", "crm_common"))
            {
                FilesIntegration.RegisterFileSecurityProvider("crm", "crm_common", new FileSecurityProvider());
            }
        }
コード例 #9
0
        public void Configure()
        {
            if (!DbRegistry.IsDatabaseRegistered(FileConstant.DatabaseId))
            {
                DbRegistry.RegisterDatabase(FileConstant.DatabaseId, WebConfigurationManager.ConnectionStrings[FileConstant.DatabaseId]);
            }


            if (!FilesIntegration.IsRegisteredFileSecurityProvider("crm", "crm_common"))
            {
                FilesIntegration.RegisterFileSecurityProvider("crm", "crm_common", new FileSecurityProvider());
            }

            //Register prodjects' calendar events
            CalendarManager.Instance.RegistryCalendarProvider(CRMApi.GetUserCalendars);
        }
コード例 #10
0
        public void Configure()
        {
            if (!DbRegistry.IsDatabaseRegistered(ProjectApiBase.DbId))
            {
                DbRegistry.RegisterDatabase(ProjectApiBase.DbId, WebConfigurationManager.ConnectionStrings[ProjectApiBase.DbId]);
            }

            if (!DbRegistry.IsDatabaseRegistered(FileConstant.DatabaseId))
            {
                DbRegistry.RegisterDatabase(FileConstant.DatabaseId, WebConfigurationManager.ConnectionStrings[FileConstant.DatabaseId]);
            }

            FilesIntegration.RegisterFileSecurityProvider("projects", "project", new SecurityAdapterProvider());

            //Register prodjects' calendar events
            CalendarManager.Instance.RegistryCalendarProvider(ProjectApi.GetUserCalendars);
        }
コード例 #11
0
        public void Configure()
        {
            if (!FilesIntegration.IsRegisteredFileSecurityProvider("crm", "crm_common"))
            {
                FilesIntegration.RegisterFileSecurityProvider("crm", "crm_common", new FileSecurityProvider());
            }

            //Register prodjects' calendar events
            CalendarManager.Instance.RegistryCalendarProvider(userid =>
            {
                if (WebItemSecurity.IsAvailableForUser(WebItemManager.CRMProductID, userid))
                {
                    return(new List <BaseCalendar> {
                        new CRMCalendar(userid)
                    });
                }
                return(new List <BaseCalendar>());
            });
        }
コード例 #12
0
        public override void Init(ProductContext productContext)
        {
            if (!DbRegistry.IsDatabaseRegistered(Global.DB_ID))
            {
                DbRegistry.RegisterDatabase(Global.DB_ID, WebConfigurationManager.ConnectionStrings[Global.DB_ID]);
            }

            new SearchHandler();

            ConfigurationManager.Configure(ID, PathProvider.BaseVirtualPath, String.Empty, Global.FileStorageModule);

            productContext.ThemesFolderVirtualPath   = String.Concat(PathProvider.BaseVirtualPath, "App_Themes");
            productContext.ImageFolder               = "images";
            productContext.MasterPageFile            = String.Concat(PathProvider.BaseVirtualPath, "Masters/BasicTemplate.Master");
            productContext.DisabledIconFileName      = "product_disabled_logo.png";
            productContext.IconFileName              = "product_logo.png";
            productContext.LargeIconFileName         = "product_logolarge.png";
            productContext.SubscriptionManager       = new ProductSubscriptionManager();
            productContext.UserActivityControlLoader = new ProjectActivity();
            productContext.WhatsNewHandler           = new WhatsNewHandler();
            productContext.UserActivityPublishers    = new List <IUserActivityPublisher>()
            {
                new TimeLinePublisher()
            };
            productContext.DefaultSortOrder                  = 10;
            productContext.SpaceUsageStatManager             = new ProjectsSpaceUsageStatManager();
            productContext.AdminOpportunities                = GetAdminOpportunities;
            productContext.UserOpportunities                 = GetUserOpportunities;
            productContext.HasComplexHierarchyOfAccessRights = true;

            context = productContext;

            NotifyClient.Instance.Client.RegisterSendMethod(SendMsgMilestoneDeadline, TimeSpan.FromDays(1), DateTime.UtcNow.Date.AddHours(7));
            NotifyClient.Instance.Client.RegisterSendMethod(ReportHelper.SendAutoReports, TimeSpan.FromHours(1), DateTime.UtcNow.Date.AddHours(DateTime.UtcNow.Hour));
            NotifyClient.Instance.Client.RegisterSendMethod(TaskHelper.SendAutoReminderAboutTask, TimeSpan.FromHours(1), DateTime.UtcNow.Date.AddHours(DateTime.UtcNow.Hour));

            NotifyClient.Instance.Client.AddInterceptor(InterceptorSecurity);

            UserActivityManager.AddFilter(new WhatsNewHandler());

            FilesIntegration.RegisterFileSecurityProvider("projects", "project", new SecurityAdapterProvider());
            SearchHandlerManager.Registry(new SearchHandler());
        }
コード例 #13
0
        public void Configure()
        {
            if (!FilesIntegration.IsRegisteredFileSecurityProvider("crm", "crm_common"))
            {
                FilesIntegration.RegisterFileSecurityProvider("crm", "crm_common", new FileSecurityProvider());
            }

            //Register prodjects' calendar events
            CalendarManager.Instance.RegistryCalendarProvider(userid =>
            {
                if (WebItemSecurity.IsAvailableForUser(WebItemManager.CRMProductID.ToString(), userid))
                {
                    var factory = new DaoFactory(CoreContext.TenantManager.GetCurrentTenant().TenantId, CRMConstants.DatabaseId);
                    return(new List <BaseCalendar> {
                        new CRMCalendar(factory, userid)
                    });
                }
                return(new List <BaseCalendar>());
            });
        }
コード例 #14
0
        public void Configure()
        {
            if (!DbRegistry.IsDatabaseRegistered(ProjectApiBase.DbId))
            {
                DbRegistry.RegisterDatabase(ProjectApiBase.DbId, WebConfigurationManager.ConnectionStrings[ProjectApiBase.DbId]);
            }

            if (!DbRegistry.IsDatabaseRegistered(FileConstant.DatabaseId))
            {
                DbRegistry.RegisterDatabase(FileConstant.DatabaseId, WebConfigurationManager.ConnectionStrings[FileConstant.DatabaseId]);
            }

            ConfigurationManager.Configure(ProductEntryPoint.ID, PathProvider.BaseVirtualPath, String.Empty, ProjectApiBase.DbId);
            FilesIntegration.RegisterFileSecurityProvider("projects", "project", new SecurityAdapterProvider());
            //Register user activity
            ProductManager.RegisterUserActivityPublisher(new TimeLinePublisher());//That shit adds themselve in publisher list in constructor

            //Register prodjects' calendar events
            CalendarManager.Instance.RegistryCalendarProvider(ProjectApi.GetUserCalendars);
        }
コード例 #15
0
ファイル: FileEngine.cs プロジェクト: zfzfzf/CommunityServer
 public static void RegisterFileSecurityProvider()
 {
     FilesIntegration.RegisterFileSecurityProvider(Module, Bunch, new SecurityAdapterProvider());
 }
コード例 #16
0
        public override void Init()
        {
            context = new ProductContext
            {
                MasterPageFile                    = String.Concat(PathProvider.BaseVirtualPath, "Masters/BasicTemplate.Master"),
                DisabledIconFileName              = "product_disabled_logo.png",
                IconFileName                      = "product_logo.png",
                LargeIconFileName                 = "product_logolarge.png",
                SubscriptionManager               = new ProductSubscriptionManager(),
                DefaultSortOrder                  = 20,
                SpaceUsageStatManager             = new ProjectsSpaceUsageStatManager(),
                AdminOpportunities                = () => ProjectsCommonResource.ProductAdminOpportunities.Split('|').ToList(),
                UserOpportunities                 = () => ProjectsCommonResource.ProductUserOpportunities.Split('|').ToList(),
                HasComplexHierarchyOfAccessRights = true,
            };

            FilesIntegration.RegisterFileSecurityProvider("projects", "project", new SecurityAdapterProvider());
            SearchHandlerManager.Registry(new SearchHandler());

            var securityInterceptor = new SendInterceptorSkeleton(
                "ProjectInterceptorSecurity",
                InterceptorPlace.DirectSend,
                InterceptorLifetime.Global,
                (r, p) =>
            {
                HttpContext.Current = null;
                try
                {
                    HttpContext.Current = new HttpContext(
                        new HttpRequest("hack", CommonLinkUtility.GetFullAbsolutePath("/"), string.Empty),
                        new HttpResponse(new StringWriter()));

                    var data       = r.ObjectID.Split('_');
                    var entityType = data[0];
                    var entityId   = Convert.ToInt32(data[1]);

                    var projectId = 0;

                    if (data.Length == 3)
                    {
                        projectId = Convert.ToInt32(r.ObjectID.Split('_')[2]);
                    }

                    switch (entityType)
                    {
                    case "Task":
                        var task = Global.EngineFactory.GetTaskEngine().GetByID(entityId, false);

                        if (task == null && projectId != 0)
                        {
                            var project = Global.EngineFactory.GetProjectEngine().GetByID(projectId, false);
                            return(!ProjectSecurity.CanRead(project, new Guid(r.Recipient.ID)));
                        }

                        return(!ProjectSecurity.CanRead(task, new Guid(r.Recipient.ID)));

                    case "Message":
                        var discussion = Global.EngineFactory.GetMessageEngine().GetByID(entityId, false);

                        if (discussion == null && projectId != 0)
                        {
                            var project = Global.EngineFactory.GetProjectEngine().GetByID(projectId, false);
                            return(!ProjectSecurity.CanRead(project, new Guid(r.Recipient.ID)));
                        }

                        return(!ProjectSecurity.CanRead(discussion, new Guid(r.Recipient.ID)));

                    case "Milestone":
                        var milestone = Global.EngineFactory.GetMilestoneEngine().GetByID(entityId, false);

                        if (milestone == null && projectId != 0)
                        {
                            var project = Global.EngineFactory.GetProjectEngine().GetByID(projectId, false);
                            return(!ProjectSecurity.CanRead(project, new Guid(r.Recipient.ID)));
                        }

                        return(!ProjectSecurity.CanRead(milestone, new Guid(r.Recipient.ID)));
                    }
                }
                catch (Exception ex)
                {
                    LogManager.GetLogger("ASC.Projects.Tasks").Error("Send", ex);
                }
                finally
                {
                    if (HttpContext.Current != null)
                    {
                        new DisposableHttpContext(HttpContext.Current).Dispose();
                        HttpContext.Current = null;
                    }
                }
                return(false);
            });

            NotifyClient.Instance.Client.AddInterceptor(securityInterceptor);
        }