rucio 37.1.0.post1__py3-none-any.whl → 37.3.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of rucio might be problematic. Click here for more details.

Files changed (106) hide show
  1. rucio/common/plugins.py +1 -1
  2. rucio/common/utils.py +17 -10
  3. rucio/core/did.py +32 -4
  4. rucio/core/did_meta_plugins/did_column_meta.py +1 -1
  5. rucio/core/replica.py +1 -1
  6. rucio/db/sqla/util.py +1 -1
  7. rucio/gateway/authentication.py +58 -88
  8. rucio/gateway/config.py +63 -75
  9. rucio/gateway/credential.py +11 -17
  10. rucio/gateway/did.py +245 -329
  11. rucio/gateway/dirac.py +33 -34
  12. rucio/gateway/exporter.py +27 -30
  13. rucio/gateway/heartbeat.py +15 -19
  14. rucio/gateway/importer.py +12 -14
  15. rucio/gateway/lifetime_exception.py +16 -24
  16. rucio/gateway/lock.py +27 -40
  17. rucio/gateway/meta_conventions.py +19 -28
  18. rucio/gateway/quarantined_replica.py +24 -27
  19. rucio/gateway/replica.py +223 -226
  20. rucio/gateway/rse.py +191 -218
  21. rucio/gateway/rule.py +115 -146
  22. rucio/gateway/scope.py +18 -25
  23. rucio/gateway/trace.py +48 -0
  24. rucio/gateway/vo.py +32 -37
  25. rucio/vcsversion.py +3 -3
  26. rucio/web/rest/flaskapi/v1/accounts.py +2 -2
  27. rucio/web/rest/flaskapi/v1/auth.py +15 -0
  28. rucio/web/rest/flaskapi/v1/common.py +20 -0
  29. rucio/web/rest/flaskapi/v1/config.py +7 -7
  30. rucio/web/rest/flaskapi/v1/credentials.py +20 -13
  31. rucio/web/rest/flaskapi/v1/dids.py +55 -55
  32. rucio/web/rest/flaskapi/v1/dirac.py +2 -2
  33. rucio/web/rest/flaskapi/v1/export.py +1 -1
  34. rucio/web/rest/flaskapi/v1/heartbeats.py +3 -3
  35. rucio/web/rest/flaskapi/v1/import.py +1 -1
  36. rucio/web/rest/flaskapi/v1/lifetime_exceptions.py +5 -5
  37. rucio/web/rest/flaskapi/v1/locks.py +4 -4
  38. rucio/web/rest/flaskapi/v1/main.py +17 -10
  39. rucio/web/rest/flaskapi/v1/meta_conventions.py +3 -3
  40. rucio/web/rest/flaskapi/v1/replicas.py +31 -30
  41. rucio/web/rest/flaskapi/v1/rses.py +37 -37
  42. rucio/web/rest/flaskapi/v1/rules.py +15 -15
  43. rucio/web/rest/flaskapi/v1/scopes.py +3 -3
  44. rucio/web/rest/flaskapi/v1/traces.py +75 -77
  45. rucio/web/rest/flaskapi/v1/vos.py +5 -7
  46. {rucio-37.1.0.post1.dist-info → rucio-37.3.0.dist-info}/METADATA +1 -2
  47. {rucio-37.1.0.post1.dist-info → rucio-37.3.0.dist-info}/RECORD +106 -105
  48. {rucio-37.1.0.post1.dist-info → rucio-37.3.0.dist-info}/WHEEL +1 -1
  49. {rucio-37.1.0.post1.data → rucio-37.3.0.data}/data/rucio/etc/alembic.ini.template +0 -0
  50. {rucio-37.1.0.post1.data → rucio-37.3.0.data}/data/rucio/etc/alembic_offline.ini.template +0 -0
  51. {rucio-37.1.0.post1.data → rucio-37.3.0.data}/data/rucio/etc/globus-config.yml.template +0 -0
  52. {rucio-37.1.0.post1.data → rucio-37.3.0.data}/data/rucio/etc/ldap.cfg.template +0 -0
  53. {rucio-37.1.0.post1.data → rucio-37.3.0.data}/data/rucio/etc/mail_templates/rule_approval_request.tmpl +0 -0
  54. {rucio-37.1.0.post1.data → rucio-37.3.0.data}/data/rucio/etc/mail_templates/rule_approved_admin.tmpl +0 -0
  55. {rucio-37.1.0.post1.data → rucio-37.3.0.data}/data/rucio/etc/mail_templates/rule_approved_user.tmpl +0 -0
  56. {rucio-37.1.0.post1.data → rucio-37.3.0.data}/data/rucio/etc/mail_templates/rule_denied_admin.tmpl +0 -0
  57. {rucio-37.1.0.post1.data → rucio-37.3.0.data}/data/rucio/etc/mail_templates/rule_denied_user.tmpl +0 -0
  58. {rucio-37.1.0.post1.data → rucio-37.3.0.data}/data/rucio/etc/mail_templates/rule_ok_notification.tmpl +0 -0
  59. {rucio-37.1.0.post1.data → rucio-37.3.0.data}/data/rucio/etc/rse-accounts.cfg.template +0 -0
  60. {rucio-37.1.0.post1.data → rucio-37.3.0.data}/data/rucio/etc/rucio.cfg.atlas.client.template +0 -0
  61. {rucio-37.1.0.post1.data → rucio-37.3.0.data}/data/rucio/etc/rucio.cfg.template +0 -0
  62. {rucio-37.1.0.post1.data → rucio-37.3.0.data}/data/rucio/etc/rucio_multi_vo.cfg.template +0 -0
  63. {rucio-37.1.0.post1.data → rucio-37.3.0.data}/data/rucio/requirements.server.txt +0 -0
  64. {rucio-37.1.0.post1.data → rucio-37.3.0.data}/data/rucio/tools/bootstrap.py +0 -0
  65. {rucio-37.1.0.post1.data → rucio-37.3.0.data}/data/rucio/tools/merge_rucio_configs.py +0 -0
  66. {rucio-37.1.0.post1.data → rucio-37.3.0.data}/data/rucio/tools/reset_database.py +0 -0
  67. {rucio-37.1.0.post1.data → rucio-37.3.0.data}/scripts/rucio +0 -0
  68. {rucio-37.1.0.post1.data → rucio-37.3.0.data}/scripts/rucio-abacus-account +0 -0
  69. {rucio-37.1.0.post1.data → rucio-37.3.0.data}/scripts/rucio-abacus-collection-replica +0 -0
  70. {rucio-37.1.0.post1.data → rucio-37.3.0.data}/scripts/rucio-abacus-rse +0 -0
  71. {rucio-37.1.0.post1.data → rucio-37.3.0.data}/scripts/rucio-admin +0 -0
  72. {rucio-37.1.0.post1.data → rucio-37.3.0.data}/scripts/rucio-atropos +0 -0
  73. {rucio-37.1.0.post1.data → rucio-37.3.0.data}/scripts/rucio-auditor +0 -0
  74. {rucio-37.1.0.post1.data → rucio-37.3.0.data}/scripts/rucio-automatix +0 -0
  75. {rucio-37.1.0.post1.data → rucio-37.3.0.data}/scripts/rucio-bb8 +0 -0
  76. {rucio-37.1.0.post1.data → rucio-37.3.0.data}/scripts/rucio-cache-client +0 -0
  77. {rucio-37.1.0.post1.data → rucio-37.3.0.data}/scripts/rucio-cache-consumer +0 -0
  78. {rucio-37.1.0.post1.data → rucio-37.3.0.data}/scripts/rucio-conveyor-finisher +0 -0
  79. {rucio-37.1.0.post1.data → rucio-37.3.0.data}/scripts/rucio-conveyor-poller +0 -0
  80. {rucio-37.1.0.post1.data → rucio-37.3.0.data}/scripts/rucio-conveyor-preparer +0 -0
  81. {rucio-37.1.0.post1.data → rucio-37.3.0.data}/scripts/rucio-conveyor-receiver +0 -0
  82. {rucio-37.1.0.post1.data → rucio-37.3.0.data}/scripts/rucio-conveyor-stager +0 -0
  83. {rucio-37.1.0.post1.data → rucio-37.3.0.data}/scripts/rucio-conveyor-submitter +0 -0
  84. {rucio-37.1.0.post1.data → rucio-37.3.0.data}/scripts/rucio-conveyor-throttler +0 -0
  85. {rucio-37.1.0.post1.data → rucio-37.3.0.data}/scripts/rucio-dark-reaper +0 -0
  86. {rucio-37.1.0.post1.data → rucio-37.3.0.data}/scripts/rucio-dumper +0 -0
  87. {rucio-37.1.0.post1.data → rucio-37.3.0.data}/scripts/rucio-follower +0 -0
  88. {rucio-37.1.0.post1.data → rucio-37.3.0.data}/scripts/rucio-hermes +0 -0
  89. {rucio-37.1.0.post1.data → rucio-37.3.0.data}/scripts/rucio-judge-cleaner +0 -0
  90. {rucio-37.1.0.post1.data → rucio-37.3.0.data}/scripts/rucio-judge-evaluator +0 -0
  91. {rucio-37.1.0.post1.data → rucio-37.3.0.data}/scripts/rucio-judge-injector +0 -0
  92. {rucio-37.1.0.post1.data → rucio-37.3.0.data}/scripts/rucio-judge-repairer +0 -0
  93. {rucio-37.1.0.post1.data → rucio-37.3.0.data}/scripts/rucio-kronos +0 -0
  94. {rucio-37.1.0.post1.data → rucio-37.3.0.data}/scripts/rucio-minos +0 -0
  95. {rucio-37.1.0.post1.data → rucio-37.3.0.data}/scripts/rucio-minos-temporary-expiration +0 -0
  96. {rucio-37.1.0.post1.data → rucio-37.3.0.data}/scripts/rucio-necromancer +0 -0
  97. {rucio-37.1.0.post1.data → rucio-37.3.0.data}/scripts/rucio-oauth-manager +0 -0
  98. {rucio-37.1.0.post1.data → rucio-37.3.0.data}/scripts/rucio-reaper +0 -0
  99. {rucio-37.1.0.post1.data → rucio-37.3.0.data}/scripts/rucio-replica-recoverer +0 -0
  100. {rucio-37.1.0.post1.data → rucio-37.3.0.data}/scripts/rucio-rse-decommissioner +0 -0
  101. {rucio-37.1.0.post1.data → rucio-37.3.0.data}/scripts/rucio-storage-consistency-actions +0 -0
  102. {rucio-37.1.0.post1.data → rucio-37.3.0.data}/scripts/rucio-transmogrifier +0 -0
  103. {rucio-37.1.0.post1.data → rucio-37.3.0.data}/scripts/rucio-undertaker +0 -0
  104. {rucio-37.1.0.post1.dist-info → rucio-37.3.0.dist-info}/licenses/AUTHORS.rst +0 -0
  105. {rucio-37.1.0.post1.dist-info → rucio-37.3.0.dist-info}/licenses/LICENSE +0 -0
  106. {rucio-37.1.0.post1.dist-info → rucio-37.3.0.dist-info}/top_level.txt +0 -0
rucio/gateway/config.py CHANGED
@@ -12,17 +12,15 @@
12
12
  # See the License for the specific language governing permissions and
13
13
  # limitations under the License.
14
14
 
15
- from typing import TYPE_CHECKING, Any, Optional
15
+ from typing import Any
16
16
 
17
17
  from rucio.common import exception
18
18
  from rucio.common.config import convert_to_any_type
19
19
  from rucio.core import config
20
- from rucio.db.sqla.session import read_session, transactional_session
20
+ from rucio.db.sqla.constants import DatabaseOperationType
21
+ from rucio.db.sqla.session import db_session
21
22
  from rucio.gateway import permission
22
23
 
23
- if TYPE_CHECKING:
24
- from sqlalchemy.orm import Session
25
-
26
24
  """
27
25
  ConfigParser compatible interface.
28
26
 
@@ -31,82 +29,77 @@ ConfigParser compatible interface.
31
29
  """
32
30
 
33
31
 
34
- @read_session
35
- def sections(issuer: Optional[str] = None, vo: str = 'def', *, session: "Session") -> list[str]:
32
+ def sections(issuer: str, vo: str = 'def') -> list[str]:
36
33
  """
37
34
  Return a list of the sections available.
38
35
 
39
36
  :param issuer: The issuer account.
40
37
  :param vo: The VO to act on.
41
- :param session: The database session in use.
42
38
  :returns: ['section_name', ...]
43
39
  """
44
40
 
45
41
  kwargs = {'issuer': issuer}
46
- auth_result = permission.has_permission(issuer=issuer, vo=vo, action='config_sections', kwargs=kwargs, session=session)
47
- if not auth_result.allowed:
48
- raise exception.AccessDenied('%s cannot retrieve sections. %s' % (issuer, auth_result.message))
49
- return config.sections(session=session)
42
+ with db_session(DatabaseOperationType.READ) as session:
43
+ auth_result = permission.has_permission(issuer=issuer, vo=vo, action='config_sections', kwargs=kwargs, session=session)
44
+ if not auth_result.allowed:
45
+ raise exception.AccessDenied('%s cannot retrieve sections. %s' % (issuer, auth_result.message))
46
+ return config.sections(session=session)
50
47
 
51
48
 
52
- @transactional_session
53
- def add_section(section: str, issuer: Optional[str] = None, vo: str = 'def', *, session: "Session") -> None:
49
+ def add_section(section: str, issuer: str, vo: str = 'def') -> None:
54
50
  """
55
51
  Add a section to the configuration.
56
52
 
57
53
  :param section: The name of the section.
58
54
  :param issuer: The issuer account.
59
- :param session: The database session in use.
60
55
  :param vo: The VO to act on.
61
56
  """
62
57
 
63
58
  kwargs = {'issuer': issuer, 'section': section}
64
- auth_result = permission.has_permission(issuer=issuer, vo=vo, action='config_add_section', kwargs=kwargs, session=session)
65
- if not auth_result.allowed:
66
- raise exception.AccessDenied('%s cannot add section %s. %s' % (issuer, section, auth_result.message))
67
- return config.add_section(section, session=session)
59
+ with db_session(DatabaseOperationType.WRITE) as session:
60
+ auth_result = permission.has_permission(issuer=issuer, vo=vo, action='config_add_section', kwargs=kwargs, session=session)
61
+ if not auth_result.allowed:
62
+ raise exception.AccessDenied('%s cannot add section %s. %s' % (issuer, section, auth_result.message))
63
+ return config.add_section(section, session=session)
68
64
 
69
65
 
70
- @read_session
71
- def has_section(section: str, issuer: Optional[str] = None, vo: str = 'def', *, session: "Session") -> bool:
66
+ def has_section(section: str, issuer: str, vo: str = 'def') -> bool:
72
67
  """
73
68
  Indicates whether the named section is present in the configuration.
74
69
 
75
70
  :param section: The name of the section.
76
71
  :param issuer: The issuer account.
77
72
  :param vo: The VO to act on.
78
- :param session: The database session in use.
79
73
  :returns: True/False
80
74
  """
81
75
 
82
76
  kwargs = {'issuer': issuer, 'section': section}
83
- auth_result = permission.has_permission(issuer=issuer, vo=vo, action='config_has_section', kwargs=kwargs, session=session)
84
- if not auth_result.allowed:
85
- raise exception.AccessDenied('%s cannot check existence of section %s. %s' % (issuer, section, auth_result.message))
86
- return config.has_section(section, session=session)
77
+ with db_session(DatabaseOperationType.READ) as session:
78
+ auth_result = permission.has_permission(issuer=issuer, vo=vo, action='config_has_section', kwargs=kwargs, session=session)
79
+ if not auth_result.allowed:
80
+ raise exception.AccessDenied('%s cannot check existence of section %s. %s' % (issuer, section, auth_result.message))
81
+ return config.has_section(section, session=session)
87
82
 
88
83
 
89
- @read_session
90
- def options(section: str, issuer: Optional[str] = None, vo: str = 'def', *, session: "Session") -> list[str]:
84
+ def options(section: str, issuer: str, vo: str = 'def') -> list[str]:
91
85
  """
92
86
  Returns a list of options available in the specified section.
93
87
 
94
88
  :param section: The name of the section.
95
89
  :param issuer: The issuer account.
96
90
  :param vo: The VO to act on.
97
- :param session: The database session in use.
98
91
  :returns: ['option', ...]
99
92
  """
100
93
 
101
94
  kwargs = {'issuer': issuer, 'section': section}
102
- auth_result = permission.has_permission(issuer=issuer, vo=vo, action='config_options', kwargs=kwargs, session=session)
103
- if auth_result.allowed:
104
- raise exception.AccessDenied('%s cannot retrieve options from section %s. %s' % (issuer, section, auth_result.message))
105
- return config.options(section, session=session)
95
+ with db_session(DatabaseOperationType.READ) as session:
96
+ auth_result = permission.has_permission(issuer=issuer, vo=vo, action='config_options', kwargs=kwargs, session=session)
97
+ if auth_result.allowed:
98
+ raise exception.AccessDenied('%s cannot retrieve options from section %s. %s' % (issuer, section, auth_result.message))
99
+ return config.options(section, session=session)
106
100
 
107
101
 
108
- @read_session
109
- def has_option(section: str, option: str, issuer: Optional[str] = None, vo: str = 'def', *, session: "Session") -> bool:
102
+ def has_option(section: str, option: str, issuer: str, vo: str = 'def') -> bool:
110
103
  """
111
104
  Check if the given section exists and contains the given option.
112
105
 
@@ -114,19 +107,18 @@ def has_option(section: str, option: str, issuer: Optional[str] = None, vo: str
114
107
  :param option: The name of the option.
115
108
  :param issuer: The issuer account.
116
109
  :param vo: The VO to act on.
117
- :param session: The database session in use.
118
110
  :returns: True/False
119
111
  """
120
112
 
121
113
  kwargs = {'issuer': issuer, 'section': section, 'option': option}
122
- auth_result = permission.has_permission(issuer=issuer, vo=vo, action='config_has_option', kwargs=kwargs, session=session)
123
- if not auth_result.allowed:
124
- raise exception.AccessDenied('%s cannot check existence of option %s from section %s. %s' % (issuer, option, section, auth_result.message))
125
- return config.has_option(section, option, session=session)
114
+ with db_session(DatabaseOperationType.READ) as session:
115
+ auth_result = permission.has_permission(issuer=issuer, vo=vo, action='config_has_option', kwargs=kwargs, session=session)
116
+ if not auth_result.allowed:
117
+ raise exception.AccessDenied('%s cannot check existence of option %s from section %s. %s' % (issuer, option, section, auth_result.message))
118
+ return config.has_option(section, option, session=session)
126
119
 
127
120
 
128
- @read_session
129
- def get(section: str, option: str, issuer: Optional[str] = None, vo: str = 'def', *, session: "Session") -> Any:
121
+ def get(section: str, option: str, issuer: str, vo: str = 'def') -> Any:
130
122
  """
131
123
  Get an option value for the named section. Value can be auto-coerced to int, float, and bool; string otherwise.
132
124
 
@@ -137,19 +129,18 @@ def get(section: str, option: str, issuer: Optional[str] = None, vo: str = 'def'
137
129
  :param option: The name of the option.
138
130
  :param issuer: The issuer account.
139
131
  :param vo: The VO to act on.
140
- :param session: The database session in use.
141
132
  :returns: The auto-coerced value.
142
133
  """
143
134
 
144
135
  kwargs = {'issuer': issuer, 'section': section, 'option': option}
145
- auth_result = permission.has_permission(issuer=issuer, vo=vo, action='config_get', kwargs=kwargs, session=session)
146
- if not auth_result.allowed:
147
- raise exception.AccessDenied('%s cannot retrieve option %s from section %s. %s' % (issuer, option, section, auth_result.message))
148
- return config.get(section, option, session=session, convert_type_fnc=convert_to_any_type)
136
+ with db_session(DatabaseOperationType.READ) as session:
137
+ auth_result = permission.has_permission(issuer=issuer, vo=vo, action='config_get', kwargs=kwargs, session=session)
138
+ if not auth_result.allowed:
139
+ raise exception.AccessDenied('%s cannot retrieve option %s from section %s. %s' % (issuer, option, section, auth_result.message))
140
+ return config.get(section, option, session=session, convert_type_fnc=convert_to_any_type)
149
141
 
150
142
 
151
- @read_session
152
- def items(section: str, issuer: Optional[str] = None, vo: str = 'def', *, session: "Session") -> list[tuple[str, Any]]:
143
+ def items(section: str, issuer: str, vo: str = 'def') -> list[tuple[str, Any]]:
153
144
  """
154
145
  Return a list of (option, value) pairs for each option in the given section. Values are auto-coerced as in get().
155
146
 
@@ -157,19 +148,18 @@ def items(section: str, issuer: Optional[str] = None, vo: str = 'def', *, sessio
157
148
  :param value: The content of the value.
158
149
  :param issuer: The issuer account.
159
150
  :param vo: The VO to act on.
160
- :param session: The database session in use.
161
151
  :returns: [('option', auto-coerced value), ...]
162
152
  """
163
153
 
164
154
  kwargs = {'issuer': issuer, 'section': section}
165
- auth_result = permission.has_permission(issuer=issuer, vo=vo, action='config_items', kwargs=kwargs, session=session)
166
- if not auth_result.allowed:
167
- raise exception.AccessDenied('%s cannot retrieve options and values from section %s. %s' % (issuer, section, auth_result.message))
168
- return config.items(section, session=session, convert_type_fnc=convert_to_any_type)
155
+ with db_session(DatabaseOperationType.READ) as session:
156
+ auth_result = permission.has_permission(issuer=issuer, vo=vo, action='config_items', kwargs=kwargs, session=session)
157
+ if not auth_result.allowed:
158
+ raise exception.AccessDenied('%s cannot retrieve options and values from section %s. %s' % (issuer, section, auth_result.message))
159
+ return config.items(section, session=session, convert_type_fnc=convert_to_any_type)
169
160
 
170
161
 
171
- @transactional_session
172
- def set(section: str, option: str, value: Any, issuer: Optional[str] = None, vo: str = 'def', *, session: "Session") -> None:
162
+ def set(section: str, option: str, value: Any, issuer: str, vo: str = 'def') -> None:
173
163
  """
174
164
  Set the given option to the specified value.
175
165
 
@@ -178,37 +168,35 @@ def set(section: str, option: str, value: Any, issuer: Optional[str] = None, vo:
178
168
  :param value: The content of the value.
179
169
  :param issuer: The issuer account.
180
170
  :param vo: The VO to act on.
181
- :param session: The database session in use.
182
171
  """
183
172
 
184
173
  kwargs = {'issuer': issuer, 'section': section, 'option': option, 'value': value}
185
- auth_result = permission.has_permission(issuer=issuer, vo=vo, action='config_set', kwargs=kwargs, session=session)
186
- if not auth_result.allowed:
187
- raise exception.AccessDenied('%s cannot set option %s to %s in section %s. %s' % (issuer, option, value, section, auth_result.message))
188
- return config.set(section, option, value, session=session)
174
+ with db_session(DatabaseOperationType.WRITE) as session:
175
+ auth_result = permission.has_permission(issuer=issuer, vo=vo, action='config_set', kwargs=kwargs, session=session)
176
+ if not auth_result.allowed:
177
+ raise exception.AccessDenied('%s cannot set option %s to %s in section %s. %s' % (issuer, option, value, section, auth_result.message))
178
+ return config.set(section, option, value, session=session)
189
179
 
190
180
 
191
- @transactional_session
192
- def remove_section(section: str, issuer: Optional[str] = None, vo: str = 'def', *, session: "Session") -> bool:
181
+ def remove_section(section: str, issuer: str, vo: str = 'def') -> bool:
193
182
  """
194
183
  Remove the specified option from the specified section.
195
184
 
196
185
  :param section: The name of the section.
197
186
  :param issuer: The issuer account.
198
187
  :param vo: The VO to act on.
199
- :param session: The database session in use.
200
188
  :returns: True/False.
201
189
  """
202
190
 
203
191
  kwargs = {'issuer': issuer, 'section': section}
204
- auth_result = permission.has_permission(issuer=issuer, vo=vo, action='config_remove_section', kwargs=kwargs, session=session)
205
- if not auth_result.allowed:
206
- raise exception.AccessDenied('%s cannot remove section %s. %s' % (issuer, section, auth_result.message))
207
- return config.remove_section(section, session=session)
192
+ with db_session(DatabaseOperationType.WRITE) as session:
193
+ auth_result = permission.has_permission(issuer=issuer, vo=vo, action='config_remove_section', kwargs=kwargs, session=session)
194
+ if not auth_result.allowed:
195
+ raise exception.AccessDenied('%s cannot remove section %s. %s' % (issuer, section, auth_result.message))
196
+ return config.remove_section(section, session=session)
208
197
 
209
198
 
210
- @transactional_session
211
- def remove_option(section: str, option: str, issuer: Optional[str] = None, vo: str = 'def', *, session: "Session") -> bool:
199
+ def remove_option(section: str, option: str, issuer: str, vo: str = 'def') -> bool:
212
200
  """
213
201
  Remove the specified section from the configuration.
214
202
 
@@ -216,12 +204,12 @@ def remove_option(section: str, option: str, issuer: Optional[str] = None, vo: s
216
204
  :param option: The name of the option.
217
205
  :param issuer: The issuer account.
218
206
  :param vo: The VO to act on.
219
- :param session: The database session in use.
220
207
  :returns: True/False
221
208
  """
222
209
 
223
210
  kwargs = {'issuer': issuer, 'section': section, 'option': option}
224
- auth_result = permission.has_permission(issuer=issuer, vo=vo, action='config_remove_option', kwargs=kwargs, session=session)
225
- if not auth_result.allowed:
226
- raise exception.AccessDenied('%s cannot remove option %s from section %s. %s' % (issuer, option, section, auth_result.message))
227
- return config.remove_option(section, option, session=session)
211
+ with db_session(DatabaseOperationType.WRITE) as session:
212
+ auth_result = permission.has_permission(issuer=issuer, vo=vo, action='config_remove_option', kwargs=kwargs, session=session)
213
+ if not auth_result.allowed:
214
+ raise exception.AccessDenied('%s cannot remove option %s from section %s. %s' % (issuer, option, section, auth_result.message))
215
+ return config.remove_option(section, option, session=session)
@@ -17,28 +17,22 @@ from typing import TYPE_CHECKING
17
17
  from rucio.common import exception
18
18
  from rucio.core import credential
19
19
  from rucio.core.rse import get_rse_id
20
- from rucio.db.sqla.session import read_session
20
+ from rucio.db.sqla.constants import DatabaseOperationType
21
+ from rucio.db.sqla.session import db_session
21
22
  from rucio.gateway import permission
22
23
 
23
24
  if TYPE_CHECKING:
24
- from sqlalchemy.orm import Session
25
-
26
25
  from rucio.common.constants import RSE_BASE_SUPPORTED_PROTOCOL_OPERATIONS_LITERAL, SUPPORTED_SIGN_URL_SERVICES_LITERAL
27
26
 
28
27
 
29
- @read_session
30
28
  def get_signed_url(
31
29
  account: str,
32
- appid: str,
33
- ip: str,
34
30
  rse: str,
35
31
  service: 'SUPPORTED_SIGN_URL_SERVICES_LITERAL',
36
32
  operation: 'RSE_BASE_SUPPORTED_PROTOCOL_OPERATIONS_LITERAL',
37
33
  url: str,
38
34
  lifetime: int,
39
35
  vo: str = 'def',
40
- *,
41
- session: "Session"
42
36
  ) -> str:
43
37
  """
44
38
  Get a signed URL for a particular service and operation.
@@ -46,25 +40,25 @@ def get_signed_url(
46
40
  The signed URL will be valid for 1 hour.
47
41
 
48
42
  :param account: Account identifier as a string.
49
- :param appid: The application identifier as a string.
50
- :param ip: IP address of the client as a string.
51
43
  :param rse: The name of the RSE to which the URL points.
52
44
  :param service: The service to authorise, currently only 'gsc'.
53
45
  :param operation: The operation to sign, either 'read', 'write', or 'delete'.
54
46
  :param url: The URL to sign.
55
47
  :param lifetime: Lifetime in seconds.
56
48
  :param vo: The vo to act on.
57
- :param session: The database session in use.
49
+
58
50
  :returns: Signed URL as a variable-length string.
59
51
  """
60
52
 
61
53
  kwargs = {'account': account}
62
- auth_result = permission.has_permission(issuer=account, vo=vo, action='get_signed_url', kwargs=kwargs, session=session)
63
- if not auth_result.allowed:
64
- raise exception.AccessDenied('Account %s can not get signed URL for rse=%s, service=%s, operation=%s, url=%s, lifetime=%s. %s' %
65
- (account, rse, service, operation, url, lifetime, auth_result.message))
66
54
 
67
- # look up RSE ID for name
68
- rse_id = get_rse_id(rse, vo=vo, session=session)
55
+ with db_session(DatabaseOperationType.READ) as session:
56
+ auth_result = permission.has_permission(issuer=account, vo=vo, action='get_signed_url', kwargs=kwargs, session=session)
57
+ if not auth_result.allowed:
58
+ raise exception.AccessDenied('Account %s can not get signed URL for rse=%s, service=%s, operation=%s, url=%s, lifetime=%s. %s' %
59
+ (account, rse, service, operation, url, lifetime, auth_result.message))
60
+
61
+ # look up RSE ID for name
62
+ rse_id = get_rse_id(rse, vo=vo, session=session)
69
63
 
70
64
  return credential.get_signed_url(rse_id, service, operation, url, lifetime)