##// END OF EJS Templates
feat(hide recaptcha secrets): masked sensitive information related to reCaptcha configuration.
feat(hide recaptcha secrets): masked sensitive information related to reCaptcha configuration.

File last commit:

r5623:2f80d511 default
r5641:ad0048eb tip default
Show More
user.py
109 lines | 3.3 KiB | text/x-python | PythonLexer
core: updated copyright to 2024
r5608 # Copyright (C) 2016-2024 RhodeCode GmbH
dan
events: add event system for RepoEvents
r375 #
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License, version 3
# (only), as published by the Free Software Foundation.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
# This program is dual-licensed. If you wish to learn more about the
# RhodeCode Enterprise Edition, including its added features, Support services,
# and proprietary license terms, please see https://rhodecode.com/licenses/
events: make the System URL extraction safer....
r1424 import logging
dan
events: add event system for RepoEvents
r375
from zope.interface import implementer
dan
events: add serialization .to_dict() to events based on marshmallow
r379
dan
integrations: add integration support...
r411 from rhodecode.translation import lazy_ugettext
events: use a distinction between RhodeCodeEvent which is a base class and it used by all events, and...
r2921 from rhodecode.events.base import RhodecodeEvent, RhodeCodeIntegrationEvent
feat(events): added context into events so we can track additional context of calling it
r5623 from rhodecode.events.interfaces import IUserRegistered, IUserPreCreate, IUserPreUpdate
dan
events: add event system for RepoEvents
r375
events: make the System URL extraction safer....
r1424 log = logging.getLogger(__name__)
dan
events: add event system for RepoEvents
r375
@implementer(IUserRegistered)
events: use a distinction between RhodeCodeEvent which is a base class and it used by all events, and...
r2921 class UserRegistered(RhodeCodeIntegrationEvent):
dan
events: add event system for RepoEvents
r375 """
An instance of this class is emitted as an :term:`event` whenever a user
account is registered.
"""
feat(events): added context into events so we can track additional context of calling it
r5623
name = "user-register"
display_name = lazy_ugettext("user registered")
dan
integrations: add integration support...
r411
dan
events: add event system for RepoEvents
r375 def __init__(self, user, session):
modernize: updates for python3
r5095 super().__init__()
dan
events: add event system for RepoEvents
r375 self.user = user
self.session = session
@implementer(IUserPreCreate)
events: use a distinction between RhodeCodeEvent which is a base class and it used by all events, and...
r2921 class UserPreCreate(RhodeCodeIntegrationEvent):
dan
events: add event system for RepoEvents
r375 """
An instance of this class is emitted as an :term:`event` before a new user
object is created.
"""
feat(events): added context into events so we can track additional context of calling it
r5623
name = "user-pre-create"
display_name = lazy_ugettext("user pre create")
dan
integrations: add integration support...
r411
dan
events: add event system for RepoEvents
r375 def __init__(self, user_data):
modernize: updates for python3
r5095 super().__init__()
dan
events: add event system for RepoEvents
r375 self.user_data = user_data
repo-groups: implemented default personal repo groups logic....
r1094 @implementer(IUserPreCreate)
events: use a distinction between RhodeCodeEvent which is a base class and it used by all events, and...
r2921 class UserPostCreate(RhodeCodeIntegrationEvent):
repo-groups: implemented default personal repo groups logic....
r1094 """
An instance of this class is emitted as an :term:`event` after a new user
object is created.
"""
feat(events): added context into events so we can track additional context of calling it
r5623
name = "user-post-create"
display_name = lazy_ugettext("user post create")
repo-groups: implemented default personal repo groups logic....
r1094
def __init__(self, user_data):
modernize: updates for python3
r5095 super().__init__()
repo-groups: implemented default personal repo groups logic....
r1094 self.user_data = user_data
dan
events: add event system for RepoEvents
r375 @implementer(IUserPreUpdate)
events: use a distinction between RhodeCodeEvent which is a base class and it used by all events, and...
r2921 class UserPreUpdate(RhodeCodeIntegrationEvent):
dan
events: add event system for RepoEvents
r375 """
An instance of this class is emitted as an :term:`event` before a user
object is updated.
"""
feat(events): added context into events so we can track additional context of calling it
r5623
name = "user-pre-update"
display_name = lazy_ugettext("user pre update")
dan
integrations: add integration support...
r411
dan
events: add event system for RepoEvents
r375 def __init__(self, user, user_data):
modernize: updates for python3
r5095 super().__init__()
dan
events: add event system for RepoEvents
r375 self.user = user
self.user_data = user_data
events: add event to catch permission changed so we can flush affected users permission caches
r2849
class UserPermissionsChange(RhodecodeEvent):
"""
feat(events): added context into events so we can track additional context of calling it
r5623 This event should be triggered on an event that permissions of user might be changed.
Currently, this should be triggered on:
events: add event to catch permission changed so we can flush affected users permission caches
r2849
- user added/removed from user group
- repo permissions changed
- repo group permissions changed
- user group permissions changed
"""
feat(events): added context into events so we can track additional context of calling it
r5623
name = "user-permissions-change"
display_name = lazy_ugettext("user permissions change")
events: add event to catch permission changed so we can flush affected users permission caches
r2849
feat(events): added context into events so we can track additional context of calling it
r5623 def __init__(self, user_ids, context=None):
super().__init__(context=context)
events: add event to catch permission changed so we can flush affected users permission caches
r2849 self.user_ids = user_ids
feat(events): added context into events so we can track additional context of calling it
r5623 self.context = self._context