for line in open(FILENAME).readlines():
if line.strip():
login, hash_value = line.strip().split(":", 1)
- if login == user and (not PERSONAL or user == entity.owner):
+ if login == user and (not entity.personal or user == entity.owner):
return CHECK_PASSWORD(hash_value, password)
return False
FILENAME = os.path.expanduser(config.get("acl", "filename"))
-PERSONAL = config.getboolean("acl", "personal")
CHECK_PASSWORD = locals()["_%s" % config.get("acl", "encryption")]
LOG = logging.getLogger()
SVC = config.get("acl", "pam_service")
-PERSONAL = config.getboolean("acl", "personal")
def has_right(entity, user, password):
"""Check if ``user``/``password`` couple is valid."""
LOG.debug("entity %s user %s", entity, user)
- if entity.owner and entity.owner != user and PERSONAL:
+ if entity.owner and entity.owner != user and entity.personal:
return False
def pam_conv(auth, query_list, userData):
result = []
owner = None # implement the interface for acls
+ def is_personal(self):
+ return True
+
class Principal(Resource):
def __init__(self, username):
self.username = username
return self.metadata.getboolean('collection', 'is-calendar')
except (ConfigParser.NoSectionError, ConfigParser.NoOptionError, ValueError):
return True
+
+ def is_personal(self):
+ try:
+ return self.metadata.getboolean('collection', 'personal')
+ except (ConfigParser.NoSectionError, ConfigParser.NoOptionError, ValueError):
+ return config.get('acl', 'personal')
# is-calendar.
is-addressbook = 0
+# Set this collection to personal, meaning that only its owner can access it.
+# Defaults to the personal setting in the Calypso configuration's acl section.
+personal = False
+
# vim:ft=cfg