/// <summary>
    /// Initializes the control properties.
    /// </summary>
    protected void SetupControl()
    {
        if (StopProcessing)
        {
            // Do nothing
        }
        else
        {
            SetContext();

            GroupInfo group = CommunityContext.CurrentGroup;
            if (group != null)
            {
                string path = (GroupsSecurityAccessPath == "") ? GroupInfoProvider.GetGroupSecurityAccessPath(group.GroupName, CMSContext.CurrentSiteName) : GroupsSecurityAccessPath;
                string url  = URLHelper.ResolveUrl(TreePathUtils.GetUrl(CMSContext.ResolveCurrentPath(path)));
                if (UseQueryString)
                {
                    url = URLHelper.UpdateParameterInUrl(url, "groupid", group.GroupID.ToString());
                }

                // Check whether group is approved
                if (!group.GroupApproved)
                {
                    URLHelper.Redirect(url);
                }
                else
                {
                    // Check permissions for current user
                    switch (group.GroupAccess)
                    {
                    // Anybody can view the content
                    default:
                    case SecurityAccessEnum.AllUsers:
                        break;

                    // Site members can view the content
                    case SecurityAccessEnum.AuthenticatedUsers:
                        if (!CMSContext.CurrentUser.IsAuthenticated())
                        {
                            URLHelper.Redirect(url);
                        }
                        break;

                    // Only group members can view the content
                    case SecurityAccessEnum.GroupMembers:
                        if (!CMSContext.CurrentUser.IsGroupMember(group.GroupID))
                        {
                            URLHelper.Redirect(url);
                        }
                        break;
                    }
                }
            }
            else
            {
                Visible = false;
            }

            ReleaseContext();
        }
    }