/// <summary>
        /// Is the currently authenticated NetServer user authorized to use web and from the correct tenant
        /// </summary>
        /// <returns></returns>
        private static bool IsAutorizedWithNetServer()
        {
            var principal = SoContext.CurrentPrincipal;

            if (Context == null)
            {
                return(false);
            }

            if (!IsAuthenticatedWithNetServer(principal))
            {
                return(false);
            }

            if (principal.UserType != UserType.InternalAssociate)
            {
                return(false);
            }

            if (!principal.HasLicense(SoLicenseNames.Web))
            {
                return(false);
            }

            if (!String.Equals(SoDatabaseContext.GetCurrent().ContextIdentifier, Context.ContextIdentifier, StringComparison.InvariantCultureIgnoreCase))
            {
                return(false);
            }

            //All checks were successful.
            return(true);
        }
 public void CreateAndSaveWebPanel(string name, string webPanelName, string url, Navigation navigation)
 {
     try
     {
         var panel = CreateWebPanel(webPanelName, url + "&ctx=" + SoDatabaseContext.GetCurrent().ContextIdentifier, navigation);
     }
     catch (WebPanelNameNotUniqueException ex)
     {
         // If the panel already exists, I guess that is OK
     }
 }
        /// <summary>
        /// Is the currently authenticated NetServer user authorized to use web and from the correct tenant
        /// </summary>
        /// <returns></returns>
        private static bool IsAutorizedWithNetServer()
        {
            var principal = SoContext.CurrentPrincipal;
            var context   = Context;

            return(context != null &&
                   IsAuthenticatedWithNetServer(principal) &&
                   principal.UserType == UserType.InternalAssociate &&
                   principal.HasLicense(SoLicenseNames.Web) &&
                   String.Equals(SoDatabaseContext.GetCurrent().ContextIdentifier, context.ContextIdentifier, StringComparison.InvariantCultureIgnoreCase));
        }