Revision 9770ba6c snf-astakos-app/astakos/im/management/commands/user-update.py
b/snf-astakos-app/astakos/im/management/commands/user-update.py | ||
---|---|---|
40 | 40 |
from django.core.exceptions import ValidationError |
41 | 41 |
|
42 | 42 |
from astakos.im.models import AstakosUser |
43 |
from astakos.im.functions import (activate, deactivate, |
|
44 |
set_pending_application_limit, |
|
45 |
unset_pending_application_limit) |
|
43 |
from astakos.im.functions import (activate, deactivate) |
|
46 | 44 |
from ._common import remove_user_permission, add_user_permission |
47 | 45 |
from snf_django.lib.db.transaction import commit_on_success_strict |
48 | 46 |
|
... | ... | |
106 | 104 |
make_option('--delete-permission', |
107 | 105 |
dest='delete-permission', |
108 | 106 |
help="Delete user permission"), |
109 |
make_option('--max-pending-projects', |
|
110 |
dest='pending', |
|
111 |
metavar='INT', |
|
112 |
help=("Set limit on user's maximum pending " |
|
113 |
"project applications")), |
|
114 |
make_option('--reset-max-pending-projects', |
|
115 |
dest='unset_pending', |
|
116 |
action='store_true', |
|
117 |
default=False, |
|
118 |
help=("Restore default limit of user's maximum pending " |
|
119 |
"project applications")), |
|
120 | 107 |
) |
121 | 108 |
|
122 | 109 |
@commit_on_success_strict() |
... | ... | |
219 | 206 |
|
220 | 207 |
if password: |
221 | 208 |
self.stdout.write('User\'s new password: %s\n' % password) |
222 |
|
|
223 |
pending = options.get('pending') |
|
224 |
if pending: |
|
225 |
try: |
|
226 |
pending = int(pending) |
|
227 |
except ValueError as e: |
|
228 |
m = _("Expected integer argument") |
|
229 |
raise CommandError(m) |
|
230 |
else: |
|
231 |
set_pending_application_limit(user_id, pending) |
|
232 |
|
|
233 |
unset_pending = options.get('unset_pending') |
|
234 |
if unset_pending: |
|
235 |
unset_pending_application_limit(user_id) |
Also available in: Unified diff