Style fixes
This commit is contained in:
parent
7ce8caa913
commit
659757f173
@ -35,9 +35,8 @@ GROUP_MEMBERSHIP = config.get("auth", "pam_group_membership")
|
|||||||
|
|
||||||
def is_authenticated(user, password):
|
def is_authenticated(user, password):
|
||||||
"""Check if ``user``/``password`` couple is valid."""
|
"""Check if ``user``/``password`` couple is valid."""
|
||||||
|
|
||||||
if user is None or password is None:
|
if user is None or password is None:
|
||||||
return False
|
return False
|
||||||
|
|
||||||
# Check whether the user exists in the PAM system
|
# Check whether the user exists in the PAM system
|
||||||
try:
|
try:
|
||||||
@ -63,12 +62,11 @@ def is_authenticated(user, password):
|
|||||||
# Get user primary group
|
# Get user primary group
|
||||||
primary_group = grp.getgrgid(pwd.getpwnam(user).pw_gid).gr_name
|
primary_group = grp.getgrgid(pwd.getpwnam(user).pw_gid).gr_name
|
||||||
except KeyError:
|
except KeyError:
|
||||||
log.LOGGER.debug(
|
log.LOGGER.debug("The PAM user (%s) doesn't exist" % user)
|
||||||
"The PAM user (%s) doesn't exist" %
|
|
||||||
user)
|
|
||||||
return False
|
return False
|
||||||
|
|
||||||
# Check whether the user belongs to the required group (primary or supplementary)
|
# Check whether the user belongs to the required group
|
||||||
|
# (primary or supplementary)
|
||||||
if primary_group == GROUP_MEMBERSHIP or user in members:
|
if primary_group == GROUP_MEMBERSHIP or user in members:
|
||||||
log.LOGGER.debug(
|
log.LOGGER.debug(
|
||||||
"The PAM user belongs to the required group (%s)" %
|
"The PAM user belongs to the required group (%s)" %
|
||||||
|
Loading…
x
Reference in New Issue
Block a user