Show More
@@ -30,7 +30,7 b' account permissions.' | |||||
30 | # Use this example to change user permissions |
|
30 | # Use this example to change user permissions | |
31 | In [1]: adminuser = User.get_by_username('username') |
|
31 | In [1]: adminuser = User.get_by_username('username') | |
32 | In [2]: adminuser.admin = True |
|
32 | In [2]: adminuser.admin = True | |
33 | In [3]: Session.add(adminuser);Session().commit() |
|
33 | In [3]: Session().add(adminuser);Session().commit() | |
34 | In [4]: exit() |
|
34 | In [4]: exit() | |
35 |
|
35 | |||
36 | Set to read global ``.hgrc`` file |
|
36 | Set to read global ``.hgrc`` file |
@@ -265,7 +265,7 b' def merge_pull_request(request, apiuser,' | |||||
265 | PullRequestModel().close_pull_request( |
|
265 | PullRequestModel().close_pull_request( | |
266 | pull_request.pull_request_id, apiuser) |
|
266 | pull_request.pull_request_id, apiuser) | |
267 |
|
267 | |||
268 | Session.commit() |
|
268 | Session().commit() | |
269 | return data |
|
269 | return data | |
270 |
|
270 | |||
271 |
|
271 | |||
@@ -319,7 +319,7 b' def close_pull_request(request, apiuser,' | |||||
319 |
|
319 | |||
320 | PullRequestModel().close_pull_request( |
|
320 | PullRequestModel().close_pull_request( | |
321 | pull_request.pull_request_id, apiuser) |
|
321 | pull_request.pull_request_id, apiuser) | |
322 | Session.commit() |
|
322 | Session().commit() | |
323 | data = { |
|
323 | data = { | |
324 | 'pull_request_id': pull_request.pull_request_id, |
|
324 | 'pull_request_id': pull_request.pull_request_id, | |
325 | 'closed': True, |
|
325 | 'closed': True, |
@@ -96,7 +96,7 b' class AuthnPluginViewBase(object):' | |||||
96 | # Store validated data. |
|
96 | # Store validated data. | |
97 | for name, value in valid_data.items(): |
|
97 | for name, value in valid_data.items(): | |
98 | self.plugin.create_or_update_setting(name, value) |
|
98 | self.plugin.create_or_update_setting(name, value) | |
99 | Session.commit() |
|
99 | Session().commit() | |
100 |
|
100 | |||
101 | # Display success message and redirect. |
|
101 | # Display success message and redirect. | |
102 | self.request.session.flash( |
|
102 | self.request.session.flash( |
@@ -244,7 +244,7 b' class JournalController(BaseController):' | |||||
244 | try: |
|
244 | try: | |
245 | self.scm_model.toggle_following_user( |
|
245 | self.scm_model.toggle_following_user( | |
246 | user_id, c.rhodecode_user.user_id) |
|
246 | user_id, c.rhodecode_user.user_id) | |
247 | Session.commit() |
|
247 | Session().commit() | |
248 | return 'ok' |
|
248 | return 'ok' | |
249 | except Exception: |
|
249 | except Exception: | |
250 | raise HTTPBadRequest() |
|
250 | raise HTTPBadRequest() | |
@@ -254,7 +254,7 b' class JournalController(BaseController):' | |||||
254 | try: |
|
254 | try: | |
255 | self.scm_model.toggle_following_repo( |
|
255 | self.scm_model.toggle_following_repo( | |
256 | repo_id, c.rhodecode_user.user_id) |
|
256 | repo_id, c.rhodecode_user.user_id) | |
257 | Session.commit() |
|
257 | Session().commit() | |
258 | return 'ok' |
|
258 | return 'ok' | |
259 | except Exception: |
|
259 | except Exception: | |
260 | raise HTTPBadRequest() |
|
260 | raise HTTPBadRequest() |
@@ -198,7 +198,7 b' class SettingsModel(BaseModel):' | |||||
198 | # update if set |
|
198 | # update if set | |
199 | res.app_settings_value = val |
|
199 | res.app_settings_value = val | |
200 |
|
200 | |||
201 | Session.add(res) |
|
201 | Session().add(res) | |
202 | return res |
|
202 | return res | |
203 |
|
203 | |||
204 | def invalidate_settings_cache(self): |
|
204 | def invalidate_settings_cache(self): |
@@ -67,7 +67,7 b' class TestAuthSettingsController(object)' | |||||
67 | for _plugin in _enabled_plugins: |
|
67 | for _plugin in _enabled_plugins: | |
68 | db_plugin = SettingsModel().get_setting_by_name(_plugin) |
|
68 | db_plugin = SettingsModel().get_setting_by_name(_plugin) | |
69 | if db_plugin: |
|
69 | if db_plugin: | |
70 | Session.delete(db_plugin) |
|
70 | Session().delete(db_plugin) | |
71 | Session().commit() |
|
71 | Session().commit() | |
72 |
|
72 | |||
73 | response = self.app.post(url=test_url, params=params) |
|
73 | response = self.app.post(url=test_url, params=params) |
@@ -1189,8 +1189,8 b' class UserUtility(object):' | |||||
1189 | def _inherit_default_user_permissions(self, user_name, value): |
|
1189 | def _inherit_default_user_permissions(self, user_name, value): | |
1190 | user = UserModel().get_by_username(user_name) |
|
1190 | user = UserModel().get_by_username(user_name) | |
1191 | user.inherit_default_permissions = value |
|
1191 | user.inherit_default_permissions = value | |
1192 | Session.add(user) |
|
1192 | Session().add(user) | |
1193 | Session.commit() |
|
1193 | Session().commit() | |
1194 |
|
1194 | |||
1195 | def cleanup(self): |
|
1195 | def cleanup(self): | |
1196 | self._cleanup_permissions() |
|
1196 | self._cleanup_permissions() |
General Comments 0
You need to be logged in to leave comments.
Login now