events: Send events when user is created or updated.
Send the UserPreCreate event before a new user is created. Send the UserPreUpdate event before a user is updated.
This commit is contained in:
parent
3cc0e271b6
commit
23ac9de853
1 changed files with 3 additions and 1 deletions
|
|
@ -26,13 +26,13 @@ import logging
|
|||
import traceback
|
||||
|
||||
import datetime
|
||||
from pylons import url
|
||||
from pylons.i18n.translation import _
|
||||
|
||||
import ipaddress
|
||||
from sqlalchemy.exc import DatabaseError
|
||||
from sqlalchemy.sql.expression import true, false
|
||||
|
||||
from rhodecode.events import UserPreCreate, UserPreUpdate
|
||||
from rhodecode.lib.utils2 import (
|
||||
safe_unicode, get_current_rhodecode_user, action_logger_generic,
|
||||
AttributeDict)
|
||||
|
|
@ -270,10 +270,12 @@ class UserModel(BaseModel):
|
|||
# raises UserCreationError if it's not allowed for any reason to
|
||||
# create new active user, this also executes pre-create hooks
|
||||
check_allowed_create_user(user_data, cur_user, strict_check=True)
|
||||
self.send_event(UserPreCreate(user_data))
|
||||
new_user = User()
|
||||
edit = False
|
||||
else:
|
||||
log.debug('updating user %s', username)
|
||||
self.send_event(UserPreUpdate(user, user_data))
|
||||
new_user = user
|
||||
edit = True
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue