@@ -122,32 +122,42 @@ class CrowdServer(object):
% (self._uri, self._version, urllib2.quote(username)))
body = json.dumps({"value": password})
return self._request(url, body)
def user_groups(self, username):
"""Retrieve a list of groups to which this user belongs."""
url = ("%s/rest/usermanagement/%s/user/group/nested?username=%s"
return self._request(url)
class KallitheaAuthPlugin(auth_modules.KallitheaExternalAuthPlugin):
def __init__(self):
self._protocol_values = ["http", "https"]
@hybrid_property
def name(self):
return "crowd"
def settings(self):
settings = [
{
"name": "method",
"validator": self.validators.OneOf(self._protocol_values),
"type": "select",
"values": self._protocol_values,
"description": "The protocol used to connect to the Atlassian CROWD server.",
"formname": "Protocol"
},
"name": "host",
"validator": self.validators.UnicodeString(strip=True),
"type": "string",
"description": "The FQDN or IP of the Atlassian CROWD Server",
"default": "127.0.0.1",
"formname": "Host"
"name": "port",
"validator": self.validators.Number(strip=True),
"type": "int",
"description": "The Port in use by the Atlassian CROWD Server",
@@ -220,24 +220,25 @@ class TestAuthSettingsController(TestCon
extra_environ={'REMOTE_USER': 'john'},
)
assert 'Log Out' not in response.normal_body
def test_crowd_save_settings(self):
self.log_user()
params = self._enable_plugins('kallithea.lib.auth_modules.auth_internal,kallithea.lib.auth_modules.auth_crowd')
params.update({'auth_crowd_host': ' hostname ',
'auth_crowd_app_password': 'secret',
'auth_crowd_admin_groups': 'mygroup',
'auth_crowd_port': '123',
'auth_crowd_method': 'https',
'auth_crowd_app_name': 'xyzzy'})
test_url = url(controller='admin/auth_settings',
action='auth_settings')
response = self.app.post(url=test_url, params=params)
self.checkSessionFlash(response, 'Auth settings updated successfully')
new_settings = Setting.get_auth_settings()
assert new_settings['auth_crowd_host'] == u'hostname', 'fail db write compare'
@skipif(not pam_lib_installed, reason='skipping due to missing pam lib')
Status change: