static void InviteMemberButton_clicked(object obj)
        {
            WorkspaceInfo wkInfo = (WorkspaceInfo)obj;
            CurrentUserAdminCheckResponse response = null;

            IThreadWaiter waiter = ThreadWaiter.GetWaiter(50);

            waiter.Execute(
                /*threadOperationDelegate*/
                delegate
            {
                RepositorySpec repSpec = PlasticGui.Plastic.API.GetRepositorySpec(wkInfo);

                ServerProfile serverProfile =
                    CmConnection.Get().GetProfileManager().GetProfileForServer(repSpec.Server) ??
                    ClientConfig.Get().GetDefaultProfile();

                string authToken = CmConnection.Get()
                                   .BuildWebApiTokenForCloudEditionForProfileAndOrg(
                    serverProfile);

                response = WebRestApiClient.PlasticScm.IsUserAdmin(
                    ServerOrganizationParser.GetOrganizationFromServer(repSpec.Server),
                    authToken);
            },
                /*afterOperationDelegate*/
                delegate
            {
                if (waiter.Exception != null)
                {
                    ExceptionsHandler.LogException(
                        "IsUserAdmin",
                        waiter.Exception);
                    return;
                }

                if (response.Error != null)
                {
                    Debug.LogErrorFormat(
                        "Error checking if the user is the organization admin: {0}",
                        string.Format("Unable to get IsUserAdminResponse: {0} [code {1}]",
                                      response.Error.Message,
                                      response.Error.ErrorCode));

                    return;
                }

                if (response.IsCurrentUserAdmin)
                {
                    Application.OpenURL("https://www.plasticscm.com/dashboard/cloud/" +
                                        response.OrganizationName +
                                        "/users-and-groups");
                    return;
                }

                GuiMessage.ShowInformation(
                    PlasticLocalization.GetString(PlasticLocalization.Name.InviteMembersTitle),
                    PlasticLocalization.GetString(PlasticLocalization.Name.InviteMembersMessage));
            });
        }
        static void InviteMemberButton_clicked(object obj)
        {
            RepositorySpec repSpec = (RepositorySpec)obj;

            string organizationName = ServerOrganizationParser.
                                      GetOrganizationFromServer(repSpec.Server);

            CurrentUserAdminCheckResponse response = null;

            IThreadWaiter waiter = ThreadWaiter.GetWaiter(50);

            waiter.Execute(
                /*threadOperationDelegate*/
                delegate
            {
                ServerProfile serverProfile = CmConnection.Get().
                                              GetProfileManager().GetProfileForServer(repSpec.Server);

                string authToken = serverProfile != null ?
                                   CmConnection.Get().
                                   BuildWebApiTokenForCloudEditionForUser(
                    serverProfile.Server,
                    serverProfile.GetSEIDWorkingMode(),
                    serverProfile.SecurityConfig):
                                   CmConnection.Get().
                                   BuildWebApiTokenForCloudEditionForUser(
                    repSpec.Server,
                    ClientConfig.Get().GetSEIDWorkingMode(),
                    ClientConfig.Get().GetSecurityConfig());

                if (string.IsNullOrEmpty(authToken))
                {
                    authToken = CmConnection.Get().
                                BuildWebApiTokenForCloudEditionDefaultUser();
                }

                if (string.IsNullOrEmpty(authToken))
                {
                    return;
                }

                response = WebRestApiClient.PlasticScm.IsUserAdmin(
                    organizationName,
                    authToken);
            },
                /*afterOperationDelegate*/
                delegate
            {
                if (waiter.Exception != null)
                {
                    ExceptionsHandler.LogException(
                        "IsUserAdmin",
                        waiter.Exception);

                    OpenCloudDashboardUsersGroupsUrl(organizationName);
                    return;
                }

                if (response == null)
                {
                    mLog.DebugFormat(
                        "Error checking if the user is the organization admin for {0}",
                        organizationName);

                    OpenCloudDashboardUsersGroupsUrl(organizationName);
                    return;
                }

                if (response.Error != null)
                {
                    mLog.DebugFormat(
                        "Error checking if the user is the organization admin: {0}",
                        string.Format("Unable to get IsUserAdminResponse: {0} [code {1}]",
                                      response.Error.Message,
                                      response.Error.ErrorCode));

                    OpenCloudDashboardUsersGroupsUrl(organizationName);
                    return;
                }

                if (response.IsCurrentUserAdmin)
                {
                    OpenCloudDashboardUsersGroupsUrl(response.OrganizationName);
                    return;
                }

                GuiMessage.ShowInformation(
                    PlasticLocalization.GetString(PlasticLocalization.Name.InviteMembersTitle),
                    PlasticLocalization.GetString(PlasticLocalization.Name.InviteMembersMessage));
            });
        }