コード例 #1
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.svg",
                SubscriptionManager               = new ProductSubscriptionManager(),
                DefaultSortOrder                  = 20,
                SpaceUsageStatManager             = new ProjectsSpaceUsageStatManager(),
                AdminOpportunities                = () => ProjectsCommonResource.ProductAdminOpportunities.Split('|').ToList(),
                UserOpportunities                 = () => ProjectsCommonResource.ProductUserOpportunities.Split('|').ToList(),
                HasComplexHierarchyOfAccessRights = true,
            };

            FileEngine.RegisterFileSecurityProvider();
            SearchHandlerManager.Registry(new SearchHandler());
            NotifyClient.RegisterSecurityInterceptor();
            ClientScriptLocalization = new ClientLocalizationResources();
            DIHelper.Register();

            Mapper.Initialize(cfg =>
            {
                cfg.CreateMap <Task, TasksWrapper>().ForMember(r => r.TenantId, opt => opt.MapFrom(r => GetCurrentTenant()));
                cfg.CreateMap <Message, DiscussionsWrapper>().ForMember(r => r.TenantId, opt => opt.MapFrom(r => GetCurrentTenant()));
                cfg.CreateMap <Milestone, MilestonesWrapper>().ForMember(r => r.TenantId, opt => opt.MapFrom(r => GetCurrentTenant()));
                cfg.CreateMap <Project, ProjectsWrapper>().ForMember(r => r.TenantId, opt => opt.MapFrom(r => GetCurrentTenant()));
                cfg.CreateMap <Subtask, SubtasksWrapper>().ForMember(r => r.TenantId, opt => opt.MapFrom(r => GetCurrentTenant()));
                cfg.CreateMap <Comment, CommentsWrapper>().ForMember(r => r.TenantId, opt => opt.MapFrom(r => GetCurrentTenant()));
            });
        }
コード例 #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",
                SubscriptionManager               = new ProductSubscriptionManager(),
                DefaultSortOrder                  = 20,
                SpaceUsageStatManager             = new ProjectsSpaceUsageStatManager(),
                AdminOpportunities                = () => ProjectsCommonResource.ProductAdminOpportunities.Split('|').ToList(),
                UserOpportunities                 = () => ProjectsCommonResource.ProductUserOpportunities.Split('|').ToList(),
                HasComplexHierarchyOfAccessRights = true,
            };

            FileEngine.RegisterFileSecurityProvider();
            SearchHandlerManager.Registry(new SearchHandler());
            NotifyClient.RegisterSecurityInterceptor();
            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",
                SubscriptionManager               = new ProductSubscriptionManager(),
                DefaultSortOrder                  = 20,
                SpaceUsageStatManager             = new ProjectsSpaceUsageStatManager(),
                AdminOpportunities                = () => ProjectsCommonResource.ProductAdminOpportunities.Split('|').ToList(),
                UserOpportunities                 = () => ProjectsCommonResource.ProductUserOpportunities.Split('|').ToList(),
                HasComplexHierarchyOfAccessRights = true,
            };

            FileEngine.RegisterFileSecurityProvider();
            SearchHandlerManager.Registry(new SearchHandler());

            var securityInterceptor = new SendInterceptorSkeleton(
                "ProjectInterceptorSecurity",
                InterceptorPlace.DirectSend,
                InterceptorLifetime.Global,
                (r, p) =>
            {
                try
                {
                    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.TaskEngine.GetByID(entityId, false);

                        if (task == null && projectId != 0)
                        {
                            var project = Global.EngineFactory.ProjectEngine.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.MessageEngine.GetByID(entityId, false);

                        if (discussion == null && projectId != 0)
                        {
                            var project = Global.EngineFactory.ProjectEngine.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.MilestoneEngine.GetByID(entityId, false);

                        if (milestone == null && projectId != 0)
                        {
                            var project = Global.EngineFactory.ProjectEngine.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);
                }
                return(false);
            });

            NotifyClient.Instance.Client.AddInterceptor(securityInterceptor);
        }
コード例 #4
0
 public void Configure()
 {
     FileEngine.RegisterFileSecurityProvider();
     //Register prodjects' calendar events
     CalendarManager.Instance.RegistryCalendarProvider(ProjectApi.GetUserCalendars);
 }