Revision 21e0fdad
b/snf-astakos-app/astakos/im/functions.py | ||
---|---|---|
72 | 72 |
membership_change_notify, |
73 | 73 |
application_submit_notify, application_approve_notify, |
74 | 74 |
project_termination_notify, project_suspension_notify) |
75 |
from astakos.im.endpoints.qh import qh_register_user |
|
75 | 76 |
|
76 | 77 |
import astakos.im.messages as astakos_messages |
77 | 78 |
|
... | ... | |
297 | 298 |
if not user.activation_sent: |
298 | 299 |
user.activation_sent = datetime.now() |
299 | 300 |
user.save() |
301 |
qh_register_user(user) |
|
300 | 302 |
send_helpdesk_notification(user, helpdesk_email_template_name) |
301 | 303 |
send_greeting(user, email_template_name) |
302 | 304 |
|
305 |
def deactivate(user): |
|
306 |
user.is_active = False |
|
307 |
user.save() |
|
308 |
|
|
303 | 309 |
def invite(inviter, email, realname): |
304 | 310 |
inv = Invitation(inviter=inviter, username=email, realname=realname) |
305 | 311 |
inv.save() |
b/snf-astakos-app/astakos/im/management/commands/user-update.py | ||
---|---|---|
39 | 39 |
from django.core.exceptions import ValidationError |
40 | 40 |
|
41 | 41 |
from astakos.im.models import AstakosUser |
42 |
from astakos.im.functions import activate, deactivate |
|
42 | 43 |
from ._common import remove_user_permission, add_user_permission |
43 | 44 |
|
44 | 45 |
|
... | ... | |
83 | 84 |
action='store_true', |
84 | 85 |
dest='active', |
85 | 86 |
default=False, |
86 |
help="Change user's state to inactive"),
|
|
87 |
help="Change user's state to active"), |
|
87 | 88 |
make_option('--set-inactive', |
88 | 89 |
action='store_true', |
89 | 90 |
dest='inactive', |
... | ... | |
121 | 122 |
user.is_superuser = False |
122 | 123 |
|
123 | 124 |
if options.get('active'): |
124 |
user.is_active = True |
|
125 |
if not user.email_verified: |
|
126 |
user.email_verified = True |
|
127 |
if not user.activation_sent: |
|
128 |
user.activation_sent = datetime.now() |
|
125 |
activate(user) |
|
129 | 126 |
elif options.get('inactive'): |
130 |
user.is_active = False
|
|
127 |
deactivate(user)
|
|
131 | 128 |
|
132 | 129 |
invitations = options.get('invitations') |
133 | 130 |
if invitations is not None: |
b/snf-astakos-app/astakos/im/models.py | ||
---|---|---|
70 | 70 |
SITENAME, SERVICES, MODERATION_ENABLED, RESOURCES_PRESENTATION_DATA) |
71 | 71 |
from astakos.im import settings as astakos_settings |
72 | 72 |
from astakos.im.endpoints.qh import ( |
73 |
register_users, register_resources, qh_add_quota, QuotaLimits,
|
|
73 |
register_resources, qh_add_quota, QuotaLimits, |
|
74 | 74 |
qh_query_serials, qh_ack_serials) |
75 | 75 |
from astakos.im import auth_providers |
76 | 76 |
|
... | ... | |
1962 | 1962 |
post_save.connect(user_post_save, sender=User) |
1963 | 1963 |
|
1964 | 1964 |
def astakosuser_post_save(sender, instance, created, **kwargs): |
1965 |
if not created: |
|
1966 |
return |
|
1967 |
# TODO handle socket.error & IOError |
|
1968 |
register_users((instance,)) |
|
1965 |
pass |
|
1966 |
|
|
1969 | 1967 |
post_save.connect(astakosuser_post_save, sender=AstakosUser) |
1970 | 1968 |
|
1971 | 1969 |
def resource_post_save(sender, instance, created, **kwargs): |
Also available in: Unified diff