Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ldap auth in gecoscc #103

Open
wants to merge 5 commits into
base: development
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 13 additions & 1 deletion config-templates/development.ini
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@ jinja2.filters =
admin_jsonify = gecoscc.filters.admin_serialize

mongo_uri = mongodb://localhost:27017/gecoscc

redis_uri = redis://localhost:6379/4
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These lines have nothing to do with the PR

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the lines has been deleted.

#redis_uri = redis://:password@localhost:6379/4

# Pyramid - Beaker sessions configuration
# See: http://beaker.readthedocs.io/en/latest/configuration.html#session-options
Expand Down Expand Up @@ -86,6 +87,17 @@ supervisord.url.pattern = http://internal:changeme@%s:9001/RPC2
# This pattern could be HTTP or HTTPS depending on your configuration
gecos.internal.url.pattern = http://%s/internal/server/%s

# GecosCC LDAP configuration
#
# Change this variables in case you want to authentica users
# using LDAP/AD directory
gecos.ldap.url = ldap://192.168.1.124
gecos.ldap.port = 389
gecos.ldap.base = cn=users,dc=example,dc=com
gecos.ldap.prfx = cn=
gecos.ldap.admn = cn=admin,dc=example,dc=com
gecos.ldap.pass = supersecretpassword

# Cookbook upload config
# The gecoscc user must have permissions
cookbook_upload_rootdir = /opt/gecoscc/media/users
Expand Down
5 changes: 3 additions & 2 deletions gecoscc/forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ class GecosTwoColumnsForm(GecosForm):
class BaseAdminUserForm(GecosTwoColumnsForm):

sorted_fields = ('username', 'email', 'password',
'repeat_password', 'first_name', 'last_name',
'repeat_password', 'first_name', 'last_name', 'cc_auth_type',
'nav_tree_pagesize', 'policies_pagesize', 'jobs_pagesize', 'group_nodes_pagesize',
'ou_managed', 'ou_availables',)

Expand Down Expand Up @@ -120,7 +120,7 @@ def save(self, admin_user):

api = get_chef_api(settings, user)
try:
create_chef_admin_user(api, settings, admin_user['username'], None, admin_user['email'])
create_chef_admin_user(api, settings, admin_user['username'], None, admin_user['email'], admin_user['cc_auth_type'])
self.created_msg(_('User created successfully'))
return True
except ChefServerError as e:
Expand All @@ -146,6 +146,7 @@ def __init__(self, schema, collection, *args, **kwargs):
schema.children[self.sorted_fields.index('repeat_password')] = schema.children[self.sorted_fields.index('repeat_password')].clone()
schema.children[self.sorted_fields.index('password')].missing = ''
schema.children[self.sorted_fields.index('repeat_password')].missing = ''
schema.children[self.sorted_fields.index('cc_auth_type')] = schema.children[self.sorted_fields.index('cc_auth_type')].clone()
self.children[self.sorted_fields.index('username')].widget.readonly = True

def save(self, admin_user):
Expand Down
Loading