DROP USER [ERS]
GO

DROP USER [Feedback@Effectory.com]
GO

DROP USER [IntranetApps]
GO

DROP USER [InviteReplication]
GO

DROP USER [InviteTOuser]
GO

DROP USER [LiveWebClient@Effectory.com]
GO

DROP USER [mscrm_sync]
GO

DROP USER [myprojectwebservice@effectory.com]
GO

DROP USER [participant_import]
GO

DROP USER [participant_validation]
GO

DROP USER [QuestionbaseWebservice]
GO

DROP USER [scratchcardgenerator]
GO

DROP USER [SurveyCenter]
GO

DROP USER [SurveyWebJob]
GO






------
------ SCRIPTED OLD
----------






-- [-- DB CONTEXT --] --
USE [Invite]
 
-- [-- DB USERS --] --
 
IF NOT EXISTS (SELECT [name] FROM sys.database_principals WHERE [name] =  'BuildServer') BEGIN CREATE USER  [BuildServer] FOR LOGIN [BuildServer] WITH DEFAULT_SCHEMA = [dbo] END; 
IF NOT EXISTS (SELECT [name] FROM sys.database_principals WHERE [name] =  'ClearConfirmedTeamsWebJob') BEGIN CREATE USER  [ClearConfirmedTeamsWebJob] FOR LOGIN [ClearConfirmedTeamsWebJob] WITH DEFAULT_SCHEMA = [dbo] END; 
IF NOT EXISTS (SELECT [name] FROM sys.database_principals WHERE [name] =  'dbo') BEGIN CREATE USER  [dbo] FOR LOGIN [dbo] WITH DEFAULT_SCHEMA = [dbo] END; 
IF NOT EXISTS (SELECT [name] FROM sys.database_principals WHERE [name] =  'Effectory-Core-MeasurementService') BEGIN CREATE USER  [Effectory-Core-MeasurementService] WITHOUT LOGIN WITH DEFAULT_SCHEMA = [dbo] , SID = [foo]  END; 
IF NOT EXISTS (SELECT [name] FROM sys.database_principals WHERE [name] =  'ERS') BEGIN CREATE USER  [ERS] FOR LOGIN [ERS] WITH DEFAULT_SCHEMA = [dbo] END; 
IF NOT EXISTS (SELECT [name] FROM sys.database_principals WHERE [name] =  'GatherResponseWebJob') BEGIN CREATE USER  [GatherResponseWebJob] FOR LOGIN [GatherResponseWebJob] WITH DEFAULT_SCHEMA = [dbo] END; 
IF NOT EXISTS (SELECT [name] FROM sys.database_principals WHERE [name] =  'GenerateFlexQuestionnaireWebjob') BEGIN CREATE USER  [GenerateFlexQuestionnaireWebjob] FOR LOGIN [GenerateFlexQuestionnaireWebjob] WITH DEFAULT_SCHEMA = [dbo] END; 
IF NOT EXISTS (SELECT [name] FROM sys.database_principals WHERE [name] =  'guest') BEGIN CREATE USER  [guest] WITHOUT LOGIN WITH DEFAULT_SCHEMA = [guest] , SID = [foo]  END; 
IF NOT EXISTS (SELECT [name] FROM sys.database_principals WHERE [name] =  'HierarchyUserImport') BEGIN CREATE USER  [HierarchyUserImport] FOR LOGIN [HierarchyUserImport] WITH DEFAULT_SCHEMA = [dbo] END; 
IF NOT EXISTS (SELECT [name] FROM sys.database_principals WHERE [name] =  'IntranetApps') BEGIN CREATE USER  [IntranetApps] FOR LOGIN [IntranetApps] WITH DEFAULT_SCHEMA = [dbo] END; 
IF NOT EXISTS (SELECT [name] FROM sys.database_principals WHERE [name] =  'InviteExport') BEGIN CREATE USER  [InviteExport] FOR LOGIN [InviteExport] WITH DEFAULT_SCHEMA = [dbo] END; 
IF NOT EXISTS (SELECT [name] FROM sys.database_principals WHERE [name] =  'InviteImport') BEGIN CREATE USER  [InviteImport] FOR LOGIN [InviteImport] WITH DEFAULT_SCHEMA = [dbo] END; 
IF NOT EXISTS (SELECT [name] FROM sys.database_principals WHERE [name] =  'InviteReplication') BEGIN CREATE USER  [InviteReplication] FOR LOGIN [InviteReplication] WITH DEFAULT_SCHEMA = [dbo] END; 
IF NOT EXISTS (SELECT [name] FROM sys.database_principals WHERE [name] =  'InviteResponseWebJob') BEGIN CREATE USER  [InviteResponseWebJob] FOR LOGIN [InviteResponseWebJob] WITH DEFAULT_SCHEMA = [dbo] END; 
IF NOT EXISTS (SELECT [name] FROM sys.database_principals WHERE [name] =  'InviteTOuser') BEGIN CREATE USER  [InviteTOuser] FOR LOGIN [InviteTOuser] WITH DEFAULT_SCHEMA = [dbo] END; 
IF NOT EXISTS (SELECT [name] FROM sys.database_principals WHERE [name] =  'MailingManager') BEGIN CREATE USER  [MailingManager] FOR LOGIN [MailingManager] WITH DEFAULT_SCHEMA = [dbo] END; 
IF NOT EXISTS (SELECT [name] FROM sys.database_principals WHERE [name] =  'mailings_webapi') BEGIN CREATE USER  [mailings_webapi] FOR LOGIN [mailings_webapi] WITH DEFAULT_SCHEMA = [dbo] END; 
IF NOT EXISTS (SELECT [name] FROM sys.database_principals WHERE [name] =  'mscrm_sync') BEGIN CREATE USER  [mscrm_sync] FOR LOGIN [mscrm_sync] WITH DEFAULT_SCHEMA = [dbo] END; 
IF NOT EXISTS (SELECT [name] FROM sys.database_principals WHERE [name] =  'participant_import') BEGIN CREATE USER  [participant_import] WITHOUT LOGIN WITH DEFAULT_SCHEMA = [dbo] , SID = [foo]  END; 
IF NOT EXISTS (SELECT [name] FROM sys.database_principals WHERE [name] =  'participant_validation') BEGIN CREATE USER  [participant_validation] WITHOUT LOGIN WITH DEFAULT_SCHEMA = [dbo] , SID = [foo]  END; 
IF NOT EXISTS (SELECT [name] FROM sys.database_principals WHERE [name] =  'projectcenter') BEGIN CREATE USER  [projectcenter] FOR LOGIN [projectcenter] WITH DEFAULT_SCHEMA = [dbo] END; 
IF NOT EXISTS (SELECT [name] FROM sys.database_principals WHERE [name] =  'QuestionbaseWebservice') BEGIN CREATE USER  [QuestionbaseWebservice] FOR LOGIN [QuestionbaseWebservice] WITH DEFAULT_SCHEMA = [dbo] END; 
IF NOT EXISTS (SELECT [name] FROM sys.database_principals WHERE [name] =  'QuestionnaireWebApi') BEGIN CREATE USER  [QuestionnaireWebApi] WITHOUT LOGIN WITH DEFAULT_SCHEMA = [dbo] , SID = [foo]  END; 
IF NOT EXISTS (SELECT [name] FROM sys.database_principals WHERE [name] =  'SurveyCenter') BEGIN CREATE USER  [SurveyCenter] FOR LOGIN [SurveyCenter] WITH DEFAULT_SCHEMA = [dbo] END; 
IF NOT EXISTS (SELECT [name] FROM sys.database_principals WHERE [name] =  'SurveyWebJob') BEGIN CREATE USER  [SurveyWebJob] FOR LOGIN [SurveyWebJob] WITH DEFAULT_SCHEMA = [dbo] END; 
IF NOT EXISTS (SELECT [name] FROM sys.database_principals WHERE [name] =  'SyncDemographicsWebJob') BEGIN CREATE USER  [SyncDemographicsWebJob] FOR LOGIN [SyncDemographicsWebJob] WITH DEFAULT_SCHEMA = [dbo] END; 
-- [-- ORPHANED USERS --] --
-- [-- DB ROLES --] --
EXEC sp_addrolemember @rolename = 'db_datareader', @membername = 'ClearConfirmedTeamsWebJob'
EXEC sp_addrolemember @rolename = 'db_datareader', @membername = 'Effectory-Core-MeasurementService'
EXEC sp_addrolemember @rolename = 'db_datareader', @membername = 'ERS'
EXEC sp_addrolemember @rolename = 'db_datareader', @membername = 'GenerateFlexQuestionnaireWebjob'
EXEC sp_addrolemember @rolename = 'db_datareader', @membername = 'HierarchyUserImport'
EXEC sp_addrolemember @rolename = 'db_datareader', @membername = 'IntranetApps'
EXEC sp_addrolemember @rolename = 'db_datareader', @membername = 'InviteImport'
EXEC sp_addrolemember @rolename = 'db_datareader', @membername = 'InviteResponseWebJob'
EXEC sp_addrolemember @rolename = 'db_datareader', @membername = 'InviteTOuser'
EXEC sp_addrolemember @rolename = 'db_datareader', @membername = 'mscrm_sync'
EXEC sp_addrolemember @rolename = 'db_datareader', @membername = 'participant_import'
EXEC sp_addrolemember @rolename = 'db_datareader', @membername = 'projectcenter'
EXEC sp_addrolemember @rolename = 'db_datareader', @membername = 'SurveyCenter'
EXEC sp_addrolemember @rolename = 'db_datareader', @membername = 'SurveyWebJob'
EXEC sp_addrolemember @rolename = 'db_datawriter', @membername = 'Effectory-Core-MeasurementService'
EXEC sp_addrolemember @rolename = 'db_datawriter', @membername = 'ERS'
EXEC sp_addrolemember @rolename = 'db_datawriter', @membername = 'GenerateFlexQuestionnaireWebjob'
EXEC sp_addrolemember @rolename = 'db_datawriter', @membername = 'HierarchyUserImport'
EXEC sp_addrolemember @rolename = 'db_datawriter', @membername = 'InviteImport'
EXEC sp_addrolemember @rolename = 'db_datawriter', @membername = 'InviteResponseWebJob'
EXEC sp_addrolemember @rolename = 'db_datawriter', @membername = 'mscrm_sync'
EXEC sp_addrolemember @rolename = 'db_datawriter', @membername = 'participant_import'
EXEC sp_addrolemember @rolename = 'db_datawriter', @membername = 'projectcenter'
EXEC sp_addrolemember @rolename = 'db_datawriter', @membername = 'SurveyCenter'
EXEC sp_addrolemember @rolename = 'db_datawriter', @membername = 'SurveyWebJob'
EXEC sp_addrolemember @rolename = 'db_executor', @membername = 'ERS'
EXEC sp_addrolemember @rolename = 'db_executor', @membername = 'GenerateFlexQuestionnaireWebjob'
EXEC sp_addrolemember @rolename = 'db_executor', @membername = 'InviteImport'
EXEC sp_addrolemember @rolename = 'db_executor', @membername = 'mscrm_sync'
EXEC sp_addrolemember @rolename = 'db_executor', @membername = 'projectcenter'
EXEC sp_addrolemember @rolename = 'db_executor', @membername = 'SurveyWebJob'
EXEC sp_addrolemember @rolename = 'db_owner', @membername = 'BuildServer'
EXEC sp_addrolemember @rolename = 'db_owner', @membername = 'InviteReplication'
 
-- [-- OBJECT LEVEL PERMISSIONS --] --
DENY DELETE ON [dbo].[HierarchyEventSync] TO [_AzureParticipantsDBReadExecute]
DENY DELETE ON [dbo].[MeasurementParticipantEventSync] TO [_AzureParticipantsDBReadExecute]
DENY DELETE ON [dbo].[ParticipantCharacteristicEventSync] TO [_AzureParticipantsDBReadExecute]
DENY DELETE ON [dbo].[ParticipantEventSync] TO [_AzureParticipantsDBReadExecute]
DENY DELETE ON [dbo].[ParticipantExtraColumnValueEventSync] TO [_AzureParticipantsDBReadExecute]
DENY EXECUTE ON [dbo].[sp_alterdiagram] TO [guest]
DENY EXECUTE ON [dbo].[sp_creatediagram] TO [guest]
DENY EXECUTE ON [dbo].[sp_dropdiagram] TO [guest]
DENY EXECUTE ON [dbo].[sp_helpdiagramdefinition] TO [guest]
DENY EXECUTE ON [dbo].[sp_helpdiagrams] TO [guest]
DENY EXECUTE ON [dbo].[sp_renamediagram] TO [guest]
GRANT ALTER ON [dbo].[MeasurementParticipant] TO [ClearConfirmedTeamsWebJob]
GRANT DELETE ON [dbo].[CharacteristicQuestionnaire] TO [ClearConfirmedTeamsWebJob]
GRANT DELETE ON [dbo].[MeasurementParticipant] TO [projectcenter]
GRANT DELETE ON [dbo].[ParticipantCharacteristic] TO [projectcenter]
GRANT DELETE ON [dbo].[ParticipantProjectCharacteristic] TO [participant_validation]
GRANT DELETE ON [Mailings].[DomainSendTimeExceptions] TO [mailing.service@Effectory.com]
GRANT DELETE ON [Mailings].[DomainSendTimeExceptions] TO [MailingManager]
GRANT DELETE ON [Mailings].[FailedToSentMailings] TO [mailing.service@Effectory.com]
GRANT DELETE ON [Mailings].[FailedToSentMailings] TO [MailingManager]
GRANT DELETE ON [Mailings].[Mailing] TO [mailing.service@Effectory.com]
GRANT DELETE ON [Mailings].[Mailing] TO [MailingManager]
GRANT DELETE ON [Mailings].[MailingAttachment] TO [mailing.service@Effectory.com]
GRANT DELETE ON [Mailings].[MailingAttachment] TO [MailingManager]
GRANT DELETE ON [Mailings].[MailingDisclaimer] TO [mailing.service@Effectory.com]
GRANT DELETE ON [Mailings].[MailingDisclaimer] TO [MailingManager]
GRANT DELETE ON [Mailings].[MailingTemplate] TO [mailing.service@Effectory.com]
GRANT DELETE ON [Mailings].[MailingTemplate] TO [MailingManager]
GRANT DELETE ON [Mailings].[MailingTemplateTypeNames] TO [mailing.service@Effectory.com]
GRANT DELETE ON [Mailings].[MailingTemplateTypeNames] TO [MailingManager]
GRANT DELETE ON [Mailings].[MailingTemplateTypes] TO [mailing.service@Effectory.com]
GRANT DELETE ON [Mailings].[MailingTemplateTypes] TO [MailingManager]
GRANT DELETE ON [Mailings].[MailingText] TO [mailing.service@Effectory.com]
GRANT DELETE ON [Mailings].[MailingText] TO [MailingManager]
GRANT DELETE ON [Mailings].[MailSP_Log] TO [mailing.service@Effectory.com]
GRANT DELETE ON [Mailings].[MailSP_Log] TO [MailingManager]
GRANT DELETE ON [Mailings].[SentMailings] TO [mailing.service@Effectory.com]
GRANT DELETE ON [Mailings].[SentMailings] TO [MailingManager]
GRANT EXECUTE ON [dbo].[get_internalcodes_by_surveyId] TO [response.service@Effectory.com]
GRANT EXECUTE ON [dbo].[ImportParticipantsIntoMeasurement] TO [Effectory-Core-MeasurementService]
GRANT EXECUTE ON [dbo].[ImportResultsDelete] TO [InviteExport]
GRANT EXECUTE ON [dbo].[ImportResultsDelete] TO [InviteImport]
GRANT EXECUTE ON [dbo].[ImportResultsDelete] TO [SurveyCenter]
GRANT EXECUTE ON [dbo].[insert_characteristic_characteristictext_from_xml] TO [SurveyCenter]
GRANT EXECUTE ON [dbo].[internalcodes_claim] TO [myprojectwebservice@effectory.com]
GRANT EXECUTE ON [dbo].[internalcodes_claim] TO [participant_import]
GRANT EXECUTE ON [dbo].[internalcodes_claim] TO [participant_validation]
GRANT EXECUTE ON [dbo].[internalcodes_claim] TO [response.service@Effectory.com]
GRANT EXECUTE ON [dbo].[internalcodes_generate] TO [response.service@Effectory.com]
GRANT EXECUTE ON [dbo].[internalcodes_generate] TO [scratchcardgenerator]
GRANT EXECUTE ON [dbo].[internalcodes_get_no_available_codes] TO [response.service@Effectory.com]
GRANT EXECUTE ON [dbo].[internalcodes_get_no_available_codes] TO [scratchcardgenerator]
GRANT EXECUTE ON [dbo].[offboarding_participants_invalidlist] TO [IntranetApps]
GRANT EXECUTE ON [dbo].[ParticipantCharacteristics_Clear_By_MeasurementID] TO [SurveyCenter]
GRANT EXECUTE ON [dbo].[ParticipantCharacteristics_Clear_By_SurveyID] TO [SurveyCenter]
GRANT EXECUTE ON [dbo].[Response_webjob_previoussurvey] TO [InviteResponseWebJob]
GRANT EXECUTE ON [dbo].[sp_alterdiagram] TO [public]
GRANT EXECUTE ON [dbo].[sp_creatediagram] TO [public]
GRANT EXECUTE ON [dbo].[sp_dropdiagram] TO [public]
GRANT EXECUTE ON [dbo].[sp_helpdiagramdefinition] TO [public]
GRANT EXECUTE ON [dbo].[sp_helpdiagrams] TO [public]
GRANT EXECUTE ON [dbo].[sp_renamediagram] TO [public]
GRANT EXECUTE ON [dbo].[survey_update_measurement_info] TO [projectcenter]
GRANT EXECUTE ON [dbo].[survey_update_measurement_info_with_ece_survey_id] TO [projectcenter]
GRANT EXECUTE ON [dbo].[SurveyCenter_DemographicAnswer_Delete] TO [SurveyCenter]
GRANT EXECUTE ON [dbo].[sync_ece_update_ece_surveyid] TO [ece.service@Effectory.com]
GRANT EXECUTE ON [dbo].[sync_get_participant_information] TO [SurveyCenter]
GRANT EXECUTE ON [dbo].[sync_update_hasresponded] TO [response.service@Effectory.com]
GRANT EXECUTE ON [dbo].[Update_participant_xml] TO [InviteExport]
GRANT EXECUTE ON [dbo].[Update_participant_xml] TO [InviteImport]
GRANT EXECUTE ON [dbo].[Update_participant_xml] TO [SurveyCenter]
GRANT EXECUTE ON [Mailings].[GetScheduledMailings] TO [mailing.service@Effectory.com]
GRANT EXECUTE ON [Mailings].[GetScheduledMailings] TO [MailingManager]
GRANT EXECUTE ON [Mailings].[mm_service_get_data_for_status_update_mail] TO [mailing.service@Effectory.com]
GRANT EXECUTE ON [Mailings].[mm_service_get_data_for_status_update_mail] TO [MailingManager]
GRANT EXECUTE ON [Mailings].[mm_service_get_exta_data_for_one_participant] TO [mailing.service@Effectory.com]
GRANT EXECUTE ON [Mailings].[mm_service_get_exta_data_for_one_participant] TO [MailingManager]
GRANT EXECUTE ON [Mailings].[mm_service_get_mailings_to_send] TO [mailing.service@Effectory.com]
GRANT EXECUTE ON [Mailings].[mm_service_get_mailings_to_send] TO [MailingManager]
GRANT EXECUTE ON [Mailings].[mm_service_set_mailing_send_to_participant] TO [mailing.service@Effectory.com]
GRANT EXECUTE ON [Mailings].[mm_service_set_mailing_send_to_participant] TO [MailingManager]
GRANT EXECUTE ON [Mailings].[mm_service_set_mailing_status_to_error] TO [mailing.service@Effectory.com]
GRANT EXECUTE ON [Mailings].[mm_service_set_mailing_status_to_error] TO [MailingManager]
GRANT EXECUTE ON [Mailings].[mm_update_and_get_mailing_state] TO [mailing.service@Effectory.com]
GRANT EXECUTE ON [Mailings].[mm_update_and_get_mailing_state] TO [MailingManager]
GRANT EXECUTE ON [Mailings].[multipleResults] TO [mailing.service@Effectory.com]
GRANT EXECUTE ON [Mailings].[multipleResults] TO [MailingManager]
GRANT EXECUTE ON [Mailings].[SurveyCenter_CreateSurveyProvider] TO [mailing.service@Effectory.com]
GRANT EXECUTE ON [Mailings].[SurveyCenter_CreateSurveyProvider] TO [MailingManager]
GRANT EXECUTE ON [Mailings].[SurveyCenter_WebJob_Mailing_GetScheduledMails] TO [mailing.service@Effectory.com]
GRANT EXECUTE ON [Mailings].[SurveyCenter_WebJob_Mailing_GetScheduledMails] TO [MailingManager]
GRANT EXECUTE ON [Query].[GetMeasurementIdBySurveyId] TO [projectcenter]
GRANT EXECUTE ON [Query].[MyResultsUserQueries_Impersonate] TO [projectcenter]
GRANT EXECUTE ON [Query].[SurveyCharacteristicCategoryQueries_Get] TO [projectcenter]
GRANT EXECUTE ON [Query].[SurveyHierarchyDownloadQueries_Get] TO [projectcenter]
GRANT EXECUTE ON [Query].[SurveyHierarchyDownloadQueries_Get_GetHierarchyNames] TO [projectcenter]
GRANT EXECUTE ON [Query].[SurveyHierarchyGroupLinkAutoMapQueries_Get] TO [projectcenter]
GRANT EXECUTE ON [Query].[SurveyHierarchyGroupLinkAutoMapQueries_Get_Characteristics] TO [projectcenter]
GRANT EXECUTE ON [Query].[SurveyHierarchyGroupLinkQueries_Get] TO [projectcenter]
GRANT EXECUTE ON [Query].[SurveyHierarchyGroupLinkQueries_Get_Characteristics] TO [projectcenter]
GRANT EXECUTE ON [Query].[SurveyHierarchyNodeCrossingQueries_Get] TO [projectcenter]
GRANT EXECUTE ON [Query].[SurveyHierarchyQueries_Get] TO [projectcenter]
GRANT EXECUTE ON [Query].[SurveyHierarchyQueries_Get_Locks] TO [projectcenter]
GRANT EXECUTE ON [Query].[SurveyHierarchyQueries_Get_Statusses] TO [projectcenter]
GRANT EXECUTE ON [Query].[SurveyHierarchyQueries_GetById] TO [projectcenter]
GRANT EXECUTE ON [Query].[SurveyHierarchyQueries_GetById_Categories] TO [projectcenter]
GRANT EXECUTE ON [Query].[SurveyHierarchyQueries_GetById_CharacteristicCategories] TO [projectcenter]
GRANT EXECUTE ON [Query].[SurveyHierarchyQueries_GetById_Locks] TO [projectcenter]
GRANT EXECUTE ON [Query].[SurveyHierarchyQueries_GetById_Statusses] TO [projectcenter]
GRANT EXECUTE ON [Query].[SurveyHierarchyQueries_GetById_Translations] TO [projectcenter]
GRANT EXECUTE ON [Query].[SurveyHierarchyTreeQueries_GetById] TO [projectcenter]
GRANT EXECUTE ON [Query].[SurveyHierarchyTreeQueries_GetById_CharacteristicCategories] TO [projectcenter]
GRANT EXECUTE ON [Query].[SurveyQueries_GetCharacteristicsCategories] TO [projectcenter]
GRANT EXECUTE ON [Query].[SurveyQueries_GetCharacteristicsCategories_Characteristics] TO [projectcenter]
GRANT EXECUTE ON [Query].[ToolkitQueries_GetRespondent] TO [projectcenter]
GRANT EXECUTE ON [Query].[ToolkitQueries_GetRespondent_Characteristics] TO [projectcenter]
GRANT EXECUTE ON [Query].[ToolkitQueries_Search] TO [projectcenter]
GRANT INSERT ON [dbo].[Characteristic] TO [participant_validation]
GRANT INSERT ON [dbo].[CharacteristicCategory] TO [participant_validation]
GRANT INSERT ON [dbo].[CharacteristicCategoryText] TO [participant_validation]
GRANT INSERT ON [dbo].[CharacteristicText] TO [participant_validation]
GRANT INSERT ON [dbo].[InternalCodes] TO [scratchcardgenerator]
GRANT INSERT ON [dbo].[MeasurementParticipant] TO [projectcenter]
GRANT INSERT ON [dbo].[MeasurementParticipant] TO [SurveyCenter]
GRANT INSERT ON [dbo].[MeasurementSync] TO [participant_validation]
GRANT INSERT ON [dbo].[Participant] TO [participant_validation]
GRANT INSERT ON [dbo].[ParticipantCharacteristic] TO [projectcenter]
GRANT INSERT ON [dbo].[ParticipantProjectCharacteristic] TO [participant_validation]
GRANT INSERT ON [dbo].[Project] TO [participant_validation]
GRANT INSERT ON [dbo].[SurveySyncClusterMatrix] TO [projectcenter]
GRANT INSERT ON [Mailings].[DomainSendTimeExceptions] TO [mailing.service@Effectory.com]
GRANT INSERT ON [Mailings].[DomainSendTimeExceptions] TO [MailingManager]
GRANT INSERT ON [Mailings].[FailedToSentMailings] TO [mailing.service@Effectory.com]
GRANT INSERT ON [Mailings].[FailedToSentMailings] TO [MailingManager]
GRANT INSERT ON [Mailings].[Mailing] TO [mailing.service@Effectory.com]
GRANT INSERT ON [Mailings].[Mailing] TO [MailingManager]
GRANT INSERT ON [Mailings].[MailingAttachment] TO [mailing.service@Effectory.com]
GRANT INSERT ON [Mailings].[MailingAttachment] TO [MailingManager]
GRANT INSERT ON [Mailings].[MailingDisclaimer] TO [mailing.service@Effectory.com]
GRANT INSERT ON [Mailings].[MailingDisclaimer] TO [MailingManager]
GRANT INSERT ON [Mailings].[MailingTemplate] TO [mailing.service@Effectory.com]
GRANT INSERT ON [Mailings].[MailingTemplate] TO [MailingManager]
GRANT INSERT ON [Mailings].[MailingTemplateTypeNames] TO [mailing.service@Effectory.com]
GRANT INSERT ON [Mailings].[MailingTemplateTypeNames] TO [MailingManager]
GRANT INSERT ON [Mailings].[MailingTemplateTypes] TO [mailing.service@Effectory.com]
GRANT INSERT ON [Mailings].[MailingTemplateTypes] TO [MailingManager]
GRANT INSERT ON [Mailings].[MailingText] TO [mailing.service@Effectory.com]
GRANT INSERT ON [Mailings].[MailingText] TO [MailingManager]
GRANT INSERT ON [Mailings].[MailSP_Log] TO [mailing.service@Effectory.com]
GRANT INSERT ON [Mailings].[MailSP_Log] TO [MailingManager]
GRANT INSERT ON [Mailings].[SentMailings] TO [mailing.service@Effectory.com]
GRANT INSERT ON [Mailings].[SentMailings] TO [MailingManager]
GRANT SELECT ON [dbo].[Characteristic] TO [mailing.service@Effectory.com]
GRANT SELECT ON [dbo].[Characteristic] TO [participant_validation]
GRANT SELECT ON [dbo].[CharacteristicCategory] TO [mailing.service@Effectory.com]
GRANT SELECT ON [dbo].[CharacteristicCategory] TO [participant_validation]
GRANT SELECT ON [dbo].[CharacteristicCategoryText] TO [mailing.service@Effectory.com]
GRANT SELECT ON [dbo].[CharacteristicCategoryText] TO [participant_validation]
GRANT SELECT ON [dbo].[CharacteristicText] TO [mailing.service@Effectory.com]
GRANT SELECT ON [dbo].[CharacteristicText] TO [participant_validation]
GRANT SELECT ON [dbo].[InternalCodes] TO [participant_validation]
GRANT SELECT ON [dbo].[InternalCodes] TO [scratchcardgenerator]
GRANT SELECT ON [dbo].[Measurement] TO [QuestionnaireWebApi]
GRANT SELECT ON [dbo].[MeasurementColumn] TO [mailing.service@Effectory.com]
GRANT SELECT ON [dbo].[MeasurementParticipant] TO [mailing.service@Effectory.com]
GRANT SELECT ON [dbo].[MeasurementParticipant] TO [participant_validation]
GRANT SELECT ON [dbo].[MeasurementParticipant] TO [projectcenter]
GRANT SELECT ON [dbo].[MeasurementParticipant] TO [SurveyCenter]
GRANT SELECT ON [dbo].[MeasurementSurvey] TO [mailing.service@Effectory.com]
GRANT SELECT ON [dbo].[MeasurementSurvey] TO [participant_validation]
GRANT SELECT ON [dbo].[MeasurementSurvey] TO [QuestionnaireWebApi]
GRANT SELECT ON [dbo].[MeasurementSync] TO [participant_validation]
GRANT SELECT ON [dbo].[MeasurementText] TO [QuestionnaireWebApi]
GRANT SELECT ON [dbo].[MSsubscription_agents] TO [public]
GRANT SELECT ON [dbo].[Participant] TO [mailing.service@Effectory.com]
GRANT SELECT ON [dbo].[Participant] TO [participant_validation]
GRANT SELECT ON [dbo].[ParticipantCharacteristic] TO [mailing.service@Effectory.com]
GRANT SELECT ON [dbo].[ParticipantCharacteristic] TO [projectcenter]
GRANT SELECT ON [dbo].[ParticipantExtraColumn] TO [mailing.service@Effectory.com]
GRANT SELECT ON [dbo].[ParticipantExtraColumnValue] TO [mailing.service@Effectory.com]
GRANT SELECT ON [dbo].[ParticipantProjectCharacteristic] TO [participant_validation]
GRANT SELECT ON [dbo].[Project] TO [participant_validation]
GRANT SELECT ON [dbo].[Survey] TO [mailing.service@Effectory.com]
GRANT SELECT ON [Mailings].[DomainSendTimeExceptions] TO [mailing.service@Effectory.com]
GRANT SELECT ON [Mailings].[DomainSendTimeExceptions] TO [MailingManager]
GRANT SELECT ON [Mailings].[FailedToSentMailings] TO [mailing.service@Effectory.com]
GRANT SELECT ON [Mailings].[FailedToSentMailings] TO [MailingManager]
GRANT SELECT ON [Mailings].[Mailing] TO [mailing.service@Effectory.com]
GRANT SELECT ON [Mailings].[Mailing] TO [MailingManager]
GRANT SELECT ON [Mailings].[MailingAttachment] TO [mailing.service@Effectory.com]
GRANT SELECT ON [Mailings].[MailingAttachment] TO [MailingManager]
GRANT SELECT ON [Mailings].[MailingDisclaimer] TO [mailing.service@Effectory.com]
GRANT SELECT ON [Mailings].[MailingDisclaimer] TO [MailingManager]
GRANT SELECT ON [Mailings].[MailingTemplate] TO [mailing.service@Effectory.com]
GRANT SELECT ON [Mailings].[MailingTemplate] TO [MailingManager]
GRANT SELECT ON [Mailings].[MailingTemplateTypeNames] TO [mailing.service@Effectory.com]
GRANT SELECT ON [Mailings].[MailingTemplateTypeNames] TO [MailingManager]
GRANT SELECT ON [Mailings].[MailingTemplateTypes] TO [mailing.service@Effectory.com]
GRANT SELECT ON [Mailings].[MailingTemplateTypes] TO [MailingManager]
GRANT SELECT ON [Mailings].[MailingText] TO [mailing.service@Effectory.com]
GRANT SELECT ON [Mailings].[MailingText] TO [MailingManager]
GRANT SELECT ON [Mailings].[MailSP_Log] TO [mailing.service@Effectory.com]
GRANT SELECT ON [Mailings].[MailSP_Log] TO [MailingManager]
GRANT SELECT ON [Mailings].[SentMailings] TO [mailing.service@Effectory.com]
GRANT SELECT ON [Mailings].[SentMailings] TO [MailingManager]
GRANT SELECT ON [sys].[database_firewall_rules] TO [public]
GRANT UPDATE ON [dbo].[InternalCodes] TO [participant_validation]
GRANT UPDATE ON [dbo].[MeasurementParticipant] TO [ClearConfirmedTeamsWebJob]
GRANT UPDATE ON [dbo].[MeasurementParticipant] TO [participant_validation]
GRANT UPDATE ON [dbo].[MeasurementParticipant] TO [projectcenter]
GRANT UPDATE ON [dbo].[MeasurementParticipant] TO [SurveyCenter]
GRANT UPDATE ON [dbo].[Participant] TO [participant_validation]
GRANT UPDATE ON [dbo].[ParticipantCharacteristic] TO [projectcenter]
GRANT UPDATE ON [dbo].[ParticipantCharacteristic] TO [SurveyCenter]
GRANT UPDATE ON [dbo].[Project] TO [participant_validation]
GRANT UPDATE ON [dbo].[Survey] TO [ece.service@Effectory.com]
GRANT UPDATE ON [Mailings].[DomainSendTimeExceptions] TO [mailing.service@Effectory.com]
GRANT UPDATE ON [Mailings].[DomainSendTimeExceptions] TO [MailingManager]
GRANT UPDATE ON [Mailings].[FailedToSentMailings] TO [mailing.service@Effectory.com]
GRANT UPDATE ON [Mailings].[FailedToSentMailings] TO [MailingManager]
GRANT UPDATE ON [Mailings].[Mailing] TO [mailing.service@Effectory.com]
GRANT UPDATE ON [Mailings].[Mailing] TO [MailingManager]
GRANT UPDATE ON [Mailings].[MailingAttachment] TO [mailing.service@Effectory.com]
GRANT UPDATE ON [Mailings].[MailingAttachment] TO [MailingManager]
GRANT UPDATE ON [Mailings].[MailingDisclaimer] TO [mailing.service@Effectory.com]
GRANT UPDATE ON [Mailings].[MailingDisclaimer] TO [MailingManager]
GRANT UPDATE ON [Mailings].[MailingTemplate] TO [mailing.service@Effectory.com]
GRANT UPDATE ON [Mailings].[MailingTemplate] TO [MailingManager]
GRANT UPDATE ON [Mailings].[MailingTemplateTypeNames] TO [mailing.service@Effectory.com]
GRANT UPDATE ON [Mailings].[MailingTemplateTypeNames] TO [MailingManager]
GRANT UPDATE ON [Mailings].[MailingTemplateTypes] TO [mailing.service@Effectory.com]
GRANT UPDATE ON [Mailings].[MailingTemplateTypes] TO [MailingManager]
GRANT UPDATE ON [Mailings].[MailingText] TO [mailing.service@Effectory.com]
GRANT UPDATE ON [Mailings].[MailingText] TO [MailingManager]
GRANT UPDATE ON [Mailings].[MailSP_Log] TO [mailing.service@Effectory.com]
GRANT UPDATE ON [Mailings].[MailSP_Log] TO [MailingManager]
GRANT UPDATE ON [Mailings].[SentMailings] TO [mailing.service@Effectory.com]
GRANT UPDATE ON [Mailings].[SentMailings] TO [MailingManager]
-- [-- TYPE LEVEL PERMISSIONS --] --
GRANT EXECUTE ON [dbo].[ParticipantIdTable] TO [Effectory-Core-MeasurementService]
GRANT EXECUTE ON [dbo].[RespondedParticipant] TO [response.service@Effectory.com]
 
-- [--DB LEVEL PERMISSIONS --] --
GRANT ALTER TO [SyncDemographicsWebJob]
GRANT CONNECT TO [BuildServer]
GRANT CONNECT TO [ClearConfirmedTeamsWebJob]
GRANT CONNECT TO [Effectory-Core-MeasurementService]
GRANT CONNECT TO [ERS]
GRANT CONNECT TO [GatherResponseWebJob]
GRANT CONNECT TO [GenerateFlexQuestionnaireWebjob]
GRANT CONNECT TO [HierarchyUserImport]
GRANT CONNECT TO [IntranetApps]
GRANT CONNECT TO [InviteExport]
GRANT CONNECT TO [InviteImport]
GRANT CONNECT TO [InviteReplication]
GRANT CONNECT TO [InviteResponseWebJob]
GRANT CONNECT TO [InviteTOuser]
GRANT CONNECT TO [MailingManager]
GRANT CONNECT TO [mailings_webapi]
GRANT CONNECT TO [mscrm_sync]
GRANT CONNECT TO [participant_import]
GRANT CONNECT TO [participant_validation]
GRANT CONNECT TO [projectcenter]
GRANT CONNECT TO [QuestionbaseWebservice]
GRANT CONNECT TO [QuestionnaireWebApi]
GRANT CONNECT TO [SurveyCenter]
GRANT CONNECT TO [SurveyWebJob]
GRANT CONNECT TO [SyncDemographicsWebJob]
GRANT DELETE TO [GatherResponseWebJob]
GRANT DELETE TO [InviteExport]
GRANT DELETE TO [projectcenter]
GRANT DELETE TO [SyncDemographicsWebJob]
GRANT EXECUTE TO [GatherResponseWebJob]
GRANT EXECUTE TO [InviteExport]
GRANT EXECUTE TO [InviteImport]
GRANT EXECUTE TO [InviteTOuser]
GRANT EXECUTE TO [MailingManager]
GRANT EXECUTE TO [mailings_webapi]
GRANT INSERT TO [GatherResponseWebJob]
GRANT INSERT TO [InviteExport]
GRANT INSERT TO [projectcenter]
GRANT INSERT TO [SyncDemographicsWebJob]
GRANT SELECT TO [GatherResponseWebJob]
GRANT SELECT TO [InviteExport]
GRANT SELECT TO [mailings_webapi]
GRANT SELECT TO [SyncDemographicsWebJob]
GRANT UNMASK TO [Effectory-Core-MeasurementService]
GRANT UNMASK TO [MailingManager]
GRANT UNMASK TO [mailings_webapi]
GRANT UNMASK TO [projectcenter]
GRANT UPDATE TO [GatherResponseWebJob]
GRANT UPDATE TO [InviteExport]
GRANT UPDATE TO [SyncDemographicsWebJob]
 
-- [--DB LEVEL SCHEMA PERMISSIONS --] --
GRANT ALTER ON SCHEMA::[dbo] TO [_Invite_Alter_Schema_]
