Commit 533de5b9 authored by David Seaward's avatar David Seaward
Browse files

skeleton for ldap groups


Signed-off-by: David Seaward's avatarDavid Seaward <david.seaward@puri.sm>
parent 0ab0f254
Pipeline #5646 passed with stage
in 43 seconds
......@@ -31,10 +31,10 @@ class LdapGroup(ldapdb.models.Model):
members = ListField(db_column='member')
def __str__(self):
return self.name
return self.cn
def __unicode__(self):
return self.name
return self.cn
class LdapPerson(ldapdb.models.Model):
......
......@@ -120,9 +120,16 @@ def activate_single_limit(limit, credit_timedelta=None, renewal_date=None):
if limit.service == settings.LM_SERVICES.TUNNEL:
if not limit.user.has_tunnel_account():
limit.user.generate_tunnel_account()
elif limit.service == settings.LM_SERVICES.CHAT:
limit.user.set_ldap_group("chat")
elif limit.service == settings.LM_SERVICES.MAIL:
limit.user.set_ldap_group("mail")
elif limit.service == settings.LM_SERVICES.SOCIAL:
limit.user.set_ldap_group("social")
elif limit.service == settings.LM_SERVICES.XMPP:
limit.user.set_ldap_group("xmpp")
else:
# TODO: Add logic for other services types
pass
raise Exception("Invalid activation attempt. Service not recognised.")
limit.is_active = True
limit.user.chosenreward.is_pending = False
......
......@@ -2,6 +2,7 @@ import datetime
from .common import *
def parse_woosub1(json_entry):
subscription_id = str(json_entry["id"])
......
......@@ -219,8 +219,8 @@ LOGGING = {
# Captcha
#
CAPTCHA_FONT_SIZE=40
CAPTCHA_TIMEOUT = 15
CAPTCHA_FONT_SIZE = 40
CAPTCHA_TIMEOUT = 15
CAPTCHA_LENGTH = 4
CAPTCHA_TEST_MODE = True
CAPTCHA_CHALLENGE_FUNCT = 'captcha.helpers.math_challenge'
......
......@@ -30,6 +30,7 @@ class ServicesContainer(Container):
CHAT = 2
MAIL = 3
SOCIAL = 4
XMPP = 5
# MAPPING
MAP = OrderedDict([
......@@ -38,6 +39,7 @@ class ServicesContainer(Container):
(CHAT, _("Chat")),
(MAIL, _("Mail")),
(SOCIAL, _("Social")),
(XMPP, _("XMPP")),
])
......
......@@ -10,7 +10,7 @@ from django.utils import timezone
from django.utils.crypto import salted_hmac
from django.utils.deconstruct import deconstructible
from django.utils.translation import ugettext_lazy as _
from ldapregister.models import LdapPerson
from ldapregister.models import LdapPerson, LdapGroup
from limitmonitor import models as limitmonitor_models
from limitmonitor.task_resources import common as limitmonitor_common
from limitmonitor.tunnel import TunnelManager
......@@ -113,6 +113,12 @@ class User(AbstractUser):
ldap_person = self.get_ldap()
ldap_person.change_password(raw_password)
def set_ldap_group(self, group_id):
pass
def remove_ldap_group(self, group_id):
pass
def woo_get_json(self, query):
try:
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment