Beispiel #1
0
        public void InitView(long idTemplate, long idVersion)
        {
            dtoSelectorContext context = GetContext();

            View.ContainerContext  = context;
            View.ContentIdTemplate = idTemplate;
            View.ContentIdVersion  = idVersion;
            if (UserContext.isAnonymous)
            {
                View.DisplaySessionTimeout();
            }
            else
            {
                if (HasPermission(context))
                {
                    InitializeView(idTemplate, idVersion, context);
                }
                else if (context.ObjectOwner != null)
                {
                    View.DisplayNoPermission(context.IdCommunity, context.IdModule, context.ModuleCode);
                }
                else
                {
                    View.DisplayNoPermission(context.IdCommunity, TemplatesService.ServiceModuleID(), context.ModuleCode);
                }
            }
        }
Beispiel #2
0
        private Boolean HasPermission(dtoSelectorContext context)
        {
            Person p = CurrentManager.GetPerson(UserContext.CurrentUserID);

            ModuleTemplateMessages permission = (context.IsForPortal) ? ModuleTemplateMessages.CreatePortalmodule((p == null) ? (Int32)UserTypeStandard.Guest : p.TypeID, OwnerType.System) : new ModuleTemplateMessages(CurrentManager.GetModulePermission(UserContext.CurrentUserID, context.IdCommunity, TemplatesService.ServiceModuleID()));

            if (permission.Administration)
            {
                //List<lm.Comol.Core.TemplateMessages.ModuleGenericTemplateMessages> permissions = InitializePermissions(forPortal, idCommunity, p);
                return(true);
            }
            else
            {
                return(View.HasModulePermissions(context.ModuleCode, GetModulePermissions(context.IdModule, context.IdCommunity), context.IdCommunity, (p == null) ? (int)UserTypeStandard.Guest : p.TypeID, context.ObjectOwner));
            }
        }