def execute(self): # disabling for now print "caching user ..." web = WebContainer.get_web() login = self.kwargs.get("login") login_sobj = Search.eval("@SOBJECT(sthpw/login['login','%s'])" % login, show_retired=True) if login_sobj: print "login %s already exists" % login return # cache the user try: from ad_authenticate import ADAuthenticate authenticate = ADAuthenticate() login_sobj = SearchType.create("sthpw/login") login_sobj.set_value("login", login) authenticate.add_user_info(login_sobj, password=None) login_sobj.commit() except Exception, e: print "Error: ", str(e)
def test_all(self): authenticate = ADAuthenticate() # put in a valid user login_name = 'supervisor' password = '******' exists = authenticate.verify(login_name, password) self.assertEquals(exists, True) login = SearchType.create("sthpw/login") login.set_value("login", login_name) authenticate.add_user_info(login, password) # check the user data display_name = authenticate.get_user_data("display_name") self.assertEquals("Smith, Joe", display_name) license_type = authenticate.get_user_data("license_type") #self.assertEquals("user", license_type) # check the login sobject license_type = login.get_value("license_type")
def test_all(my): authenticate = ADAuthenticate() # put in a valid user login_name = "supervisor" password = "******" exists = authenticate.verify(login_name, password) my.assertEquals(exists, True) login = SearchType.create("sthpw/login") login.set_value("login", login_name) authenticate.add_user_info(login, password) # check the user data display_name = authenticate.get_user_data("display_name") my.assertEquals("Smith, Joe", display_name) license_type = authenticate.get_user_data("license_type") # my.assertEquals("user", license_type) # check the login sobject license_type = login.get_value("license_type")