rucio 37.5.0__py3-none-any.whl → 37.7.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.
- rucio/cli/bin_legacy/rucio.py +41 -22
- rucio/cli/bin_legacy/rucio_admin.py +1 -1
- rucio/cli/did.py +2 -2
- rucio/cli/rse.py +2 -3
- rucio/cli/rule.py +9 -5
- rucio/cli/subscription.py +1 -1
- rucio/client/baseclient.py +9 -4
- rucio/client/didclient.py +16 -16
- rucio/client/downloadclient.py +16 -15
- rucio/client/exportclient.py +45 -4
- rucio/client/lockclient.py +3 -3
- rucio/client/pingclient.py +35 -4
- rucio/client/replicaclient.py +2 -2
- rucio/client/touchclient.py +3 -2
- rucio/client/uploadclient.py +728 -183
- rucio/common/cache.py +1 -2
- rucio/common/client.py +4 -30
- rucio/common/config.py +27 -3
- rucio/common/constants.py +5 -1
- rucio/common/didtype.py +2 -2
- rucio/common/dumper/__init__.py +1 -1
- rucio/common/pcache.py +20 -25
- rucio/common/plugins.py +12 -19
- rucio/common/policy.py +3 -2
- rucio/common/schema/__init__.py +11 -8
- rucio/common/types.py +7 -5
- rucio/common/utils.py +1 -1
- rucio/core/account.py +2 -1
- rucio/core/account_limit.py +3 -2
- rucio/core/authentication.py +1 -1
- rucio/core/credential.py +1 -1
- rucio/core/did.py +62 -61
- rucio/core/did_meta_plugins/__init__.py +10 -10
- rucio/core/did_meta_plugins/did_column_meta.py +9 -9
- rucio/core/did_meta_plugins/did_meta_plugin_interface.py +3 -3
- rucio/core/did_meta_plugins/elasticsearch_meta.py +7 -7
- rucio/core/did_meta_plugins/json_meta.py +2 -2
- rucio/core/did_meta_plugins/mongo_meta.py +9 -9
- rucio/core/did_meta_plugins/postgres_meta.py +7 -7
- rucio/core/dirac.py +3 -2
- rucio/core/distance.py +2 -1
- rucio/core/exporter.py +3 -2
- rucio/core/importer.py +5 -5
- rucio/core/lifetime_exception.py +2 -2
- rucio/core/lock.py +7 -7
- rucio/core/meta_conventions.py +2 -2
- rucio/core/monitor.py +1 -1
- rucio/core/naming_convention.py +1 -1
- rucio/core/nongrid_trace.py +2 -2
- rucio/core/oidc.py +2 -2
- rucio/core/permission/__init__.py +9 -6
- rucio/core/permission/generic.py +2 -2
- rucio/core/permission/generic_multi_vo.py +2 -2
- rucio/core/replica.py +22 -22
- rucio/core/request.py +2 -2
- rucio/core/rse.py +7 -7
- rucio/core/rule.py +38 -38
- rucio/core/rule_grouping.py +2 -3
- rucio/core/scope.py +1 -1
- rucio/core/trace.py +2 -2
- rucio/core/transfer.py +2 -2
- rucio/core/vo.py +2 -1
- rucio/daemons/atropos/atropos.py +2 -1
- rucio/daemons/auditor/__init__.py +1 -1
- rucio/daemons/automatix/automatix.py +5 -5
- rucio/daemons/badreplicas/minos.py +12 -5
- rucio/daemons/badreplicas/minos_temporary_expiration.py +5 -2
- rucio/daemons/badreplicas/necromancer.py +9 -3
- rucio/daemons/bb8/bb8.py +2 -1
- rucio/daemons/bb8/common.py +1 -1
- rucio/daemons/bb8/nuclei_background_rebalance.py +3 -3
- rucio/daemons/bb8/t2_background_rebalance.py +1 -1
- rucio/daemons/cache/consumer.py +1 -1
- rucio/daemons/conveyor/common.py +3 -3
- rucio/daemons/conveyor/finisher.py +13 -4
- rucio/daemons/conveyor/poller.py +5 -2
- rucio/daemons/conveyor/receiver.py +1 -1
- rucio/daemons/conveyor/submitter.py +2 -1
- rucio/daemons/follower/follower.py +1 -1
- rucio/daemons/hermes/hermes.py +29 -8
- rucio/daemons/judge/cleaner.py +2 -2
- rucio/daemons/judge/evaluator.py +7 -7
- rucio/daemons/judge/injector.py +2 -2
- rucio/daemons/judge/repairer.py +2 -2
- rucio/daemons/reaper/dark_reaper.py +5 -4
- rucio/daemons/reaper/reaper.py +7 -7
- rucio/daemons/replicarecoverer/suspicious_replica_recoverer.py +4 -4
- rucio/daemons/storage/consistency/actions.py +3 -3
- rucio/daemons/tracer/kronos.py +3 -2
- rucio/daemons/transmogrifier/transmogrifier.py +71 -69
- rucio/daemons/undertaker/undertaker.py +8 -7
- rucio/db/sqla/constants.py +4 -3
- rucio/db/sqla/migrate_repo/versions/3082b8cef557_add_naming_convention_table_and_closed_.py +1 -1
- rucio/db/sqla/migrate_repo/versions/4df2c5ddabc0_remove_temporary_dids.py +1 -1
- rucio/db/sqla/migrate_repo/versions/c129ccdb2d5_add_lumiblocknr_to_dids.py +1 -1
- rucio/db/sqla/models.py +3 -3
- rucio/db/sqla/session.py +7 -7
- rucio/db/sqla/util.py +3 -2
- rucio/gateway/account.py +77 -101
- rucio/gateway/account_limit.py +90 -116
- rucio/gateway/authentication.py +9 -8
- rucio/gateway/config.py +11 -10
- rucio/gateway/credential.py +2 -1
- rucio/gateway/did.py +58 -58
- rucio/gateway/dirac.py +3 -2
- rucio/gateway/exporter.py +2 -1
- rucio/gateway/heartbeat.py +3 -2
- rucio/gateway/identity.py +4 -3
- rucio/gateway/importer.py +2 -1
- rucio/gateway/lifetime_exception.py +5 -4
- rucio/gateway/lock.py +6 -5
- rucio/gateway/meta_conventions.py +3 -2
- rucio/gateway/permission.py +2 -1
- rucio/gateway/quarantined_replica.py +2 -1
- rucio/gateway/replica.py +20 -20
- rucio/gateway/request.py +10 -10
- rucio/gateway/rse.py +27 -26
- rucio/gateway/rule.py +12 -11
- rucio/gateway/scope.py +4 -3
- rucio/gateway/subscription.py +7 -6
- rucio/gateway/vo.py +5 -4
- rucio/rse/__init__.py +7 -6
- rucio/rse/protocols/ngarc.py +2 -2
- rucio/rse/protocols/srm.py +1 -1
- rucio/rse/protocols/webdav.py +8 -1
- rucio/rse/rsemanager.py +5 -4
- rucio/rse/translation.py +2 -2
- rucio/tests/common.py +6 -5
- rucio/vcsversion.py +3 -3
- rucio/web/rest/flaskapi/v1/accountlimits.py +5 -5
- rucio/web/rest/flaskapi/v1/accounts.py +20 -20
- rucio/web/rest/flaskapi/v1/archives.py +4 -3
- rucio/web/rest/flaskapi/v1/common.py +5 -4
- rucio/web/rest/flaskapi/v1/dids.py +382 -331
- rucio/web/rest/flaskapi/v1/lifetime_exceptions.py +5 -5
- rucio/web/rest/flaskapi/v1/locks.py +13 -13
- rucio/web/rest/flaskapi/v1/main.py +1 -0
- rucio/web/rest/flaskapi/v1/redirect.py +2 -2
- rucio/web/rest/flaskapi/v1/replicas.py +16 -16
- rucio/web/rest/flaskapi/v1/requests.py +16 -16
- rucio/web/rest/flaskapi/v1/subscriptions.py +7 -7
- {rucio-37.5.0.data → rucio-37.7.0.data}/scripts/rucio-abacus-account +8 -1
- {rucio-37.5.0.data → rucio-37.7.0.data}/scripts/rucio-abacus-rse +8 -1
- {rucio-37.5.0.data → rucio-37.7.0.data}/scripts/rucio-auditor +1 -1
- {rucio-37.5.0.data → rucio-37.7.0.data}/scripts/rucio-conveyor-throttler +7 -1
- {rucio-37.5.0.data → rucio-37.7.0.data}/scripts/rucio-follower +1 -1
- {rucio-37.5.0.data → rucio-37.7.0.data}/scripts/rucio-judge-cleaner +9 -1
- {rucio-37.5.0.data → rucio-37.7.0.data}/scripts/rucio-necromancer +7 -1
- {rucio-37.5.0.data → rucio-37.7.0.data}/scripts/rucio-replica-recoverer +31 -9
- {rucio-37.5.0.data → rucio-37.7.0.data}/scripts/rucio-undertaker +8 -2
- {rucio-37.5.0.dist-info → rucio-37.7.0.dist-info}/METADATA +1 -1
- {rucio-37.5.0.dist-info → rucio-37.7.0.dist-info}/RECORD +202 -202
- {rucio-37.5.0.data → rucio-37.7.0.data}/data/rucio/etc/alembic.ini.template +0 -0
- {rucio-37.5.0.data → rucio-37.7.0.data}/data/rucio/etc/alembic_offline.ini.template +0 -0
- {rucio-37.5.0.data → rucio-37.7.0.data}/data/rucio/etc/globus-config.yml.template +0 -0
- {rucio-37.5.0.data → rucio-37.7.0.data}/data/rucio/etc/ldap.cfg.template +0 -0
- {rucio-37.5.0.data → rucio-37.7.0.data}/data/rucio/etc/mail_templates/rule_approval_request.tmpl +0 -0
- {rucio-37.5.0.data → rucio-37.7.0.data}/data/rucio/etc/mail_templates/rule_approved_admin.tmpl +0 -0
- {rucio-37.5.0.data → rucio-37.7.0.data}/data/rucio/etc/mail_templates/rule_approved_user.tmpl +0 -0
- {rucio-37.5.0.data → rucio-37.7.0.data}/data/rucio/etc/mail_templates/rule_denied_admin.tmpl +0 -0
- {rucio-37.5.0.data → rucio-37.7.0.data}/data/rucio/etc/mail_templates/rule_denied_user.tmpl +0 -0
- {rucio-37.5.0.data → rucio-37.7.0.data}/data/rucio/etc/mail_templates/rule_ok_notification.tmpl +0 -0
- {rucio-37.5.0.data → rucio-37.7.0.data}/data/rucio/etc/rse-accounts.cfg.template +0 -0
- {rucio-37.5.0.data → rucio-37.7.0.data}/data/rucio/etc/rucio.cfg.atlas.client.template +0 -0
- {rucio-37.5.0.data → rucio-37.7.0.data}/data/rucio/etc/rucio.cfg.template +0 -0
- {rucio-37.5.0.data → rucio-37.7.0.data}/data/rucio/etc/rucio_multi_vo.cfg.template +0 -0
- {rucio-37.5.0.data → rucio-37.7.0.data}/data/rucio/requirements.server.txt +0 -0
- {rucio-37.5.0.data → rucio-37.7.0.data}/data/rucio/tools/bootstrap.py +0 -0
- {rucio-37.5.0.data → rucio-37.7.0.data}/data/rucio/tools/merge_rucio_configs.py +0 -0
- {rucio-37.5.0.data → rucio-37.7.0.data}/data/rucio/tools/reset_database.py +0 -0
- {rucio-37.5.0.data → rucio-37.7.0.data}/scripts/rucio +0 -0
- {rucio-37.5.0.data → rucio-37.7.0.data}/scripts/rucio-abacus-collection-replica +0 -0
- {rucio-37.5.0.data → rucio-37.7.0.data}/scripts/rucio-admin +0 -0
- {rucio-37.5.0.data → rucio-37.7.0.data}/scripts/rucio-atropos +0 -0
- {rucio-37.5.0.data → rucio-37.7.0.data}/scripts/rucio-automatix +0 -0
- {rucio-37.5.0.data → rucio-37.7.0.data}/scripts/rucio-bb8 +0 -0
- {rucio-37.5.0.data → rucio-37.7.0.data}/scripts/rucio-cache-client +0 -0
- {rucio-37.5.0.data → rucio-37.7.0.data}/scripts/rucio-cache-consumer +0 -0
- {rucio-37.5.0.data → rucio-37.7.0.data}/scripts/rucio-conveyor-finisher +0 -0
- {rucio-37.5.0.data → rucio-37.7.0.data}/scripts/rucio-conveyor-poller +0 -0
- {rucio-37.5.0.data → rucio-37.7.0.data}/scripts/rucio-conveyor-preparer +0 -0
- {rucio-37.5.0.data → rucio-37.7.0.data}/scripts/rucio-conveyor-receiver +0 -0
- {rucio-37.5.0.data → rucio-37.7.0.data}/scripts/rucio-conveyor-stager +0 -0
- {rucio-37.5.0.data → rucio-37.7.0.data}/scripts/rucio-conveyor-submitter +0 -0
- {rucio-37.5.0.data → rucio-37.7.0.data}/scripts/rucio-dark-reaper +0 -0
- {rucio-37.5.0.data → rucio-37.7.0.data}/scripts/rucio-dumper +0 -0
- {rucio-37.5.0.data → rucio-37.7.0.data}/scripts/rucio-hermes +0 -0
- {rucio-37.5.0.data → rucio-37.7.0.data}/scripts/rucio-judge-evaluator +0 -0
- {rucio-37.5.0.data → rucio-37.7.0.data}/scripts/rucio-judge-injector +0 -0
- {rucio-37.5.0.data → rucio-37.7.0.data}/scripts/rucio-judge-repairer +0 -0
- {rucio-37.5.0.data → rucio-37.7.0.data}/scripts/rucio-kronos +0 -0
- {rucio-37.5.0.data → rucio-37.7.0.data}/scripts/rucio-minos +0 -0
- {rucio-37.5.0.data → rucio-37.7.0.data}/scripts/rucio-minos-temporary-expiration +0 -0
- {rucio-37.5.0.data → rucio-37.7.0.data}/scripts/rucio-oauth-manager +0 -0
- {rucio-37.5.0.data → rucio-37.7.0.data}/scripts/rucio-reaper +0 -0
- {rucio-37.5.0.data → rucio-37.7.0.data}/scripts/rucio-rse-decommissioner +0 -0
- {rucio-37.5.0.data → rucio-37.7.0.data}/scripts/rucio-storage-consistency-actions +0 -0
- {rucio-37.5.0.data → rucio-37.7.0.data}/scripts/rucio-transmogrifier +0 -0
- {rucio-37.5.0.dist-info → rucio-37.7.0.dist-info}/WHEEL +0 -0
- {rucio-37.5.0.dist-info → rucio-37.7.0.dist-info}/licenses/AUTHORS.rst +0 -0
- {rucio-37.5.0.dist-info → rucio-37.7.0.dist-info}/licenses/LICENSE +0 -0
- {rucio-37.5.0.dist-info → rucio-37.7.0.dist-info}/top_level.txt +0 -0
rucio/gateway/account.py
CHANGED
|
@@ -17,32 +17,28 @@ from typing import TYPE_CHECKING, Any, Optional
|
|
|
17
17
|
import rucio.common.exception
|
|
18
18
|
import rucio.core.identity
|
|
19
19
|
import rucio.gateway.permission
|
|
20
|
+
from rucio.common.constants import DEFAULT_VO
|
|
20
21
|
from rucio.common.schema import validate_schema
|
|
21
22
|
from rucio.common.types import InternalAccount
|
|
22
23
|
from rucio.common.utils import gateway_update_return_dict
|
|
23
24
|
from rucio.core import account as account_core
|
|
24
25
|
from rucio.core.rse import get_rse_id
|
|
25
|
-
from rucio.db.sqla.constants import AccountType
|
|
26
|
-
from rucio.db.sqla.session import
|
|
26
|
+
from rucio.db.sqla.constants import AccountType, DatabaseOperationType
|
|
27
|
+
from rucio.db.sqla.session import db_session
|
|
27
28
|
|
|
28
29
|
if TYPE_CHECKING:
|
|
29
30
|
from collections.abc import Iterator
|
|
30
31
|
|
|
31
|
-
from sqlalchemy.orm import Session
|
|
32
|
-
|
|
33
32
|
from rucio.common.types import AccountAttributesDict, IdentityDict, UsageDict
|
|
34
33
|
from rucio.db.sqla.models import Account
|
|
35
34
|
|
|
36
35
|
|
|
37
|
-
@transactional_session
|
|
38
36
|
def add_account(
|
|
39
37
|
account: str,
|
|
40
38
|
type_: str,
|
|
41
39
|
email: str,
|
|
42
40
|
issuer: str,
|
|
43
|
-
vo: str =
|
|
44
|
-
*,
|
|
45
|
-
session: "Session"
|
|
41
|
+
vo: str = DEFAULT_VO,
|
|
46
42
|
) -> None:
|
|
47
43
|
"""
|
|
48
44
|
Creates an account with the provided account name, contact information, etc.
|
|
@@ -53,29 +49,27 @@ def add_account(
|
|
|
53
49
|
|
|
54
50
|
:param issuer: The issuer account_core.
|
|
55
51
|
:param vo: The VO to act on.
|
|
56
|
-
:param session: The database session in use.
|
|
57
52
|
|
|
58
53
|
"""
|
|
59
54
|
|
|
60
55
|
validate_schema(name='account', obj=account, vo=vo)
|
|
61
56
|
|
|
62
57
|
kwargs = {'account': account, 'type': type_}
|
|
63
|
-
auth_result = rucio.gateway.permission.has_permission(issuer=issuer, vo=vo, action='add_account', kwargs=kwargs, session=session)
|
|
64
|
-
if not auth_result.allowed:
|
|
65
|
-
raise rucio.common.exception.AccessDenied('Account %s can not add account. %s' % (issuer, auth_result.message))
|
|
66
58
|
|
|
67
|
-
|
|
59
|
+
with db_session(DatabaseOperationType.WRITE) as session:
|
|
60
|
+
auth_result = rucio.gateway.permission.has_permission(issuer=issuer, vo=vo, action='add_account', kwargs=kwargs, session=session)
|
|
61
|
+
if not auth_result.allowed:
|
|
62
|
+
raise rucio.common.exception.AccessDenied('Account %s can not add account. %s' % (issuer, auth_result.message))
|
|
63
|
+
|
|
64
|
+
internal_account = InternalAccount(account, vo=vo)
|
|
68
65
|
|
|
69
|
-
|
|
66
|
+
account_core.add_account(internal_account, AccountType[type_.upper()], email, session=session)
|
|
70
67
|
|
|
71
68
|
|
|
72
|
-
@transactional_session
|
|
73
69
|
def del_account(
|
|
74
70
|
account: str,
|
|
75
71
|
issuer: str,
|
|
76
|
-
vo: str =
|
|
77
|
-
*,
|
|
78
|
-
session: "Session"
|
|
72
|
+
vo: str = DEFAULT_VO,
|
|
79
73
|
) -> None:
|
|
80
74
|
"""
|
|
81
75
|
Disables an account with the provided account name.
|
|
@@ -83,25 +77,22 @@ def del_account(
|
|
|
83
77
|
:param account: The account name.
|
|
84
78
|
:param issuer: The issuer account.
|
|
85
79
|
:param vo: The VO to act on.
|
|
86
|
-
:param session: The database session in use.
|
|
87
80
|
|
|
88
81
|
"""
|
|
89
82
|
kwargs = {'account': account}
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
83
|
+
with db_session(DatabaseOperationType.WRITE) as session:
|
|
84
|
+
auth_result = rucio.gateway.permission.has_permission(issuer=issuer, vo=vo, action='del_account', kwargs=kwargs, session=session)
|
|
85
|
+
if not auth_result.allowed:
|
|
86
|
+
raise rucio.common.exception.AccessDenied('Account %s can not delete account. %s' % (issuer, auth_result.message))
|
|
93
87
|
|
|
94
|
-
|
|
88
|
+
internal_account = InternalAccount(account, vo=vo)
|
|
95
89
|
|
|
96
|
-
|
|
90
|
+
account_core.del_account(internal_account, session=session)
|
|
97
91
|
|
|
98
92
|
|
|
99
|
-
@read_session
|
|
100
93
|
def get_account_info(
|
|
101
94
|
account: str,
|
|
102
|
-
vo: str =
|
|
103
|
-
*,
|
|
104
|
-
session: "Session"
|
|
95
|
+
vo: str = DEFAULT_VO,
|
|
105
96
|
) -> "Account":
|
|
106
97
|
"""
|
|
107
98
|
Returns the info like the statistics information associated to an account_core.
|
|
@@ -109,25 +100,23 @@ def get_account_info(
|
|
|
109
100
|
:param account: The account name.
|
|
110
101
|
:returns: A list with all account information.
|
|
111
102
|
:param vo: The VO to act on.
|
|
112
|
-
|
|
103
|
+
|
|
113
104
|
"""
|
|
114
105
|
|
|
115
106
|
internal_account = InternalAccount(account, vo=vo)
|
|
116
107
|
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
108
|
+
with db_session(DatabaseOperationType.READ) as session:
|
|
109
|
+
acc = account_core.get_account(internal_account, session=session)
|
|
110
|
+
acc.account = acc.account.external
|
|
111
|
+
return acc
|
|
120
112
|
|
|
121
113
|
|
|
122
|
-
@transactional_session
|
|
123
114
|
def update_account(
|
|
124
115
|
account: str,
|
|
125
116
|
key: str,
|
|
126
117
|
value: Any,
|
|
127
118
|
issuer: str = 'root',
|
|
128
|
-
vo: str =
|
|
129
|
-
*,
|
|
130
|
-
session: "Session"
|
|
119
|
+
vo: str = DEFAULT_VO,
|
|
131
120
|
) -> None:
|
|
132
121
|
""" Update a property of an account_core.
|
|
133
122
|
|
|
@@ -136,21 +125,21 @@ def update_account(
|
|
|
136
125
|
:param value: Property value.
|
|
137
126
|
:param issuer: The issuer account
|
|
138
127
|
:param vo: The VO to act on.
|
|
139
|
-
|
|
128
|
+
|
|
140
129
|
"""
|
|
141
130
|
validate_schema(name='account', obj=account, vo=vo)
|
|
142
131
|
kwargs = {}
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
132
|
+
with db_session(DatabaseOperationType.WRITE) as session:
|
|
133
|
+
auth_result = rucio.gateway.permission.has_permission(issuer=issuer, vo=vo, action='update_account', kwargs=kwargs, session=session)
|
|
134
|
+
if not auth_result.allowed:
|
|
135
|
+
raise rucio.common.exception.AccessDenied('Account %s can not change %s of the account. %s' % (issuer, key, auth_result.message))
|
|
146
136
|
|
|
147
|
-
|
|
137
|
+
internal_account = InternalAccount(account, vo=vo)
|
|
148
138
|
|
|
149
|
-
|
|
139
|
+
return account_core.update_account(internal_account, key, value, session=session)
|
|
150
140
|
|
|
151
141
|
|
|
152
|
-
|
|
153
|
-
def list_accounts(filter_: Optional[dict[str, Any]] = None, vo: str = 'def', *, session: "Session") -> 'Iterator[dict[str, Any]]':
|
|
142
|
+
def list_accounts(filter_: Optional[dict[str, Any]] = None, vo: str = DEFAULT_VO) -> 'Iterator[dict[str, Any]]':
|
|
154
143
|
"""
|
|
155
144
|
Lists all the Rucio account names.
|
|
156
145
|
|
|
@@ -158,7 +147,6 @@ def list_accounts(filter_: Optional[dict[str, Any]] = None, vo: str = 'def', *,
|
|
|
158
147
|
|
|
159
148
|
:param filter_: Dictionary of attributes by which the input data should be filtered
|
|
160
149
|
:param vo: The VO to act on.
|
|
161
|
-
:param session: The database session in use.
|
|
162
150
|
|
|
163
151
|
:returns: List of all accounts.
|
|
164
152
|
"""
|
|
@@ -169,80 +157,73 @@ def list_accounts(filter_: Optional[dict[str, Any]] = None, vo: str = 'def', *,
|
|
|
169
157
|
filter_['account'] = InternalAccount(filter_['account'], vo=vo)
|
|
170
158
|
else:
|
|
171
159
|
filter_['account'] = InternalAccount(account='*', vo=vo)
|
|
172
|
-
|
|
173
|
-
|
|
160
|
+
|
|
161
|
+
with db_session(DatabaseOperationType.READ) as session:
|
|
162
|
+
for result in account_core.list_accounts(filter_=filter_, session=session):
|
|
163
|
+
yield gateway_update_return_dict(result, session=session)
|
|
174
164
|
|
|
175
165
|
|
|
176
|
-
@read_session
|
|
177
166
|
def account_exists(
|
|
178
167
|
account: str,
|
|
179
|
-
vo: str =
|
|
180
|
-
*,
|
|
181
|
-
session: "Session"
|
|
168
|
+
vo: str = DEFAULT_VO,
|
|
182
169
|
) -> bool:
|
|
183
170
|
"""
|
|
184
171
|
Checks to see if account exists. This procedure does not check it's status.
|
|
185
172
|
|
|
186
173
|
:param account: Name of the account.
|
|
187
174
|
:param vo: The VO to act on.
|
|
188
|
-
|
|
175
|
+
|
|
189
176
|
:returns: True if found, otherwise false.
|
|
190
177
|
"""
|
|
191
178
|
|
|
192
179
|
internal_account = InternalAccount(account, vo=vo)
|
|
193
180
|
|
|
194
|
-
|
|
181
|
+
with db_session(DatabaseOperationType.READ) as session:
|
|
182
|
+
return account_core.account_exists(internal_account, session=session)
|
|
195
183
|
|
|
196
184
|
|
|
197
|
-
@read_session
|
|
198
185
|
def list_identities(
|
|
199
186
|
account: str,
|
|
200
|
-
vo: str =
|
|
201
|
-
*,
|
|
202
|
-
session: "Session"
|
|
187
|
+
vo: str = DEFAULT_VO,
|
|
203
188
|
) -> list["IdentityDict"]:
|
|
204
189
|
"""
|
|
205
190
|
List all identities on an account_core.
|
|
206
191
|
|
|
207
192
|
:param account: The account name.
|
|
208
193
|
:param vo: The VO to act on.
|
|
209
|
-
|
|
194
|
+
|
|
210
195
|
"""
|
|
211
196
|
|
|
212
197
|
internal_account = InternalAccount(account, vo=vo)
|
|
213
198
|
|
|
214
|
-
|
|
199
|
+
with db_session(DatabaseOperationType.READ) as session:
|
|
200
|
+
return account_core.list_identities(internal_account, session=session)
|
|
215
201
|
|
|
216
202
|
|
|
217
|
-
@read_session
|
|
218
203
|
def list_account_attributes(
|
|
219
204
|
account: str,
|
|
220
|
-
vo: str =
|
|
221
|
-
*,
|
|
222
|
-
session: "Session"
|
|
205
|
+
vo: str = DEFAULT_VO,
|
|
223
206
|
) -> list["AccountAttributesDict"]:
|
|
224
207
|
"""
|
|
225
208
|
Returns all the attributes for the given account.
|
|
226
209
|
|
|
227
210
|
:param account: The account name.
|
|
228
211
|
:param vo: The VO to act on
|
|
229
|
-
|
|
212
|
+
|
|
230
213
|
"""
|
|
231
214
|
|
|
232
215
|
internal_account = InternalAccount(account, vo=vo)
|
|
233
216
|
|
|
234
|
-
|
|
217
|
+
with db_session(DatabaseOperationType.READ) as session:
|
|
218
|
+
return account_core.list_account_attributes(internal_account, session=session)
|
|
235
219
|
|
|
236
220
|
|
|
237
|
-
@transactional_session
|
|
238
221
|
def add_account_attribute(
|
|
239
222
|
key: str,
|
|
240
223
|
value: Any,
|
|
241
224
|
account: str,
|
|
242
225
|
issuer: str,
|
|
243
|
-
vo: str =
|
|
244
|
-
*,
|
|
245
|
-
session: "Session"
|
|
226
|
+
vo: str = DEFAULT_VO,
|
|
246
227
|
) -> None:
|
|
247
228
|
"""
|
|
248
229
|
Add an attribute to an account.
|
|
@@ -252,29 +233,27 @@ def add_account_attribute(
|
|
|
252
233
|
:param account: The account name.
|
|
253
234
|
:param issuer: The issuer account.
|
|
254
235
|
:param vo: The VO to act on.
|
|
255
|
-
|
|
236
|
+
|
|
256
237
|
"""
|
|
257
238
|
validate_schema(name='account_attribute', obj=key, vo=vo)
|
|
258
239
|
validate_schema(name='account_attribute', obj=value, vo=vo)
|
|
259
240
|
|
|
260
241
|
kwargs = {'account': account, 'key': key, 'value': value}
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
242
|
+
with db_session(DatabaseOperationType.WRITE) as session:
|
|
243
|
+
auth_result = rucio.gateway.permission.has_permission(issuer=issuer, vo=vo, action='add_attribute', kwargs=kwargs, session=session)
|
|
244
|
+
if not auth_result.allowed:
|
|
245
|
+
raise rucio.common.exception.AccessDenied('Account %s can not add attributes. %s' % (issuer, auth_result.message))
|
|
264
246
|
|
|
265
|
-
|
|
247
|
+
internal_account = InternalAccount(account, vo=vo)
|
|
266
248
|
|
|
267
|
-
|
|
249
|
+
account_core.add_account_attribute(internal_account, key, value, session=session)
|
|
268
250
|
|
|
269
251
|
|
|
270
|
-
@transactional_session
|
|
271
252
|
def del_account_attribute(
|
|
272
253
|
key: str,
|
|
273
254
|
account: str,
|
|
274
255
|
issuer: str,
|
|
275
|
-
vo: str =
|
|
276
|
-
*,
|
|
277
|
-
session: "Session"
|
|
256
|
+
vo: str = DEFAULT_VO,
|
|
278
257
|
) -> None:
|
|
279
258
|
"""
|
|
280
259
|
Delete an attribute to an account.
|
|
@@ -283,26 +262,24 @@ def del_account_attribute(
|
|
|
283
262
|
:param account: The account name.
|
|
284
263
|
:param issuer: The issuer account.
|
|
285
264
|
:param vo: The VO to act on.
|
|
286
|
-
|
|
265
|
+
|
|
287
266
|
"""
|
|
288
267
|
kwargs = {'account': account, 'key': key}
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
268
|
+
with db_session(DatabaseOperationType.WRITE) as session:
|
|
269
|
+
auth_result = rucio.gateway.permission.has_permission(issuer=issuer, vo=vo, action='del_attribute', kwargs=kwargs, session=session)
|
|
270
|
+
if not auth_result.allowed:
|
|
271
|
+
raise rucio.common.exception.AccessDenied('Account %s can not delete attribute. %s' % (issuer, auth_result.message))
|
|
292
272
|
|
|
293
|
-
|
|
273
|
+
internal_account = InternalAccount(account, vo=vo)
|
|
294
274
|
|
|
295
|
-
|
|
275
|
+
account_core.del_account_attribute(internal_account, key, session=session)
|
|
296
276
|
|
|
297
277
|
|
|
298
|
-
@read_session
|
|
299
278
|
def get_usage(
|
|
300
279
|
rse: str,
|
|
301
280
|
account: str,
|
|
302
281
|
issuer: str,
|
|
303
|
-
vo: str =
|
|
304
|
-
*,
|
|
305
|
-
session: "Session"
|
|
282
|
+
vo: str = DEFAULT_VO,
|
|
306
283
|
) -> "UsageDict":
|
|
307
284
|
"""
|
|
308
285
|
Returns current values of the specified counter, or raises CounterNotFound if the counter does not exist.
|
|
@@ -311,23 +288,21 @@ def get_usage(
|
|
|
311
288
|
:param account: The account name.
|
|
312
289
|
:param issuer: The issuer account.
|
|
313
290
|
:param vo: The VO to act on.
|
|
314
|
-
|
|
291
|
+
|
|
315
292
|
:returns: A dictionary with total and bytes.
|
|
316
293
|
"""
|
|
317
|
-
|
|
318
|
-
|
|
294
|
+
with db_session(DatabaseOperationType.READ) as session:
|
|
295
|
+
rse_id = get_rse_id(rse=rse, vo=vo, session=session)
|
|
296
|
+
internal_account = InternalAccount(account, vo=vo)
|
|
319
297
|
|
|
320
|
-
|
|
298
|
+
return account_core.get_usage(rse_id, internal_account, session=session)
|
|
321
299
|
|
|
322
300
|
|
|
323
|
-
@read_session
|
|
324
301
|
def get_usage_history(
|
|
325
302
|
rse: str,
|
|
326
303
|
account: str,
|
|
327
304
|
issuer: str,
|
|
328
|
-
vo: str =
|
|
329
|
-
*,
|
|
330
|
-
session: "Session"
|
|
305
|
+
vo: str = DEFAULT_VO,
|
|
331
306
|
) -> list["UsageDict"]:
|
|
332
307
|
"""
|
|
333
308
|
Returns historical values of the specified counter, or raises CounterNotFound if the counter does not exist.
|
|
@@ -336,10 +311,11 @@ def get_usage_history(
|
|
|
336
311
|
:param account: The account name.
|
|
337
312
|
:param issuer: The issuer account.
|
|
338
313
|
:param vo: The VO to act on.
|
|
339
|
-
|
|
314
|
+
|
|
340
315
|
:returns: A dictionary with total and bytes.
|
|
341
316
|
"""
|
|
342
|
-
|
|
343
|
-
|
|
317
|
+
with db_session(DatabaseOperationType.READ) as session:
|
|
318
|
+
rse_id = get_rse_id(rse=rse, vo=vo, session=session)
|
|
319
|
+
internal_account = InternalAccount(account, vo=vo)
|
|
344
320
|
|
|
345
|
-
|
|
321
|
+
return account_core.get_usage_history(rse_id, internal_account, session=session)
|