示例#1
0
        /// <summary>
        /// Enables tickets
        /// </summary>
        /// <returns>True if successful, otherwise false</returns>
        public static bool EnableTickets()
        {
            try
            {
                ISSOAdmin admin = new ISSOAdmin();

                int    flags                = 0;
                int    appDeleteMax         = -1;
                int    mappingDeleteMax     = -1;
                int    ntpLookupMax         = -1;
                int    xplLookupMax         = -1;
                int    ticketTimeout        = -1;
                int    cacheTimeout         = -1;
                string secretServer         = null;
                string ssoAdminGroup        = null;
                string affiliateAppMgrGroup = null;

                // Get current default settings
                admin.GetGlobalInfo(out flags, out appDeleteMax, out mappingDeleteMax, out ntpLookupMax,
                                    out xplLookupMax, out ticketTimeout, out cacheTimeout, out secretServer,
                                    out ssoAdminGroup, out affiliateAppMgrGroup);

                // Update global settings
                admin.UpdateGlobalInfo(SSOFlag.SSO_FLAG_ALLOW_TICKETS | SSOFlag.SSO_FLAG_VALIDATE_TICKETS,
                                       SSOFlag.SSO_FLAG_ALLOW_TICKETS | SSOFlag.SSO_FLAG_VALIDATE_TICKETS,
                                       ref appDeleteMax, ref mappingDeleteMax, ref ntpLookupMax,
                                       ref xplLookupMax, ref ticketTimeout, ref cacheTimeout, null, null, null);
            }
            catch
            {
                return(false);
            }

            return(true);
        }
        /// <summary>
        /// Check to see if the current user has SSO Administrator permissions.
        /// </summary>
        /// <returns>
        /// True if the current user has SSO Administrator permissions, or
        /// false otherwise.
        /// </returns>
        private static void CheckSSOPermissions()
        {
            // Try and get the global info from SSO
            try
            {
                int       flags;
                int       auditAppDeleteMax;
                int       auditMappingDeleteMax;
                int       auditNtpLookupMax;
                int       auditXpLookupMax;
                int       ticketTimeout;
                int       credCacheTimeout;
                string    secretServer;
                string    SSOAdminGroup;
                string    affiliateAppMgrGroup;
                ISSOAdmin admin = new ISSOAdmin();
                // Microsoft.BizTalk.SSOClient.Interop.ISSOAdmin admin = new Microsoft.BizTalk.SSOClient.Interop.ISSOAdmin();
                admin.GetGlobalInfo(
                    out flags,
                    out auditAppDeleteMax,
                    out auditMappingDeleteMax,
                    out auditNtpLookupMax,
                    out auditXpLookupMax,
                    out ticketTimeout,
                    out credCacheTimeout,
                    out secretServer,
                    out SSOAdminGroup,
                    out affiliateAppMgrGroup);
            }
            catch (UnauthorizedAccessException ex)
            {
                TraceManager.SmartTrace.TraceError(ex);

                // Failed so we don't have the correct permissions
                throw new ApplicationException(string.Format(
                                                   @"The current user '\\{0}\{1}' failed to connect to the BizTalk management database.",
                                                   Environment.UserDomainName,
                                                   Environment.UserName));
            }
        }