def main(argv): """Remove a user group from the Informatica Domain Usage: deleteGroup.py [-h] -g GROUP_NAME """ thisproc = "MAIN" mainProc = 'deleteGroup' resultlogger = supporting.configurelogger(mainProc) logger = logging.getLogger(mainProc) args = parse_the_arguments(argv) generalSettings.getenvvars() supporting.log(logger, logging.DEBUG, thisproc, 'Started') supporting.log(logger, logging.DEBUG, thisproc, 'logDir is >' + generalSettings.logDir + "<.") group_name = args.group_name infaSettings.getinfaenvvars() infaSettings.outinfaenvvars() group = manageSecurity.ManageSecurity( Tool="DeleteGroup", Domain=infaSettings.sourceDomain, GroupName=group_name, OnError=errorcodes.INFACMD_DELETE_GROUP_FAILED) result = manageSecurity.ManageSecurity.manage(group) supporting.log( logger, logging.DEBUG, thisproc, 'Completed with return code >' + str(result.rc) + '< and result code >' + result.code + "<.") supporting.exitscript(resultlogger, result)
def main(argv): """Create a user. If a password is not provided, one will be generated usage: createUser.py [-h] -u USERNAME [-p PASSWORD] -f FULLNAME [-d DESCRIPTION] [-e EMAIL] [-n PHONENUMBER] """ thisproc = "MAIN" mainProc = 'createUser' resultlogger = supporting.configurelogger(mainProc) logger = logging.getLogger(mainProc) args, generated_password = parse_the_arguments(argv) generalSettings.getenvvars() supporting.log(logger, logging.DEBUG, thisproc, 'Started') supporting.log(logger, logging.DEBUG, thisproc, 'logDir is >' + generalSettings.logDir + "<.") user_name = args.username user_password = args.password user_fullname = args.fullname user_description = args.description user_email = args.email user_phone = args.phonenumber if generated_password: print(args.password) infaSettings.getinfaenvvars() infaSettings.outinfaenvvars() user = manageSecurity.ManageSecurity( Tool="CreateUser", Domain=infaSettings.sourceDomain, NewUserName=user_name, NewUserPassword=user_password, NewUserFullName=user_fullname, NewUserDescription=user_description, NewUserEmailAddress=user_email, NewUserPhoneNumber=user_phone, OnError=errorcodes.INFACMD_CREATE_USER_FAILED) result = manageSecurity.ManageSecurity.manage(user) supporting.log( logger, logging.DEBUG, thisproc, 'Completed with return code >' + str(result.rc) + '< and result code >' + result.code + "<.") supporting.exitscript(resultlogger, result)
def main(argv): """Exports users and groups. usage: exportUsersAndGroups.py [-h] -o OUTPUT_FILE [-f {false,true}] [-r {false,true}] where: -f or --force: Overwrite output file if it exists -r or --retainpassword: If set to "false" user passwords are not exported. If "true" they will be. """ thisproc = "MAIN" mainProc = 'exportUsersAndGroups' resultlogger = supporting.configurelogger(mainProc) logger = logging.getLogger(mainProc) args = parse_the_arguments(argv) generalSettings.getenvvars() supporting.log(logger, logging.DEBUG, thisproc, 'Started') supporting.log(logger, logging.DEBUG, thisproc, 'logDir is >' + generalSettings.logDir + "<.") export_file_name = args.output_file force = args.force retain_password = args.retain_password infaSettings.getinfaenvvars() infaSettings.outinfaenvvars() users_and_groups = manageSecurity.ManageSecurity( Tool="ExportUsersAndGroups", Domain=infaSettings.sourceDomain, ExportFile=export_file_name, Force=force, RetainPassword=retain_password, OnError=errorcodes.INFACMD_EXPORT_USRGRP_FAILED) result = manageSecurity.ManageSecurity.manage(users_and_groups) supporting.log( logger, logging.DEBUG, thisproc, 'Completed with return code >' + str(result.rc) + '< and result code >' + result.code + "<.") supporting.exitscript(resultlogger, result)
def main(argv): """Import users and groups from a file. The file has to be generated by exportUsersAndGroups.py or a self-made corresponding infacmd command line. usage: importUsersAndGroups.py [-h] -i INPUT_FILE [-r {false,true}] where: -r determines whether (true) or not (false) existing users and groups in the target environment should be re-used. Check the Informatica documentation for further information on importing users and groups with infacmd. """ thisproc = "MAIN" mainProc = 'importUsersAndGroups' resultlogger = supporting.configurelogger(mainProc) logger = logging.getLogger(mainProc) args = parse_the_arguments(argv) generalSettings.getenvvars() supporting.log(logger, logging.DEBUG, thisproc, 'Started') supporting.log(logger, logging.DEBUG, thisproc, 'logDir is >' + generalSettings.logDir + "<.") import_file_name = args.input_file reuse_domain_users_and_groups = args.reuse infaSettings.getinfaenvvars() infaSettings.outinfaenvvars() users_and_groups = manageSecurity.ManageSecurity( Tool="ImportUsersAndGroups", Domain=infaSettings.sourceDomain, ExportFile=import_file_name, ReuseDomainUsersAndGroups=reuse_domain_users_and_groups, OnError=errorcodes.INFACMD_IMPORT_USRGRP_FAILED) result = manageSecurity.ManageSecurity.manage(users_and_groups) supporting.log( logger, logging.DEBUG, thisproc, 'Completed with return code >' + str(result.rc) + '< and result code >' + result.code + "<.") supporting.exitscript(resultlogger, result)
def main(argv): thisproc = "MAIN" mainProc = 'createGroup' resultlogger = supporting.configurelogger(mainProc) logger = logging.getLogger(mainProc) args = parse_the_arguments(argv) generalSettings.getenvvars() supporting.log(logger, logging.DEBUG, thisproc, 'Started') supporting.log(logger, logging.DEBUG, thisproc, 'logDir is >' + generalSettings.logDir + "<.") group_name = args.group_name group_description = args.group_description supporting.log(logger, logging.DEBUG, thisproc, 'Group name is >' + group_name + '<.') supporting.log(logger, logging.DEBUG, thisproc, 'Group description is >' + group_description + '<.') infaSettings.getinfaenvvars() infaSettings.outinfaenvvars() group = manageSecurity.ManageSecurity( Tool="CreateGroup", Domain=infaSettings.sourceDomain, GroupName=group_name, GroupDescription=group_description, OnError=errorcodes.INFACMD_CREATE_GROUP_FAILED) result = manageSecurity.ManageSecurity.manage(group) supporting.log( logger, logging.DEBUG, thisproc, 'Completed with return code >' + str(result.rc) + '< and result code >' + result.code + "<.") supporting.exitscript(resultlogger, result)