def __init__(self, admin_user, admin_pass, primary_domain, nick_domain, logger): self.primary_domain_connect = apps_service.AppsService( email=admin_user, domain=primary_domain, password=admin_pass) self.primary_domain_connect.ProgrammaticLogin() self.nick_domain_connect = apps_service.AppsService( email=admin_user, domain=nick_domain, password=admin_pass) self.nick_domain_connect.ProgrammaticLogin() self.nicknames = [] self.user_addresses = [] self.admin_user = admin_user self.admin_pass = admin_pass self.primary_domain = primary_domain self.nick_domain = nick_domain self.logger = logger
def GetAllUsers(domain, options): users = [] connect = apps_service.AppsService(email=options.admin_user, domain=options.domain, password=options.admin_pass) connect.ProgrammaticLogin() logging.info('Pulling user list') user_feed = connect.RetrieveAllUsers() user_feed.entry[0] for user_entry in user_feed.entry: users.append(user_entry.login.user_name.lower()) return users
def GetProvisionedUsers(options): conn = GetCalendarConnection(options) conn = apps_service.AppsService(email=options.admin_user, domain=options.domain, password=options.admin_pass) conn.ProgrammaticLogin() users = [] user_feed = conn.RetrieveAllUsers() for user_entry in user_feed.entry: users.append('%s@%s' % (user_entry.login.user_name.lower(), options.domain)) return users
def GetAllUsers(admin_user, admin_pass, domain): """Returns a list of all provisioned users for a domain.""" users = [] conn = apps_service.AppsService(email=admin_user, domain=domain, password=admin_pass) conn.ProgrammaticLogin() user_feed = conn.RetrieveAllUsers() for user_entry in user_feed.entry: if user_entry.login.suspended != 'true': users.append(user_entry.login.user_name.lower()) else: print "Skipping suspended user [%s]" % user_entry.login.user_name.lower() return users
def GetConnection(options): service = apps_service.AppsService(email=options.admin_user, domain=options.domain, password=options.admin_pass) service.ProgrammaticLogin() return service
def GetProvConnection(user, password, domain): service = apps_service.AppsService(email=user, domain=domain, password=password) service.ProgrammaticLogin() return service