/// <summary> /// Constructor /// </summary> /// <param name="actionForUnexpectedSamlUsers"></param> /// <param name="actionForUnexpectedDefaultAuthUsers"></param> /// <param name="actionForUnexpectedOpenIdUsers"></param> /// <param name="actionForMissingSamlUsers"></param> /// <param name="actionForMissingDefaultAuthUsers"></param> /// <param name="actionForMissingOpenIdUsers"></param> /// <param name="actionForExistingSamlUsers"></param> /// <param name="actionForExistingDefaultAuthUsers"></param> /// <param name="actionForExistingOpenIdUsers"></param> /// <param name="actionForGroupUnexpectedMembers"></param> /// <param name="actionForGroupMisingMembers"></param> public ProvisionConfigExternalDirectorySync( ProvisionUserInstructions.UnexpectedUserAction actionForUnexpectedSamlUsers, ProvisionUserInstructions.UnexpectedUserAction actionForUnexpectedDefaultAuthUsers, ProvisionUserInstructions.UnexpectedUserAction actionForUnexpectedOpenIdUsers, ProvisionUserInstructions.MissingUserAction actionForMissingSamlUsers, ProvisionUserInstructions.MissingUserAction actionForMissingDefaultAuthUsers, ProvisionUserInstructions.MissingUserAction actionForMissingOpenIdUsers, ProvisionUserInstructions.ExistingUserAction actionForExistingSamlUsers, ProvisionUserInstructions.ExistingUserAction actionForExistingDefaultAuthUsers, ProvisionUserInstructions.ExistingUserAction actionForExistingOpenIdUsers, ProvisionUserInstructions.UnexpectedGroupMemberAction actionForGroupUnexpectedMembers, ProvisionUserInstructions.MissingGroupMemberAction actionForGroupMisingMembers ) { //Unexpected this.ActionForUnexpectedSamlUsers = actionForUnexpectedSamlUsers; this.ActionForUnexpectedDefaultAuthUsers = actionForUnexpectedDefaultAuthUsers; this.ActionForUnexpectedOpenIdUsers = actionForUnexpectedOpenIdUsers; //Missing this.ActionForMissingSamlUsers = actionForMissingSamlUsers; this.ActionForMissingDefaultAuthUsers = actionForMissingDefaultAuthUsers; this.ActionForMissingOpenIdUsers = actionForMissingOpenIdUsers; //Existing users needing modification this.ActionForExistingSamlUsers = actionForExistingSamlUsers; this.ActionForExistingDefaultAuthUsers = actionForExistingDefaultAuthUsers; this.ActionForExistingOpenIdUsers = actionForExistingOpenIdUsers; //Group memberships this.ActionForGroupUnexpectedMembers = actionForGroupUnexpectedMembers; this.ActionForGroupMisingMembers = actionForGroupMisingMembers; }
/// <summary> /// The ADD-User path for provisioning a user /// </summary> /// <param name="siteSignIn"></param> /// <param name="userToProvision"></param> /// <param name="missingUserAction"></param> private SiteUser Execute_ProvisionUsers_SingleUser_AddUser( TableauServerSignIn siteSignIn, ProvisioningUser userToProvision, ProvisionUserInstructions.MissingUserAction missingUserAction, WorkingListSiteUsers workingList_allKnownUsers) { switch (missingUserAction) { //Add the user case ProvisionUserInstructions.MissingUserAction.Add: //Setup to create a new user var createUser = new SendCreateUser( siteSignIn.ServerUrls, siteSignIn, userToProvision.UserName, userToProvision.UserRole, userToProvision.UserAuthenticationParsed); var userCreated = createUser.ExecuteRequest(); //------------------------------------------------------------------------------- //Record the action in an output file //------------------------------------------------------------------------------- CSVRecord_UserModified(userToProvision.UserName, userToProvision.UserRole, userToProvision.UserAuthentication, "added", ""); workingList_allKnownUsers.AddUser(userCreated); return(userCreated); //Don't add the user, just record the finding case ProvisionUserInstructions.MissingUserAction.Report: CSVRecord_UserModified(userToProvision.UserName, userToProvision.UserRole, userToProvision.UserAuthentication, "SIMULATED added", ""); return(null); default: IwsDiagnostics.Assert(false, "814-1210: Unknown missing user provisioning action"); throw new Exception("814-1210: Unknown missing user provisioning action"); } }
/// <summary> /// CONSTRUCTOR /// </summary> /// <param name="filePathConfig"></param> public ProvisionConfigExternalDirectorySync(string filePathConfig) { //================================================================================== //Load values from the TARGET SITE config file //================================================================================== var xmlConfig = new System.Xml.XmlDocument(); xmlConfig.Load(filePathConfig); //------------------------------------------------------------------------------- //Get any special instructions for email mapping //------------------------------------------------------------------------------- var xnodeHeader = xmlConfig.SelectSingleNode("//SynchronizeConfiguration"); this.EmailMapping = ParseUserEmailMapping( XmlHelper.SafeParseXmlAttribute(xnodeHeader, XmlAttribute_UserEmailMapping, "")); var xnodeRoleSyncHeader = xmlConfig.SelectSingleNode("//SynchronizeConfiguration/SynchronizeRoles"); //------------------------------------------------------------------------------- //Get instructions about the intended site membership provisioning //------------------------------------------------------------------------------- //UNEXPECTED USERS //1. this.ActionForUnexpectedSamlUsers = ProvisionUserInstructions.ParseUnexpectedUserActionFromAttribute( xnodeRoleSyncHeader, ProvisionUserInstructions.XmlAttribute_authSamlUnexpectedUsers); //2. this.ActionForUnexpectedDefaultAuthUsers = ProvisionUserInstructions.ParseUnexpectedUserActionFromAttribute( xnodeRoleSyncHeader, ProvisionUserInstructions.XmlAttribute_authDefaultUnexpectedUsers); //3. this.ActionForUnexpectedOpenIdUsers = ProvisionUserInstructions.ParseUnexpectedUserActionFromAttribute( xnodeRoleSyncHeader, ProvisionUserInstructions.XmlAttribute_authOpenIdUnexpectedUsers); //MISSING USERS //1. this.ActionForMissingSamlUsers = ProvisionUserInstructions.ParseMissingUserActionFromAttribute( xnodeRoleSyncHeader, ProvisionUserInstructions.XmlAttribute_authSamlMissingUsers); //2. this.ActionForMissingDefaultAuthUsers = ProvisionUserInstructions.ParseMissingUserActionFromAttribute( xnodeRoleSyncHeader, ProvisionUserInstructions.XmlAttribute_authDefaultMissingUsers); //3. this.ActionForMissingOpenIdUsers = ProvisionUserInstructions.ParseMissingUserActionFromAttribute( xnodeRoleSyncHeader, ProvisionUserInstructions.XmlAttribute_authOpenIdMissingUsers); //EXISTING USERS //1. this.ActionForExistingSamlUsers = ProvisionUserInstructions.ParseExistingUserActionFromAttribute( xnodeRoleSyncHeader, ProvisionUserInstructions.XmlAttribute_authSamlExistingUsers); //2. this.ActionForExistingDefaultAuthUsers = ProvisionUserInstructions.ParseExistingUserActionFromAttribute( xnodeRoleSyncHeader, ProvisionUserInstructions.XmlAttribute_authDefaultExistingUsers); //3. this.ActionForExistingOpenIdUsers = ProvisionUserInstructions.ParseExistingUserActionFromAttribute( xnodeRoleSyncHeader, ProvisionUserInstructions.XmlAttribute_authOpenIdExistingUsers); //------------------------------------------------------------------------------- //Get instructions about the intended group membership provisioning //------------------------------------------------------------------------------- var xnodeGroupsSyncHeader = xmlConfig.SelectSingleNode("//SynchronizeConfiguration/SynchronizeGroups"); this.ActionForGroupMisingMembers = ProvisionUserInstructions.ParseMissingGroupMemberAction( xnodeGroupsSyncHeader.Attributes[ProvisionUserInstructions.XmlAttribute_MissingGroupMembers].Value); this.ActionForGroupUnexpectedMembers = ProvisionUserInstructions.ParseUnexpectedGroupMemberAction( xnodeGroupsSyncHeader.Attributes[ProvisionUserInstructions.XmlAttribute_UnexpectedGroupMembers].Value); //--------------------------------------------------------------------------------------------- //Load the list User/Role mapping groups we want to look up in the external directory //--------------------------------------------------------------------------------------------- this.GroupsToRolesSyncList = ParseGroupsToRoles(xmlConfig).AsReadOnly(); //-------------------------------------------------------------------------------------- //Load any user/role overrides that may be defined for the site //-------------------------------------------------------------------------------------- this.UserRolesOverrideList = ProvisionUserInstructions.ParseUsers( xmlConfig, "//SynchronizeConfiguration/SynchronizeRoles/SiteMembershipOverrides/User", "**OVERRIDE**").AsReadOnly(); //--------------------------------------------------------------------------------------------- //Load the list of group/group mappings we want to look up in the external directory //--------------------------------------------------------------------------------------------- List <ISynchronizeGroupToGroup> groupsToSync = new List <ISynchronizeGroupToGroup>(); //1. Load and add explicit group/group mappings groupsToSync.AddRange(ParseGroupsToGroups(xmlConfig)); //2. Load and add pattern matching group/group mappings groupsToSync.AddRange(ParsePatternMatchGroupsToGroups(xmlConfig)); this.GroupsToGroupsSyncList = groupsToSync.AsReadOnly(); }
/// <summary> /// CONSTRUCTOR /// </summary> /// <param name="filePathConfig"></param> public ProvisionConfigExternalDirectorySync(string filePathConfig) { //================================================================================== //Load values from the TARGET SITE config file //================================================================================== var xmlConfig = new System.Xml.XmlDocument(); xmlConfig.Load(filePathConfig); var xnodeRoleSyncHeader = xmlConfig.SelectSingleNode("//SynchronizeConfiguration/SynchronizeRoles"); //------------------------------------------------------------------------------- //Get instructions about the intended site membership provisioning //------------------------------------------------------------------------------- this.ActionForUnexpectedSamlUsers = ProvisionUserInstructions.ParseUnexpectedUserAction( xnodeRoleSyncHeader.Attributes[ProvisionUserInstructions.XmlAttribute_authSamlUnexpectedUsers].Value); this.ActionForUnexpectedDefaultAuthUsers = ProvisionUserInstructions.ParseUnexpectedUserAction( xnodeRoleSyncHeader.Attributes[ProvisionUserInstructions.XmlAttribute_authDefaultUnexpectedUsers].Value); this.ActionForMissingSamlUsers = ProvisionUserInstructions.ParseMissingUserAction( xnodeRoleSyncHeader.Attributes[ProvisionUserInstructions.XmlAttribute_authSamlMissingUsers].Value); this.ActionForMissingDefaultAuthUsers = ProvisionUserInstructions.ParseMissingUserAction( xnodeRoleSyncHeader.Attributes[ProvisionUserInstructions.XmlAttribute_authDefaultMissingUsers].Value); this.ActionForExistingSamlUsers = ProvisionUserInstructions.ParseExistingUserAction( xnodeRoleSyncHeader.Attributes[ProvisionUserInstructions.XmlAttribute_authSamlExistingUsers].Value); this.ActionForExistingDefaultAuthUsers = ProvisionUserInstructions.ParseExistingUserAction( xnodeRoleSyncHeader.Attributes[ProvisionUserInstructions.XmlAttribute_authDefaultExistingUsers].Value); //------------------------------------------------------------------------------- //Get instructions about the intended group membership provisioning //------------------------------------------------------------------------------- var xnodeGroupsSyncHeader = xmlConfig.SelectSingleNode("//SynchronizeConfiguration/SynchronizeGroups"); this.ActionForGroupMisingMembers = ProvisionUserInstructions.ParseMissingGroupMemberAction( xnodeGroupsSyncHeader.Attributes[ProvisionUserInstructions.XmlAttribute_MissingGroupMembers].Value); this.ActionForGroupUnexpectedMembers = ProvisionUserInstructions.ParseUnexpectedGroupMemberAction( xnodeGroupsSyncHeader.Attributes[ProvisionUserInstructions.XmlAttribute_UnexpectedGroupMembers].Value); //--------------------------------------------------------------------------------------------- //Load the list User/Role mapping groups we want to look up in the external directory //--------------------------------------------------------------------------------------------- this.GroupsToRolesSyncList = ParseGroupsToRoles(xmlConfig).AsReadOnly(); //-------------------------------------------------------------------------------------- //Load any user/role overrides that may be defined for the site //-------------------------------------------------------------------------------------- this.UserRolesOverrideList = ProvisionUserInstructions.ParseUsers( xmlConfig, "//SynchronizeConfiguration/SynchronizeRoles/SiteMembershipOverrides/User", "**OVERRIDE**").AsReadOnly(); //--------------------------------------------------------------------------------------------- //Load the list of group/group mappings we want to look up in the external directory //--------------------------------------------------------------------------------------------- this.GroupsToGroupsSyncList = ParseGroupsToGroups(xmlConfig).AsReadOnly(); }