Esempio n. 1
0
 /// <summary>
 /// On check permissions event handler.
 /// </summary>
 protected void emailTemplateListElem_OnCheckPermissions(string permissionType, CMSAdminControl sender)
 {
     if (!CMSContext.CurrentUser.IsAuthorizedPerResource("cms.emailtemplates", permissionType))
     {
         RedirectToCMSDeskAccessDenied("CMS.EmailTemplates", permissionType);
     }
 }
 protected void elemSubscriptions_OnCheckPermissions(string permissionType, CMSAdminControl sender)
 {
     if (!MembershipContext.AuthenticatedUser.IsAuthorizedPerResource("CMS.Users", CMSAdminControl.PERMISSION_MODIFY))
     {
         RedirectToAccessDenied("CMS.Users", CMSAdminControl.PERMISSION_MODIFY);
     }
 }
 protected void CheckPermissions(string permissionType, CMSAdminControl sender)
 {
     if ((!currentUser.IsAuthorizedPerResource("CMS.Friends", permissionType)) && (currentUser.UserID != userId))
     {
         RedirectToAccessDenied("CMS.Friends", permissionType);
     }
 }
Esempio n. 4
0
 protected void membershipEditElem_OnCheckPermissions(string permissionType, CMSAdminControl sender)
 {
     if (!CMSContext.CurrentUser.IsAuthorizedPerResource("CMS.Membership", permissionType))
     {
         RedirectToCMSDeskAccessDenied("CMS.Membership", permissionType);
     }
 }
    private void forumSecurity_OnCheckPermissions(string permissionType, CMSAdminControl sender)
    {
        int groupId = 0;
        ForumInfo fi = ForumInfoProvider.GetForumInfo(ValidationHelper.GetInteger(Request.QueryString["forumid"], 0));
        if (fi != null)
        {
            ForumGroupInfo fgi = ForumGroupInfoProvider.GetForumGroupInfo(fi.ForumGroupID);
            if (fgi != null)
            {
                groupId = fgi.GroupGroupID;
            }
        }

        // Check permissions
        if (!CMSContext.CurrentUser.IsGroupAdministrator(groupId))
        {
            // Check permissions
            if (!CMSContext.CurrentUser.IsAuthorizedPerResource("CMS.Groups", permissionType))
            {
                forumSecurity.StopProcessing = true;

                // Redirect only if permission READ is check
                if (permissionType == CMSAdminControl.PERMISSION_READ)
                {
                    RedirectToCMSDeskAccessDenied("CMS.Groups", permissionType);
                }
            }
        }
    }
 private void ucOptions_OnCheckPermissions(string permissionType, CMSAdminControl sender)
 {
     if (permissionType == CMSAdminControl.PERMISSION_MODIFY)
     {
         CheckProductModifyAndRedirect(EditedObject as SKUInfo);
     }
 }
 /// <summary>
 /// Check permission.
 /// </summary>
 /// <param name="permissionType">Permission type</param>
 /// <param name="sender">Sender</param>
 private void ucAbuseReportList_OnCheckPermissions(string permissionType, CMSAdminControl sender)
 {
     if (!CMSContext.CurrentUser.IsAuthorizedPerResource("CMS.AbuseReport", permissionType))
     {
         sender.StopProcessing = true;
         RedirectToAccessDenied("CMS.AbuseReport", permissionType);
     }
 }
Esempio n. 8
0
 /// <summary>
 /// Check permissions event handler.
 /// </summary>
 void PollSecurity_OnCheckPermissions(string permissionType, CMSAdminControl sender)
 {
     // Check permissions
     if (!CMSContext.CurrentUser.IsAuthorizedPerResource("CMS.Polls", permissionType))
     {
         sender.StopProcessing = true;
     }
 }
 protected void userNotificationsElem_OnCheckPermissions(string permissionType, CMSAdminControl sender)
 {
     CurrentUserInfo cui = CMSContext.CurrentUser;
     if ((cui == null) || ((userId != cui.UserID) && !cui.IsAuthorizedPerResource("CMS.Users", permissionType)))
     {
         RedirectToCMSDeskAccessDenied("CMS.Users", permissionType);
     }
 }
 /// <summary>
 /// OnCheckPermissions event handler.
 /// </summary>
 private void elemEdit_OnCheckPermissions(string permissionType, CMSAdminControl sender)
 {
     MediaLibraryInfo mli = (MediaLibraryInfo)EditedObject;
     if (!MediaLibraryInfoProvider.IsUserAuthorizedPerLibrary(mli, "Read"))
     {
         RedirectToAccessDenied("cms.medialibrary", "Read");
     }
 }
 private void CheckPermissions(string permissionType, CMSAdminControl sender)
 {
     CurrentUserInfo currentUser = CMSContext.CurrentUser;
     if ((!currentUser.IsAuthorizedPerResource("CMS.Friends", permissionType)) && (currentUser.UserID != userId))
     {
         RedirectToAccessDenied("CMS.Friends", permissionType);
     }
 }
 protected void userNotificationsElem_OnCheckPermissions(string permissionType, CMSAdminControl sender)
 {
     var cui = MembershipContext.AuthenticatedUser;
     if ((cui == null) || ((mUserId != cui.UserID) && !cui.IsAuthorizedPerResource("CMS.Users", permissionType)))
     {
         RedirectToAccessDenied("CMS.Users", permissionType);
     }
 }
Esempio n. 13
0
 void emailSender_OnCheckPermissions(string permissionType, CMSAdminControl sender)
 {
     // Check READ permission
     if (!CMSContext.CurrentUser.IsAuthorizedPerResource("CMS.EventManager", permissionType))
     {
         RedirectToCMSDeskAccessDenied("CMS.EventManager", permissionType);
     }
 }
 void elemEdit_OnCheckPermissions(string permissionType, CMSAdminControl sender)
 {
     MediaLibraryInfo mli = MediaLibraryInfoProvider.GetMediaLibraryInfo(QueryHelper.GetInteger("libraryid", 0));
     if (!MediaLibraryInfoProvider.IsUserAuthorizedPerLibrary(mli, "Read"))
     {
         CMSPage.RedirectToCMSDeskAccessDenied("cms.medialibrary", "Read");
     }
 }
 /// <summary>
 /// Check permissions event handler.
 /// </summary>
 private void PollSecurity_OnCheckPermissions(string permissionType, CMSAdminControl sender)
 {
     // Check permissions
     if (!MembershipContext.AuthenticatedUser.IsAuthorizedPerResource("CMS.Polls", permissionType))
     {
         sender.StopProcessing = true;
     }
 }
 /// <summary>
 /// 'Check permission' event handler.
 /// </summary>
 private void attendeesList_OnCheckPermissions(string permissionType, CMSAdminControl sender)
 {
     // Check READ permission
     if (!MembershipContext.AuthenticatedUser.IsAuthorizedPerResource("CMS.EventManager", permissionType))
     {
         RedirectToAccessDenied("CMS.EventManager", permissionType);
     }
 }
 private void librarySecurity_OnCheckPermissions(string permissionType, CMSAdminControl sender)
 {
     MediaLibraryInfo mli = MediaLibraryInfoProvider.GetMediaLibraryInfo(libraryId);
     if (!MediaLibraryInfoProvider.IsUserAuthorizedPerLibrary(mli, "Read"))
     {
         RedirectToAccessDenied("cms.medialibrary", "Read");
     }
 }
 /// <summary>
 /// Check permission.
 /// </summary>
 /// <param name="permissionType">Permission type</param>
 /// <param name="sender">Sender</param>
 private void ucAbuseEdit_OnCheckPermissions(string permissionType, CMSAdminControl sender)
 {
     if (!MembershipContext.AuthenticatedUser.IsAuthorizedPerResource("CMS.AbuseReport", permissionType))
     {
         sender.StopProcessing = true;
         RedirectToAccessDenied("CMS.AbuseReport", permissionType);
     }
 }
Esempio n. 19
0
 protected void FriendsReject_OnCheckPermissions(string permissionType, CMSAdminControl sender)
 {
     // Check if reject is for current user or another user with permission to manage it
     if ((currentUser.UserID != userId) && !currentUser.IsAuthorizedPerResource("CMS.Friends", permissionType))
     {
         RedirectToAccessDenied("CMS.Friends", permissionType);
     }
 }
 /// <summary>
 /// OnCheckPermission event handler
 /// </summary>
 /// <param name="permissionType">Type of the permission.</param>
 /// <param name="sender">The sender.</param>
 private void sysInfo_OnCheckPermissions(string permissionType, CMSAdminControl sender)
 {
     if (!MembershipContext.AuthenticatedUser.CheckPrivilegeLevel(UserPrivilegeLevelEnum.GlobalAdmin))
     {
         sender.StopProcessing = true;
         sysInfo.Visible = false;
         messageElem.Visible = true;
         messageElem.ErrorMessage = GetString("general.nopermission");
     }
 }
    /// <summary>
    /// Check whether user is group administrator or has manage permission.
    /// </summary>
    /// <param name="groupId">Comunnity group ID</param>
    /// <param name="permissionName">Permission name</param>
    private void PostApprove_OnCheckPermissions(string permissionType, CMSAdminControl sender)
    {
        if (permissionType.EqualsCSafe("modify", true))
        {
            permissionType = "Manage";
        }

        // Check permissions
        CheckPermissions(groupId, permissionType);
    }
 /// <summary>
 /// OnCheckPermission event handler
 /// </summary>
 /// <param name="permissionType">Type of the permission.</param>
 /// <param name="sender">The sender.</param>
 private void sysInfo_OnCheckPermissions(string permissionType, CMSAdminControl sender)
 {
     if ((CMSContext.CurrentUser == null) || !CMSContext.CurrentUser.UserSiteManagerAdmin)
     {
         sender.StopProcessing = true;
         sysInfo.Visible = false;
         messageElem.Visible = true;
         messageElem.ErrorMessage = GetString("general.nopermission");
     }
 }
 /// <summary>
 /// Event handler to check permissions.
 /// </summary>
 protected void OptionCategoryEditElem_OnCheckPermissions(string permissionType, CMSAdminControl sender)
 {
     var categoryObject = EditedObject as BaseInfo;
     var global = (categoryObject != null) && categoryObject.IsGlobal;
     // Check module permissions
     if (!ECommerceContext.IsUserAuthorizedToModifyOptionCategory(global))
     {
         RedirectToAccessDenied("CMS.Ecommerce", global ? "EcommerceGlobalModify" : "EcommerceModify OR ModifyProducts");
     }
 }
Esempio n. 24
0
    /// <summary>
    /// Check whether user is group administrator or has manage permission.
    /// </summary>
    /// <param name="groupId">Comunnity group ID</param>
    /// <param name="permissionName">Permission name</param>
    void PostApprove_OnCheckPermissions(string permissionType, CMSAdminControl sender)
    {
        if (permissionType.Equals("modify", StringComparison.InvariantCultureIgnoreCase))
        {
            permissionType = "Manage";
        }

        // Check permissions
        CheckPermissions(groupId, permissionType);
    }
Esempio n. 25
0
 private void fileUpload_OnNotAllowed(string permissionType, CMSAdminControl sender)
 {
     if (sender != null)
     {
         sender.StopProcessing = true;
     }
     fileUpload.StopProcessing = true;
     fileUpload.Visible = false;
     messageElem.ErrorMessage = MediaLibraryHelper.GetAccessDeniedMessage("filecreate");
     messageElem.DisplayMessage = true;
 }
    private void boardSecurity_OnCheckPermissions(string permissionType, CMSAdminControl sender)
    {
        // Check 'Manage' permission
        int groupId = 0;
        BoardInfo bi = BoardInfoProvider.GetBoardInfo(boardId);
        if (bi != null)
        {
            groupId = bi.BoardGroupID;
        }

        CheckPermissions(groupId, CMSAdminControl.PERMISSION_MANAGE);
    }
    void editElem_OnCheckPermissions(string permissionType, CMSAdminControl sender)
    {
        // Keep current user info
        CurrentUserInfo currentUser = CMSContext.CurrentUser;

        // Check whether user has manage permission or is project owner to edit project
        if (!currentUser.IsAuthorizedPerResource("CMS.ProjectManagement", "Manage") && (editElem.ProjectObj != null) && (editElem.ProjectObj.ProjectOwner != currentUser.UserID))
        {
            sender.StopProcessing = true;
            RedirectToAccessDenied("CMS.ProjectManagement", "Manage");
        }
    }
    private void forumNew_OnCheckPermissions(string permissionType, CMSAdminControl sender)
    {
        int lGroupId = 0;

        ForumGroupInfo fgi = ForumGroupInfoProvider.GetForumGroupInfo(forumNew.GroupID);
        if (fgi != null)
        {
            lGroupId = fgi.GroupGroupID;
        }

        CheckPermissions(lGroupId, CMSAdminControl.PERMISSION_MANAGE);
    }
 private void libraryElem_OnCheckPermissions(string permissionType, CMSAdminControl sender)
 {
     MediaLibraryInfo MediaLibrary = MediaLibraryInfoProvider.GetMediaLibraryInfo(libraryId);
     if (permissionType.ToLowerCSafe() == "read")
     {
         // Check 'Read' permission
         if (!MediaLibraryInfoProvider.IsUserAuthorizedPerLibrary(MediaLibrary, permissionType))
         {
             RedirectToAccessDenied("cms.medialibrary", "Read");
         }
     }
 }
Esempio n. 30
0
    void groupEdit_OnCheckPermissions(string permissionType, CMSAdminControl sender)
    {
        int groupId = 0;

        ForumGroupInfo fgi = ForumGroupInfoProvider.GetForumGroupInfo(groupEdit.GroupID);
        if (fgi != null)
        {
            groupId = fgi.GroupGroupID;
        }

        // Check permissions
        CheckPermissions(groupId, CMSAdminControl.PERMISSION_MANAGE);
    }
Esempio n. 31
0
 void roleListElem_OnCheckPermissions(string permissionType, CMSAdminControl sender)
 {
     if (permissionType == CMSAdminControl.PERMISSION_READ)
     {
         // Check permissions
         if (!CMSContext.CurrentUser.IsAuthorizedPerResource("CMS.Groups", CMSAdminControl.PERMISSION_READ))
         {
             RedirectToCMSDeskAccessDenied("CMS.Groups", CMSAdminControl.PERMISSION_READ);
         }
     }
     else
     {
         // Check permissions
         CheckPermissions(this.roleListElem.GroupID, CMSAdminControl.PERMISSION_MANAGE);
     }
 }
Esempio n. 32
0
 private void roleListElem_OnCheckPermissions(string permissionType, CMSAdminControl sender)
 {
     if (permissionType == CMSAdminControl.PERMISSION_READ)
     {
         // Check permissions
         if (!MembershipContext.AuthenticatedUser.IsAuthorizedPerResource("CMS.Groups", CMSAdminControl.PERMISSION_READ))
         {
             RedirectToAccessDenied("CMS.Groups", CMSAdminControl.PERMISSION_READ);
         }
     }
     else
     {
         // Check permissions
         CheckPermissions(roleListElem.GroupID, CMSAdminControl.PERMISSION_MANAGE);
     }
 }
    private void PollSecurity_OnCheckPermissions(string permissionType, CMSAdminControl sender)
    {
        PollInfo pi      = PollInfoProvider.GetPollInfo(PollSecurity.ItemID);
        int      groupId = 0;

        if (pi != null)
        {
            groupId = pi.PollGroupID;
        }

        // Check permissions
        if (!MembershipContext.AuthenticatedUser.IsGroupAdministrator(groupId))
        {
            sender.StopProcessing = true;
        }
    }
    private void forumEdit_OnCheckPermissions(string permissionType, CMSAdminControl sender)
    {
        int       groupId = 0;
        ForumInfo fi      = ForumInfoProvider.GetForumInfo(forumEdit.ForumID);

        if (fi != null)
        {
            ForumGroupInfo fgi = ForumGroupInfoProvider.GetForumGroupInfo(fi.ForumGroupID);
            if (fgi != null)
            {
                groupId = fgi.GroupGroupID;
            }
        }
        // Check permissions
        CheckGroupPermissions(groupId, CMSAdminControl.PERMISSION_MANAGE);
    }
    void PollSecurity_OnCheckPermissions(string permissionType, CMSAdminControl sender)
    {
        PollInfo pi      = PollInfoProvider.GetPollInfo(PollSecurity.ItemID);
        int      groupId = 0;

        if (pi != null)
        {
            groupId = pi.PollGroupID;
        }

        // Check permissions
        if (!CMSContext.CurrentUser.IsGroupAdministrator(groupId) || !CMSContext.CurrentUser.IsAuthorizedPerResource("CMS.Groups", CMSAdminControl.PERMISSION_MANAGE))
        {
            sender.StopProcessing = true;
        }
    }
    private void subscriptionEdit_OnCheckPermissions(string permissionType, CMSAdminControl sender)
    {
        int groupId = 0;
        ForumInfo fi = ForumInfoProvider.GetForumInfo(QueryHelper.GetInteger("forumid", 0));
        if (fi != null)
        {
            ForumGroupInfo fgi = ForumGroupInfoProvider.GetForumGroupInfo(fi.ForumGroupID);
            if (fgi != null)
            {
                groupId = fgi.GroupGroupID;
            }
        }

        // Check permissions
        CheckPermissions(groupId, CMSAdminControl.PERMISSION_MANAGE);
    }
Esempio n. 37
0
    /// <summary>
    ///  Check whether user can create project.
    /// </summary>
    void ucProjectNew_OnCheckPermissions(string permissionType, CMSAdminControl sender)
    {
        if (!IsAuthorizedPerCreateProject())
        {
            // Set error message to the dialog
            ucProjectNew.SetError(GetString("pm.project.permission"));
            // Stop edit control processing
            sender.StopProcessing = true;

            // Set current project ID
            ucProjectNew.ProjectNodeID = pi.NodeId;
            // Set current Group ID
            ucProjectNew.CommunityGroupID = pi.NodeGroupId;
            // Show popup dialog if some error occured on project edit form
            ucPopupDialog.Show();
        }
    }
Esempio n. 38
0
    void forumModerators_OnCheckPermissions(string permissionType, CMSAdminControl sender)
    {
        int       groupId = 0;
        ForumInfo fi      = ForumInfoProvider.GetForumInfo(ValidationHelper.GetInteger(Request.QueryString["forumid"], 0));

        if (fi != null)
        {
            ForumGroupInfo fgi = ForumGroupInfoProvider.GetForumGroupInfo(fi.ForumGroupID);
            if (fgi != null)
            {
                groupId = fgi.GroupGroupID;
            }
        }

        // Check permissions
        CheckPermissions(groupId, CMSAdminControl.PERMISSION_MANAGE);
    }
    private void boardSubscriptions_OnCheckPermissions(string permissionType, CMSAdminControl sender)
    {
        int       groupId = 0;
        BoardInfo bi      = BoardInfoProvider.GetBoardInfo(boardId);

        if (bi != null)
        {
            groupId = bi.BoardGroupID;

            // Check whether edited board belongs to any group
            if (groupId == 0)
            {
                EditedObject = null;
            }
        }

        CheckGroupPermissions(groupId, CMSAdminControl.PERMISSION_MANAGE);
    }
    /// <summary>
    /// Check edit project permission for project change.
    /// </summary>
    private void ucProjectEdit_OnCheckPermissions(string permissionType, CMSAdminControl sender)
    {
        if (!IsAuthorizedPerProjectEdit())
        {
            // Set error message to the dialog
            ucTaskEdit.SetError(GetString("pm.project.permission"));
            // Stop edit control processing
            sender.StopProcessing = true;

            // Set current project ID
            ucTaskEdit.ProjectID = ProjectID;
            // Display dialog with HTML editor
            ucPopupDialogTask.Visible = true;
            // Show popup dialog for possibility of error on task edit form
            ucPopupDialogTask.Show();
            // Updade modal dialog update panel
            pnlUpdateModalTask.Update();
        }
    }
    protected void CheckGroupPermissions(string permissionType, CMSAdminControl sender)
    {
        int groupId = 0;

        if (postView.PostID == 0)
        {
            groupId = GetGroupIdFromForum(postView.ForumID);
        }
        else
        {
            var post = ForumPostInfoProvider.GetForumPostInfo(postView.PostID);
            if (post != null)
            {
                groupId = GetGroupIdFromForum(post.PostForumID);
            }
        }

        CheckGroupPermissions(groupId, CMSAdminControl.PERMISSION_MANAGE);
    }
    protected void postView_OnCheckPermissions(string permissionType, CMSAdminControl sender)
    {
        int           groupId = 0;
        ForumPostInfo fpi     = ForumPostInfoProvider.GetForumPostInfo(postView.PostID);

        if (fpi != null)
        {
            ForumInfo fi = ForumInfoProvider.GetForumInfo(fpi.PostForumID);
            if (fi != null)
            {
                ForumGroupInfo fgi = ForumGroupInfoProvider.GetForumGroupInfo(fi.ForumGroupID);
                if (fgi != null)
                {
                    groupId = fgi.GroupGroupID;
                }
            }
        }

        CheckPermissions(groupId, CMSAdminControl.PERMISSION_MANAGE);
    }
Esempio n. 43
0
 /// <summary>
 /// Check permissions.
 /// </summary>
 /// <param name="permissionType">Permission</param>
 /// <param name="sender">Sender</param>
 private void attendeesList_OnCheckPermissions(string permissionType, CMSAdminControl sender)
 {
     RaiseOnCheckPermissions(permissionType, sender);
 }
 protected void memberListElem_OnCheckPermissions(string permissionType, CMSAdminControl sender)
 {
     RaiseOnCheckPermissions(permissionType, sender);
 }
Esempio n. 45
0
    /// <summary>
    /// Initializes the control properties.
    /// </summary>
    protected void SetupControl()
    {
        if (StopProcessing)
        {
            // Do nothing
        }
        else
        {
            plcOther.Controls.Clear();

            if (AuthenticationHelper.IsAuthenticated())
            {
                // Set the layout of tab menu
                tabMenu.TabControlLayout = BasicTabControl.GetTabMenuLayout(TabControlLayout);

                // Remove 'saved' parameter from query string
                string absoluteUri = URLHelper.RemoveParameterFromUrl(RequestContext.CurrentURL, "saved");

                var currentUser = MembershipContext.AuthenticatedUser;

                // Get customer info
                GeneralizedInfo customer   = null;
                int             customerId = 0;

                var emptyCustomer = ModuleManager.GetReadOnlyObject(PredefinedObjectType.CUSTOMER);
                if (emptyCustomer != null)
                {
                    var q = emptyCustomer.Generalized.GetDataQuery(
                        true,
                        s => s
                        .WhereEquals("CustomerUserID", currentUser.UserID)
                        .OrderBy("CustomerCreated")
                        .TopN(1),
                        false
                        );

                    var result = q.Result;

                    if (!DataHelper.DataSourceIsEmpty(result))
                    {
                        customer   = ModuleManager.GetObject(result.Tables[0].Rows[0], PredefinedObjectType.CUSTOMER);
                        customerId = customer.ObjectID;
                    }
                }

                // Get friends enabled setting
                bool friendsEnabled = UIHelper.IsFriendsModuleEnabled(SiteContext.CurrentSiteName);

                // Selected page URL
                string selectedPage = string.Empty;

                // Menu initialization
                tabMenu.UrlTarget = "_self";
                ArrayList activeTabs = new ArrayList();

                // Handle 'Notifications' tab displaying
                bool showNotificationsTab    = (DisplayMyNotifications && LicenseHelper.IsFeatureAvailableInUI(FeatureEnum.Notifications, ModuleName.NOTIFICATIONS));
                bool isWindowsAuthentication = RequestHelper.IsWindowsAuthentication();

                string tabName;

                // Personal tab
                if (DisplayMyPersonalSettings)
                {
                    tabName = personalTab;
                    activeTabs.Add(tabName);
                    tabMenu.TabItems.Add(new TabItem()
                    {
                        Text        = GetString("MyAccount.MyPersonalSettings"),
                        RedirectUrl = URLHelper.AddParameterToUrl(absoluteUri, ParameterName, personalTab)
                    });

                    if (currentUser != null)
                    {
                        selectedPage = tabName;
                    }
                }

                // These items can be displayed only for customer
                if ((customer != null) && ModuleEntryManager.IsModuleLoaded(ModuleName.ECOMMERCE))
                {
                    if (DisplayMyDetails)
                    {
                        // Try to load the control dynamically (if available)
                        ucMyDetails = Page.LoadUserControl("~/CMSModules/Ecommerce/Controls/MyDetails/MyDetails.ascx") as CMSAdminControl;
                        if (ucMyDetails != null)
                        {
                            ucMyDetails.ID = "ucMyDetails";
                            plcOther.Controls.Add(ucMyDetails);

                            // Set new tab
                            tabName = detailsTab;
                            activeTabs.Add(tabName);
                            tabMenu.TabItems.Add(new TabItem()
                            {
                                Text        = GetString("MyAccount.MyDetails"),
                                RedirectUrl = URLHelper.AddParameterToUrl(absoluteUri, ParameterName, detailsTab)
                            });

                            if (selectedPage == string.Empty)
                            {
                                selectedPage = tabName;
                            }
                        }
                    }

                    if (DisplayMyAddresses)
                    {
                        // Try to load the control dynamically (if available)
                        ucMyAddresses = Page.LoadUserControl("~/CMSModules/Ecommerce/Controls/MyDetails/MyAddresses.ascx") as CMSAdminControl;
                        if (ucMyAddresses != null)
                        {
                            ucMyAddresses.ID = "ucMyAddresses";
                            plcOther.Controls.Add(ucMyAddresses);

                            // Set new tab
                            tabName = addressesTab;
                            activeTabs.Add(tabName);
                            tabMenu.TabItems.Add(new TabItem()
                            {
                                Text        = GetString("MyAccount.MyAddresses"),
                                RedirectUrl = URLHelper.AddParameterToUrl(absoluteUri, ParameterName, addressesTab)
                            });

                            if (selectedPage == string.Empty)
                            {
                                selectedPage = tabName;
                            }
                        }
                    }

                    if (DisplayMyOrders)
                    {
                        // Try to load the control dynamically (if available)
                        ucMyOrders = Page.LoadUserControl("~/CMSModules/Ecommerce/Controls/MyDetails/MyOrders.ascx") as CMSAdminControl;
                        if (ucMyOrders != null)
                        {
                            ucMyOrders.ID = "ucMyOrders";
                            plcOther.Controls.Add(ucMyOrders);

                            // Set new tab
                            tabName = ordersTab;
                            activeTabs.Add(tabName);
                            tabMenu.TabItems.Add(new TabItem()
                            {
                                Text        = GetString("MyAccount.MyOrders"),
                                RedirectUrl = URLHelper.AddParameterToUrl(absoluteUri, ParameterName, ordersTab)
                            });

                            if (selectedPage == string.Empty)
                            {
                                selectedPage = tabName;
                            }
                        }
                    }

                    if (DisplayMyCredits)
                    {
                        // Try to load the control dynamically (if available)
                        ucMyCredit = Page.LoadUserControl("~/CMSModules/Ecommerce/Controls/MyDetails/MyCredit.ascx") as CMSAdminControl;
                        if (ucMyCredit != null)
                        {
                            ucMyCredit.ID = "ucMyCredit";
                            plcOther.Controls.Add(ucMyCredit);

                            // Set new tab
                            tabName = creditTab;
                            activeTabs.Add(tabName);
                            tabMenu.TabItems.Add(new TabItem()
                            {
                                Text        = GetString("MyAccount.MyCredit"),
                                RedirectUrl = URLHelper.AddParameterToUrl(absoluteUri, ParameterName, creditTab)
                            });

                            if (selectedPage == string.Empty)
                            {
                                selectedPage = tabName;
                            }
                        }
                    }
                }

                if (DisplayChangePassword && !currentUser.IsExternal && !isWindowsAuthentication)
                {
                    // Set new tab
                    tabName = passwordTab;
                    activeTabs.Add(tabName);
                    tabMenu.TabItems.Add(new TabItem()
                    {
                        Text        = GetString("MyAccount.ChangePassword"),
                        RedirectUrl = URLHelper.AddParameterToUrl(absoluteUri, ParameterName, passwordTab)
                    });

                    if (selectedPage == string.Empty)
                    {
                        selectedPage = tabName;
                    }
                }

                if ((ucMyNotifications == null) && showNotificationsTab)
                {
                    // Try to load the control dynamically (if available)
                    ucMyNotifications = Page.LoadUserControl("~/CMSModules/Notifications/Controls/UserNotifications.ascx") as CMSAdminControl;
                    if (ucMyNotifications != null)
                    {
                        ucMyNotifications.ID = "ucMyNotifications";
                        plcOther.Controls.Add(ucMyNotifications);

                        // Set new tab
                        tabName = notificationsTab;
                        activeTabs.Add(tabName);
                        tabMenu.TabItems.Add(new TabItem()
                        {
                            Text        = GetString("MyAccount.MyNotifications"),
                            RedirectUrl = URLHelper.AddParameterToUrl(absoluteUri, ParameterName, notificationsTab)
                        });

                        if (selectedPage == string.Empty)
                        {
                            selectedPage = tabName;
                        }
                    }
                }

                if ((ucMyMessages == null) && DisplayMyMessages && ModuleManager.IsModuleLoaded(ModuleName.MESSAGING))
                {
                    // Try to load the control dynamically (if available)
                    ucMyMessages = Page.LoadUserControl("~/CMSModules/Messaging/Controls/MyMessages.ascx") as CMSAdminControl;
                    if (ucMyMessages != null)
                    {
                        ucMyMessages.ID = "ucMyMessages";
                        plcOther.Controls.Add(ucMyMessages);

                        // Set new tab
                        tabName = messagesTab;
                        activeTabs.Add(tabName);
                        tabMenu.TabItems.Add(new TabItem()
                        {
                            Text        = GetString("MyAccount.MyMessages"),
                            RedirectUrl = URLHelper.AddParameterToUrl(absoluteUri, ParameterName, messagesTab)
                        });

                        if (selectedPage == string.Empty)
                        {
                            selectedPage = tabName;
                        }
                    }
                }

                if ((ucMyFriends == null) && DisplayMyFriends && ModuleManager.IsModuleLoaded(ModuleName.COMMUNITY) && friendsEnabled)
                {
                    // Try to load the control dynamically (if available)
                    ucMyFriends = Page.LoadUserControl("~/CMSModules/Friends/Controls/MyFriends.ascx") as CMSAdminControl;
                    if (ucMyFriends != null)
                    {
                        ucMyFriends.ID = "ucMyFriends";
                        plcOther.Controls.Add(ucMyFriends);

                        // Set new tab
                        tabName = friendsTab;
                        activeTabs.Add(tabName);
                        tabMenu.TabItems.Add(new TabItem()
                        {
                            Text        = GetString("MyAccount.MyFriends"),
                            RedirectUrl = URLHelper.AddParameterToUrl(absoluteUri, ParameterName, friendsTab)
                        });

                        if (selectedPage == string.Empty)
                        {
                            selectedPage = tabName;
                        }
                    }
                }

                if ((ucMyAllSubscriptions == null) && DisplayMySubscriptions)
                {
                    // Try to load the control dynamically (if available)
                    ucMyAllSubscriptions = Page.LoadUserControl("~/CMSModules/Membership/Controls/Subscriptions.ascx") as CMSAdminControl;
                    if (ucMyAllSubscriptions != null)
                    {
                        // Set control
                        ucMyAllSubscriptions.Visible = false;

                        ucMyAllSubscriptions.SetValue("ShowBlogs", DisplayBlogs);
                        ucMyAllSubscriptions.SetValue("ShowMessageBoards", DisplayMessageBoards);
                        ucMyAllSubscriptions.SetValue("ShowNewsletters", DisplayNewsletters);
                        ucMyAllSubscriptions.SetValue("ShowForums", DisplayForums);
                        ucMyAllSubscriptions.SetValue("ShowReports", DisplayReports);
                        ucMyAllSubscriptions.SetValue("sendconfirmationemail", SendConfirmationEmails);

                        ucMyAllSubscriptions.ID = "ucMyAllSubscriptions";
                        plcOther.Controls.Add(ucMyAllSubscriptions);

                        // Set new tab
                        tabName = subscriptionsTab;
                        activeTabs.Add(tabName);
                        tabMenu.TabItems.Add(new TabItem()
                        {
                            Text        = GetString("MyAccount.MyAllSubscriptions"),
                            RedirectUrl = URLHelper.AddParameterToUrl(absoluteUri, ParameterName, subscriptionsTab)
                        });

                        if (selectedPage == string.Empty)
                        {
                            selectedPage = tabName;
                        }
                    }
                }

                // My memberships
                if ((ucMyMemberships == null) && DisplayMyMemberships)
                {
                    // Try to load the control dynamically
                    ucMyMemberships = Page.LoadUserControl("~/CMSModules/Membership/Controls/MyMemberships.ascx") as CMSAdminControl;

                    if (ucMyMemberships != null)
                    {
                        ucMyMemberships.SetValue("UserID", currentUser.UserID);

                        if (!String.IsNullOrEmpty(MembershipsPagePath))
                        {
                            ucMyMemberships.SetValue("BuyMembershipURL", DocumentURLProvider.GetUrl(MembershipsPagePath));
                        }

                        plcOther.Controls.Add(ucMyMemberships);

                        // Set new tab
                        tabName = membershipsTab;
                        activeTabs.Add(tabName);
                        tabMenu.TabItems.Add(new TabItem()
                        {
                            Text        = GetString("myaccount.mymemberships"),
                            RedirectUrl = URLHelper.AddParameterToUrl(absoluteUri, ParameterName, membershipsTab)
                        });

                        if (selectedPage == String.Empty)
                        {
                            selectedPage = tabName;
                        }
                    }
                }

                if ((ucMyCategories == null) && DisplayMyCategories)
                {
                    // Try to load the control dynamically (if available)
                    ucMyCategories = Page.LoadUserControl("~/CMSModules/Categories/Controls/Categories.ascx") as CMSAdminControl;
                    if (ucMyCategories != null)
                    {
                        ucMyCategories.Visible = false;

                        ucMyCategories.SetValue("DisplaySiteCategories", false);
                        ucMyCategories.SetValue("DisplaySiteSelector", false);

                        ucMyCategories.ID = "ucMyCategories";
                        plcOther.Controls.Add(ucMyCategories);

                        // Set new tab
                        tabName = categoriesTab;
                        activeTabs.Add(tabName);
                        tabMenu.TabItems.Add(new TabItem()
                        {
                            Text        = GetString("MyAccount.MyCategories"),
                            RedirectUrl = URLHelper.AddParameterToUrl(absoluteUri, ParameterName, categoriesTab)
                        });

                        if (selectedPage == string.Empty)
                        {
                            selectedPage = tabName;
                        }
                    }
                }

                // Set CSS class
                pnlBody.CssClass = CssClass;

                // Get page URL
                page = QueryHelper.GetString(ParameterName, selectedPage);

                // Set controls visibility
                ucChangePassword.Visible        = false;
                ucChangePassword.StopProcessing = true;

                if (ucMyAddresses != null)
                {
                    ucMyAddresses.Visible        = false;
                    ucMyAddresses.StopProcessing = true;
                }

                if (ucMyOrders != null)
                {
                    ucMyOrders.Visible        = false;
                    ucMyOrders.StopProcessing = true;
                }

                if (ucMyDetails != null)
                {
                    ucMyDetails.Visible        = false;
                    ucMyDetails.StopProcessing = true;
                }

                if (ucMyCredit != null)
                {
                    ucMyCredit.Visible        = false;
                    ucMyCredit.StopProcessing = true;
                }

                if (ucMyAllSubscriptions != null)
                {
                    ucMyAllSubscriptions.Visible        = false;
                    ucMyAllSubscriptions.StopProcessing = true;
                    ucMyAllSubscriptions.SetValue("CacheMinutes", CacheMinutes);
                }

                if (ucMyNotifications != null)
                {
                    ucMyNotifications.Visible        = false;
                    ucMyNotifications.StopProcessing = true;
                }

                if (ucMyMessages != null)
                {
                    ucMyMessages.Visible        = false;
                    ucMyMessages.StopProcessing = true;
                }

                if (ucMyFriends != null)
                {
                    ucMyFriends.Visible        = false;
                    ucMyFriends.StopProcessing = true;
                }

                if (ucMyMemberships != null)
                {
                    ucMyMemberships.Visible        = false;
                    ucMyMemberships.StopProcessing = true;
                }

                if (ucMyCategories != null)
                {
                    ucMyCategories.Visible        = false;
                    ucMyCategories.StopProcessing = true;
                }

                tabMenu.SelectedTab = activeTabs.IndexOf(page);

                // Select current page
                switch (page)
                {
                case personalTab:
                    if (myProfile != null)
                    {
                        // Get alternative form info
                        AlternativeFormInfo afi = AlternativeFormInfoProvider.GetAlternativeFormInfo(AlternativeFormName);
                        if (afi != null)
                        {
                            myProfile.StopProcessing      = false;
                            myProfile.Visible             = true;
                            myProfile.AllowEditVisibility = AllowEditVisibility;
                            myProfile.AlternativeFormName = AlternativeFormName;
                        }
                        else
                        {
                            lblError.Text     = String.Format(GetString("altform.formdoesntexists"), AlternativeFormName);
                            lblError.Visible  = true;
                            myProfile.Visible = false;
                        }
                    }
                    break;

                // My details tab
                case detailsTab:
                    if (ucMyDetails != null)
                    {
                        ucMyDetails.Visible        = true;
                        ucMyDetails.StopProcessing = false;
                        ucMyDetails.SetValue("Customer", customer);
                    }
                    break;

                // My addresses tab
                case addressesTab:
                    if (ucMyAddresses != null)
                    {
                        ucMyAddresses.Visible        = true;
                        ucMyAddresses.StopProcessing = false;
                        ucMyAddresses.SetValue("CustomerId", customerId);
                    }
                    break;

                // My orders tab
                case ordersTab:
                    if (ucMyOrders != null)
                    {
                        ucMyOrders.Visible        = true;
                        ucMyOrders.StopProcessing = false;
                        ucMyOrders.SetValue("CustomerId", customerId);
                        ucMyOrders.SetValue("ShowOrderTrackingNumber", ShowOrderTrackingNumber);
                        ucMyOrders.SetValue("ShowOrderToShoppingCart", ShowOrderToShoppingCart);
                    }
                    break;

                // My credit tab
                case creditTab:
                    if (ucMyCredit != null)
                    {
                        ucMyCredit.Visible        = true;
                        ucMyCredit.StopProcessing = false;
                        ucMyCredit.SetValue("CustomerId", customerId);
                    }
                    break;

                // Password tab
                case passwordTab:
                    ucChangePassword.Visible            = true;
                    ucChangePassword.StopProcessing     = false;
                    ucChangePassword.AllowEmptyPassword = AllowEmptyPassword;
                    break;

                // Notification tab
                case notificationsTab:
                    if (ucMyNotifications != null)
                    {
                        ucMyNotifications.Visible        = true;
                        ucMyNotifications.StopProcessing = false;
                        ucMyNotifications.SetValue("UserId", currentUser.UserID);
                        ucMyNotifications.SetValue("UnigridImageDirectory", UnigridImageDirectory);
                    }
                    break;

                // My messages tab
                case messagesTab:
                    if (ucMyMessages != null)
                    {
                        ucMyMessages.Visible        = true;
                        ucMyMessages.StopProcessing = false;
                    }
                    break;

                // My friends tab
                case friendsTab:
                    if (ucMyFriends != null)
                    {
                        ucMyFriends.Visible        = true;
                        ucMyFriends.StopProcessing = false;
                        ucMyFriends.SetValue("UserID", currentUser.UserID);
                    }
                    break;

                // My subscriptions tab
                case subscriptionsTab:
                    if (ucMyAllSubscriptions != null)
                    {
                        ucMyAllSubscriptions.Visible        = true;
                        ucMyAllSubscriptions.StopProcessing = false;

                        ucMyAllSubscriptions.SetValue("userid", currentUser.UserID);
                        ucMyAllSubscriptions.SetValue("siteid", SiteContext.CurrentSiteID);
                    }
                    break;

                // My memberships tab
                case membershipsTab:
                    if (ucMyMemberships != null)
                    {
                        ucMyMemberships.Visible        = true;
                        ucMyMemberships.StopProcessing = false;
                    }
                    break;

                // My categories tab
                case categoriesTab:
                    if (ucMyCategories != null)
                    {
                        ucMyCategories.Visible        = true;
                        ucMyCategories.StopProcessing = false;
                    }
                    break;
                }
            }
            else
            {
                // Hide control if current user is not authenticated
                Visible = false;
            }
        }
    }
Esempio n. 46
0
    /// <summary>
    /// Check permissions event handler.
    /// </summary>
    void ucTasks_OnCheckPermissionsExtended(string permissionType, string modulePermissionType, CMSAdminControl sender)
    {
        // No permissions by default
        sender.StopProcessing = true;
        // Current item ID
        int taskId = 0;

        // Check permission for delete task
        if (permissionType == ProjectManagementPermissionType.DELETE)
        {
            // Get list object
            CMSAdminListControl listControl = sender as CMSAdminListControl;
            // Check whether list object is defined
            if (listControl != null)
            {
                taskId = listControl.SelectedItemID;
            }
        }
        // Check permision for task modify
        else if (permissionType == ProjectManagementPermissionType.MODIFY)
        {
            // Get edit object
            CMSAdminEditControl editControl = sender as CMSAdminEditControl;
            // Check whether edit control is defined
            if (editControl != null)
            {
                taskId = editControl.ItemID;
            }
        }

        // Check permissions only for existing tasks
        if (taskId > 0)
        {
            // If user has no permission for current action, display error message
            if (ProjectTaskInfoProvider.IsAuthorizedPerTask(taskId, permissionType, CMSContext.CurrentUser, CMSContext.CurrentSiteID))
            {
                sender.StopProcessing = false;
            }
            else
            {
                messageElem.Visible      = true;
                messageElem.ErrorMessage = ResHelper.GetString("pm.project.permission");
            }
        }
    }
 protected void CheckPermissions(string permissionType, CMSAdminControl sender)
 {
     // Do not check permissions since user can always manage her friends
 }
Esempio n. 48
0
 private void RoleUsers_OnCheckPermissions(string permissionType, CMSAdminControl sender)
 {
     RaiseOnCheckPermissions(permissionType, sender);
 }
Esempio n. 49
0
 private void moderatorEdit_OnCheckPermissions(string permissionType, CMSAdminControl sender)
 {
     RaiseOnCheckPermissions(permissionType, sender);
 }
Esempio n. 50
0
 private void forumEditElem_OnCheckPermissions(string permissionType, CMSAdminControl sender)
 {
     RaiseOnCheckPermissions(permissionType, sender);
 }
 /// <summary>
 /// Checks delete and modify permissions (delete and up/down actions)
 /// </summary>
 /// <param name="permissionType">Permission type</param>
 /// <param name="modulePermissionType">Module permission type</param>
 /// <param name="sender">Sender object</param>
 private void ucTaskList_OnCheckPermissionsExtended(string permissionType, string modulePermissionType, CMSAdminControl sender)
 {
     // Check whether user is allowed to modify or delete task
     if (!ProjectInfoProvider.IsAuthorizedPerProject(ProjectID, permissionType, MembershipContext.AuthenticatedUser) && !IsAuthorizedPerProjectAccess())
     {
         lblError.Visible      = true;
         lblError.Text         = GetString("pm.project.permission");
         sender.StopProcessing = true;
     }
 }
    /// <summary>
    /// Checks modify permission on task edit.
    /// </summary>
    /// <param name="permissionType">Permission type</param>
    /// <param name="modulePermissionType">Module permission type</param>
    /// <param name="sender">Sender object</param>
    private void ucTaskEdit_OnCheckPermissionsExtended(string permissionType, string modulePermissionType, CMSAdminControl sender)
    {
        // Indicates whether user is owner or assignee
        bool isInvolved = false;

        // Check whether taks is in edit mode
        if (ucTaskEdit.ItemID > 0)
        {
            // Get task info
            ProjectTaskInfo pti = ProjectTaskInfoProvider.GetProjectTaskInfo(ucTaskEdit.ItemID);
            // Check whether task exists
            if (pti != null)
            {
                // Keep current user
                var cui = MembershipContext.AuthenticatedUser;
                // If user is assignee or owenr set flag
                if ((pti.ProjectTaskAssignedToUserID == cui.UserID) || (pti.ProjectTaskOwnerID == cui.UserID))
                {
                    isInvolved = true;
                }
            }
        }


        // Check whether user is allowed to modify task
        if (!isInvolved && !ProjectInfoProvider.IsAuthorizedPerProject(ProjectID, permissionType, MembershipContext.AuthenticatedUser) && !IsAuthorizedPerProjectAccess())
        {
            // Set error message to the dialog
            ucTaskEdit.SetError(GetString("pm.project.permission"));
            // Stop edit control processing
            sender.StopProcessing = true;
            // Display dialog with HTML editor
            ucPopupDialogTask.Visible = true;
            // Set current project ID
            ucTaskEdit.ProjectID = ProjectID;
            // Show popup dialog for possibility of error on task edit form
            ucPopupDialogTask.Show();
            // Updade modal dialog update panel
            pnlUpdateModalTask.Update();
        }
    }
Esempio n. 53
0
 private void PollProperties_OnCheckPermissions(string permissionType, CMSAdminControl sender)
 {
     // Check permissions
     CheckPermissions(PollProperties.GroupID, CMSAdminControl.PERMISSION_MANAGE);
 }
Esempio n. 54
0
 private void fileUploader_OnNotAllowed(string permissionType, CMSAdminControl sender)
 {
     RaiseOnNotAllowed(permissionType);
 }
Esempio n. 55
0
 // Security handlers
 private void securityElem_OnCheckPermissions(string permissionType, CMSAdminControl sender)
 {
     RaiseOnCheckPermissions(permissionType, sender);
 }
 private void boardModerators_OnCheckPermissions(string permissionType, CMSAdminControl sender)
 {
     CheckGroupPermissions(groupId, CMSAdminControl.PERMISSION_MANAGE);
 }
Esempio n. 57
0
 private void subscriptionElem_OnCheckPermissions(string permissionType, CMSAdminControl sender)
 {
     RaiseOnCheckPermissions(permissionType, sender);
 }
Esempio n. 58
0
 /// <summary>
 /// Check permissions handler.
 /// </summary>
 /// <param name="permissionType">Type of a permission to check</param>
 /// <param name="sender">Sender</param>
 protected void listElem_OnCheckPermissions(string permissionType, CMSAdminControl sender)
 {
     // Check permissions
     CheckPermissions(groupId, permissionType);
 }
Esempio n. 59
0
 private void pollsList_OnCheckPermissions(string permissionType, CMSAdminControl sender)
 {
     // Check permissions
     CheckPermissions(groupID, CMSAdminControl.PERMISSION_MANAGE);
 }
Esempio n. 60
0
 private void PollNew_OnCheckPermissions(string permissionType, CMSAdminControl sender)
 {
     RaiseOnCheckPermissions(permissionType, sender);
 }