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

Kqueen ldap #52

Merged
merged 7 commits into from
Apr 9, 2018
Merged

Kqueen ldap #52

merged 7 commits into from
Apr 9, 2018

Conversation

naumvd95
Copy link
Contributor

@naumvd95 naumvd95 commented Apr 4, 2018

  • refactor env-vars arch to provide configuration using only docker env-vars
  • remove apply_env changes due issues with bad overriding in case of multiple value-entries in config file
  • logging increased

from kqueen_ui.config import current_config


class AuthModules():
Copy link
Contributor

Choose a reason for hiding this comment

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

Is there a reason to create this class?

"""

for name, value in os.environ.items():
if name.startswith(prefix):
config_key_name = name[len(prefix):]
if re.search('(?i)true|(?i)false', value):
Copy link
Contributor

Choose a reason for hiding this comment

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

If we are converting strings to bool, can't we convert json string to list/dict in python and avoid creating unnecessary class?

@naumvd95 naumvd95 force-pushed the kqueen-ldap branch 2 times, most recently from 90971bb to 06cf7a5 Compare April 5, 2018 10:34
@naumvd95 naumvd95 requested a review from atengler April 5, 2018 10:39
@@ -27,7 +27,7 @@ jobs:
- pip3 install --editable .
- kqueen-ui &
- sleep 2
- wget -O - http://localhost:8000/
- wget -O - http://localhost:5080/
Copy link
Contributor

Choose a reason for hiding this comment

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

Is this change connected with ldap changes?

Copy link
Contributor Author

@naumvd95 naumvd95 Apr 5, 2018

Choose a reason for hiding this comment

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

its needed to pass tests

@@ -169,7 +170,10 @@ class MemberCreate(KQueenView):

def handle(self, organization_id):
form_cls = MemberCreateForm
auth_options = app.config.get('AUTH_OPTIONS', {})

auth_options = AUTH_MODULES
Copy link
Contributor

Choose a reason for hiding this comment

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

this is misleading, you can use AUTH_MODULES directly

@@ -56,6 +57,8 @@ class BaseConfig:
PROVISIONER_UNKNOWN_STATE = 'Not Reachable'

# Authentication choices
LDAP_AUTH_NOTIFY = False
LOCAL_AUTH_NOTIFY = True
AUTH_OPTIONS = {}
Copy link
Contributor

Choose a reason for hiding this comment

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

we don't have AUTH_OPTIONS anymore as I understand correctly

@@ -2,27 +2,23 @@


class Config(BaseConfig):
DEBUG = True
DEBUG = False
Copy link
Contributor

Choose a reason for hiding this comment

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

Are you sure you want to set it to False?

@naumvd95 naumvd95 force-pushed the kqueen-ldap branch 3 times, most recently from bcfd4ea to fe41a4c Compare April 5, 2018 13:53
@atengler
Copy link
Contributor

atengler commented Apr 6, 2018

This change is not equivalent to the current configuration. When you move the auth dict sample from config to code, you can no longer use local auth only for example. Can you alter the code so it is still configurable which auth backends we use?

auth_options = app.config.get('AUTH_OPTIONS', {})
if auth_options:

if AUTH_MODULES:
Copy link
Contributor

Choose a reason for hiding this comment

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

you are imported it directly, this check is redundant

@@ -56,7 +57,8 @@ class BaseConfig:
PROVISIONER_UNKNOWN_STATE = 'Not Reachable'

# Authentication choices
AUTH_OPTIONS = {}
LDAP_AUTH_NOTIFY = False
Copy link
Contributor

Choose a reason for hiding this comment

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

In the rest of the file boolean variables are strings, let's keep consistent and dot he same for those paramaters

Copy link
Contributor Author

Choose a reason for hiding this comment

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

in my opinion it redundant, those variables should be bool ideally
in docker env bool vars is not allowed in compose file docker/compose#2000
so imo docker-env and config files should not be equal

Copy link
Contributor Author

Choose a reason for hiding this comment

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

IMO one way we should avoid quotes - is defining all docker vars into '.env' file. There is allowed to use normal bool vars, but it is another PR, does not related to this case

Copy link
Contributor

Choose a reason for hiding this comment

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

ok, so need to fix ENABLE_PUBLIC_REGISTRATION = 'False' in that file in a separate change

Copy link
Contributor Author

Choose a reason for hiding this comment

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

ok, so pls approve changes @atengler @katyafervent

# Auth configuration

# Enable email notifications to user
LDAP_AUTH_NOTIFY = False
Copy link
Contributor

Choose a reason for hiding this comment

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

same as above

Copy link
Contributor Author

Choose a reason for hiding this comment

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

in my opinion it redundant, those variables should be bool ideally
in docker env bool vars is not allowed in compose file docker/compose#2000
so imo docker-env and config files should not be equal

Copy link
Contributor Author

Choose a reason for hiding this comment

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

IMO one way we should avoid quotes - is defining all docker vars into '.env' file. There is allowed to use normal bool vars, but it is another PR, does not related to this case

katyafervent
katyafervent previously approved these changes Apr 6, 2018
- refactor arch for Auth modules management
Copy link
Contributor

@katyafervent katyafervent left a comment

Choose a reason for hiding this comment

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

LGTM, but I suggest to use one style for commit messages - with the capital letter

atengler
atengler previously approved these changes Apr 9, 2018
naumvd95 added 6 commits April 9, 2018 17:15
- configuration file parsing refactores to increase visibility and decrease cyclomatic complexity
- bool-checker added to avoid issues with defining bool variables as string in docker-compose
@naumvd95
Copy link
Contributor Author

naumvd95 commented Apr 9, 2018

@atengler pls clarify info about auth_config, i don't understand what do u mean

@katyafervent katyafervent merged commit 8d3f440 into master Apr 9, 2018
@katyafervent katyafervent deleted the kqueen-ldap branch June 15, 2018 12:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants