##// END OF EJS Templates
events: Add user data to UserPreCreate und UserPreUpdate events.
johbo -
r228:d4ffc03c default
parent child Browse files
Show More
@@ -1,53 +1,53 b''
1 # Copyright (C) 2016-2016 RhodeCode GmbH
1 # Copyright (C) 2016-2016 RhodeCode GmbH
2 #
2 #
3 # This program is free software: you can redistribute it and/or modify
3 # This program is free software: you can redistribute it and/or modify
4 # it under the terms of the GNU Affero General Public License, version 3
4 # it under the terms of the GNU Affero General Public License, version 3
5 # (only), as published by the Free Software Foundation.
5 # (only), as published by the Free Software Foundation.
6 #
6 #
7 # This program is distributed in the hope that it will be useful,
7 # This program is distributed in the hope that it will be useful,
8 # but WITHOUT ANY WARRANTY; without even the implied warranty of
8 # but WITHOUT ANY WARRANTY; without even the implied warranty of
9 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
9 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10 # GNU General Public License for more details.
10 # GNU General Public License for more details.
11 #
11 #
12 # You should have received a copy of the GNU Affero General Public License
12 # You should have received a copy of the GNU Affero General Public License
13 # along with this program. If not, see <http://www.gnu.org/licenses/>.
13 # along with this program. If not, see <http://www.gnu.org/licenses/>.
14 #
14 #
15 # This program is dual-licensed. If you wish to learn more about the
15 # This program is dual-licensed. If you wish to learn more about the
16 # RhodeCode Enterprise Edition, including its added features, Support services,
16 # RhodeCode Enterprise Edition, including its added features, Support services,
17 # and proprietary license terms, please see https://rhodecode.com/licenses/
17 # and proprietary license terms, please see https://rhodecode.com/licenses/
18
18
19 from zope.interface import implementer
19 from zope.interface import implementer
20 from rhodecode.interfaces import (
20 from rhodecode.interfaces import (
21 IUserRegistered, IUserPreCreate, IUserPreUpdate)
21 IUserRegistered, IUserPreCreate, IUserPreUpdate)
22
22
23
23
24 @implementer(IUserRegistered)
24 @implementer(IUserRegistered)
25 class UserRegistered(object):
25 class UserRegistered(object):
26 """
26 """
27 An instance of this class is emitted as an :term:`event` whenever a user
27 An instance of this class is emitted as an :term:`event` whenever a user
28 account is registered.
28 account is registered.
29 """
29 """
30 def __init__(self, user, session):
30 def __init__(self, user, session):
31 self.user = user
31 self.user = user
32 self.session = session
32 self.session = session
33
33
34
34
35 @implementer(IUserPreCreate)
35 @implementer(IUserPreCreate)
36 class UserPreCreate(object):
36 class UserPreCreate(object):
37 """
37 """
38 An instance of this class is emitted as an :term:`event` before a new user
38 An instance of this class is emitted as an :term:`event` before a new user
39 object is created.
39 object is created.
40 """
40 """
41 def __init__(self, active):
41 def __init__(self, user_data):
42 self.active = active
42 self.user_data = user_data
43
43
44
44
45 @implementer(IUserPreUpdate)
45 @implementer(IUserPreUpdate)
46 class UserPreUpdate(object):
46 class UserPreUpdate(object):
47 """
47 """
48 An instance of this class is emitted as an :term:`event` before a user
48 An instance of this class is emitted as an :term:`event` before a user
49 object is updated.
49 object is updated.
50 """
50 """
51 def __init__(self, user, active):
51 def __init__(self, user, user_data):
52 self.user = user
52 self.user = user
53 self.active = active
53 self.user_data = user_data
@@ -1,43 +1,43 b''
1 # Copyright (C) 2016-2016 RhodeCode GmbH
1 # Copyright (C) 2016-2016 RhodeCode GmbH
2 #
2 #
3 # This program is free software: you can redistribute it and/or modify
3 # This program is free software: you can redistribute it and/or modify
4 # it under the terms of the GNU Affero General Public License, version 3
4 # it under the terms of the GNU Affero General Public License, version 3
5 # (only), as published by the Free Software Foundation.
5 # (only), as published by the Free Software Foundation.
6 #
6 #
7 # This program is distributed in the hope that it will be useful,
7 # This program is distributed in the hope that it will be useful,
8 # but WITHOUT ANY WARRANTY; without even the implied warranty of
8 # but WITHOUT ANY WARRANTY; without even the implied warranty of
9 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
9 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10 # GNU General Public License for more details.
10 # GNU General Public License for more details.
11 #
11 #
12 # You should have received a copy of the GNU Affero General Public License
12 # You should have received a copy of the GNU Affero General Public License
13 # along with this program. If not, see <http://www.gnu.org/licenses/>.
13 # along with this program. If not, see <http://www.gnu.org/licenses/>.
14 #
14 #
15 # This program is dual-licensed. If you wish to learn more about the
15 # This program is dual-licensed. If you wish to learn more about the
16 # RhodeCode Enterprise Edition, including its added features, Support services,
16 # RhodeCode Enterprise Edition, including its added features, Support services,
17 # and proprietary license terms, please see https://rhodecode.com/licenses/
17 # and proprietary license terms, please see https://rhodecode.com/licenses/
18
18
19 from zope.interface import Attribute, Interface
19 from zope.interface import Attribute, Interface
20
20
21
21
22 class IUserRegistered(Interface):
22 class IUserRegistered(Interface):
23 """
23 """
24 An event type that is emitted whenever a new user registers a user
24 An event type that is emitted whenever a new user registers a user
25 account.
25 account.
26 """
26 """
27 user = Attribute('The user object.')
27 user = Attribute('The user object.')
28 session = Attribute('The session while processing the register form post.')
28 session = Attribute('The session while processing the register form post.')
29
29
30
30
31 class IUserPreCreate(Interface):
31 class IUserPreCreate(Interface):
32 """
32 """
33 An event type that is emitted before a new user object is persisted.
33 An event type that is emitted before a new user object is created.
34 """
34 """
35 active = Attribute('Value for user.active')
35 user_data = Attribute('Data used to create the new user')
36
36
37
37
38 class IUserPreUpdate(Interface):
38 class IUserPreUpdate(Interface):
39 """
39 """
40 An event type that is emitted before a user object is updated.
40 An event type that is emitted before a user object is updated.
41 """
41 """
42 user = Attribute('The not yet updated user object')
42 user = Attribute('The not yet updated user object')
43 active = Attribute('New value for user.active')
43 user_data = Attribute('Data used to update the user')
General Comments 0
You need to be logged in to leave comments. Login now