rucio 35.7.0__py3-none-any.whl → 37.0.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/alembicrevision.py +1 -1
- rucio/{daemons/c3po/collectors → cli}/__init__.py +1 -0
- rucio/cli/account.py +216 -0
- rucio-35.7.0.data/scripts/rucio → rucio/cli/bin_legacy/rucio.py +769 -486
- rucio-35.7.0.data/scripts/rucio-admin → rucio/cli/bin_legacy/rucio_admin.py +476 -423
- rucio/cli/command.py +272 -0
- rucio/cli/config.py +72 -0
- rucio/cli/did.py +191 -0
- rucio/cli/download.py +128 -0
- rucio/cli/lifetime_exception.py +33 -0
- rucio/cli/replica.py +162 -0
- rucio/cli/rse.py +293 -0
- rucio/cli/rule.py +158 -0
- rucio/cli/scope.py +40 -0
- rucio/cli/subscription.py +73 -0
- rucio/cli/upload.py +60 -0
- rucio/cli/utils.py +226 -0
- rucio/client/accountclient.py +0 -1
- rucio/client/baseclient.py +33 -24
- rucio/client/client.py +45 -1
- rucio/client/didclient.py +5 -3
- rucio/client/downloadclient.py +6 -8
- rucio/client/replicaclient.py +0 -2
- rucio/client/richclient.py +317 -0
- rucio/client/rseclient.py +4 -4
- rucio/client/uploadclient.py +26 -12
- rucio/common/bittorrent.py +234 -0
- rucio/common/cache.py +66 -29
- rucio/common/checksum.py +168 -0
- rucio/common/client.py +122 -0
- rucio/common/config.py +22 -35
- rucio/common/constants.py +61 -3
- rucio/common/didtype.py +72 -24
- rucio/common/dumper/__init__.py +45 -38
- rucio/common/dumper/consistency.py +75 -30
- rucio/common/dumper/data_models.py +63 -19
- rucio/common/dumper/path_parsing.py +19 -8
- rucio/common/exception.py +65 -8
- rucio/common/extra.py +5 -10
- rucio/common/logging.py +13 -13
- rucio/common/pcache.py +8 -7
- rucio/common/plugins.py +59 -27
- rucio/common/policy.py +12 -3
- rucio/common/schema/__init__.py +84 -34
- rucio/common/schema/generic.py +0 -17
- rucio/common/schema/generic_multi_vo.py +0 -17
- rucio/common/test_rucio_server.py +12 -6
- rucio/common/types.py +132 -52
- rucio/common/utils.py +93 -643
- rucio/core/account_limit.py +14 -12
- rucio/core/authentication.py +2 -2
- rucio/core/config.py +23 -42
- rucio/core/credential.py +14 -15
- rucio/core/did.py +5 -1
- rucio/core/did_meta_plugins/elasticsearch_meta.py +407 -0
- rucio/core/did_meta_plugins/filter_engine.py +62 -3
- rucio/core/did_meta_plugins/json_meta.py +2 -2
- rucio/core/did_meta_plugins/mongo_meta.py +43 -30
- rucio/core/did_meta_plugins/postgres_meta.py +75 -39
- rucio/core/identity.py +6 -5
- rucio/core/importer.py +4 -3
- rucio/core/lifetime_exception.py +2 -2
- rucio/core/lock.py +8 -7
- rucio/core/message.py +6 -0
- rucio/core/monitor.py +30 -29
- rucio/core/naming_convention.py +2 -2
- rucio/core/nongrid_trace.py +2 -2
- rucio/core/oidc.py +11 -9
- rucio/core/permission/__init__.py +79 -37
- rucio/core/permission/generic.py +1 -7
- rucio/core/permission/generic_multi_vo.py +1 -7
- rucio/core/quarantined_replica.py +4 -3
- rucio/core/replica.py +464 -139
- rucio/core/replica_sorter.py +55 -59
- rucio/core/request.py +34 -32
- rucio/core/rse.py +301 -97
- rucio/core/rse_counter.py +1 -2
- rucio/core/rse_expression_parser.py +7 -7
- rucio/core/rse_selector.py +9 -7
- rucio/core/rule.py +41 -40
- rucio/core/rule_grouping.py +42 -40
- rucio/core/scope.py +5 -4
- rucio/core/subscription.py +26 -28
- rucio/core/topology.py +11 -11
- rucio/core/trace.py +2 -2
- rucio/core/transfer.py +29 -15
- rucio/core/volatile_replica.py +4 -3
- rucio/daemons/atropos/atropos.py +1 -1
- rucio/daemons/auditor/__init__.py +2 -2
- rucio/daemons/auditor/srmdumps.py +6 -6
- rucio/daemons/automatix/automatix.py +32 -21
- rucio/daemons/badreplicas/necromancer.py +2 -2
- rucio/daemons/bb8/nuclei_background_rebalance.py +1 -1
- rucio/daemons/bb8/t2_background_rebalance.py +1 -1
- rucio/daemons/common.py +15 -25
- rucio/daemons/conveyor/finisher.py +2 -2
- rucio/daemons/conveyor/poller.py +18 -28
- rucio/daemons/conveyor/receiver.py +2 -2
- rucio/daemons/conveyor/stager.py +1 -0
- rucio/daemons/conveyor/submitter.py +3 -3
- rucio/daemons/hermes/hermes.py +91 -30
- rucio/daemons/judge/evaluator.py +2 -2
- rucio/daemons/oauthmanager/oauthmanager.py +3 -3
- rucio/daemons/reaper/dark_reaper.py +7 -3
- rucio/daemons/reaper/reaper.py +12 -16
- rucio/daemons/rsedecommissioner/config.py +1 -1
- rucio/daemons/rsedecommissioner/profiles/generic.py +5 -4
- rucio/daemons/rsedecommissioner/profiles/types.py +7 -6
- rucio/daemons/rsedecommissioner/rse_decommissioner.py +1 -1
- rucio/daemons/storage/consistency/actions.py +8 -6
- rucio/daemons/tracer/kronos.py +4 -4
- rucio/db/sqla/constants.py +5 -0
- rucio/db/sqla/migrate_repo/versions/1677d4d803c8_split_rse_availability_into_multiple.py +4 -4
- rucio/db/sqla/migrate_repo/versions/30d5206e9cad_increase_oauthrequest_redirect_msg_.py +37 -0
- rucio/db/sqla/models.py +157 -154
- rucio/db/sqla/session.py +58 -27
- rucio/db/sqla/types.py +2 -2
- rucio/db/sqla/util.py +2 -2
- rucio/gateway/account.py +18 -12
- rucio/gateway/account_limit.py +137 -60
- rucio/gateway/authentication.py +18 -12
- rucio/gateway/config.py +30 -20
- rucio/gateway/credential.py +9 -10
- rucio/gateway/did.py +70 -53
- rucio/gateway/dirac.py +6 -4
- rucio/gateway/exporter.py +3 -2
- rucio/gateway/heartbeat.py +6 -4
- rucio/gateway/identity.py +36 -51
- rucio/gateway/importer.py +3 -2
- rucio/gateway/lifetime_exception.py +3 -2
- rucio/gateway/meta_conventions.py +17 -6
- rucio/gateway/permission.py +4 -1
- rucio/gateway/quarantined_replica.py +3 -2
- rucio/gateway/replica.py +31 -22
- rucio/gateway/request.py +27 -18
- rucio/gateway/rse.py +69 -37
- rucio/gateway/rule.py +46 -26
- rucio/gateway/scope.py +3 -2
- rucio/gateway/subscription.py +14 -11
- rucio/gateway/vo.py +12 -8
- rucio/rse/__init__.py +3 -3
- rucio/rse/protocols/bittorrent.py +11 -1
- rucio/rse/protocols/cache.py +0 -11
- rucio/rse/protocols/dummy.py +0 -11
- rucio/rse/protocols/gfal.py +14 -9
- rucio/rse/protocols/globus.py +1 -1
- rucio/rse/protocols/http_cache.py +1 -1
- rucio/rse/protocols/posix.py +2 -2
- rucio/rse/protocols/protocol.py +84 -317
- rucio/rse/protocols/rclone.py +2 -1
- rucio/rse/protocols/rfio.py +10 -1
- rucio/rse/protocols/ssh.py +2 -1
- rucio/rse/protocols/storm.py +2 -13
- rucio/rse/protocols/webdav.py +74 -30
- rucio/rse/protocols/xrootd.py +2 -1
- rucio/rse/rsemanager.py +170 -53
- rucio/rse/translation.py +260 -0
- rucio/tests/common.py +23 -13
- rucio/tests/common_server.py +26 -9
- rucio/transfertool/bittorrent.py +15 -14
- rucio/transfertool/bittorrent_driver.py +5 -7
- rucio/transfertool/bittorrent_driver_qbittorrent.py +9 -8
- rucio/transfertool/fts3.py +20 -16
- rucio/transfertool/mock.py +2 -3
- rucio/vcsversion.py +4 -4
- rucio/version.py +7 -0
- rucio/web/rest/flaskapi/v1/accounts.py +17 -3
- rucio/web/rest/flaskapi/v1/auth.py +5 -5
- rucio/web/rest/flaskapi/v1/credentials.py +3 -2
- rucio/web/rest/flaskapi/v1/dids.py +21 -15
- rucio/web/rest/flaskapi/v1/identities.py +33 -9
- rucio/web/rest/flaskapi/v1/redirect.py +5 -4
- rucio/web/rest/flaskapi/v1/replicas.py +12 -8
- rucio/web/rest/flaskapi/v1/rses.py +15 -4
- rucio/web/rest/flaskapi/v1/traces.py +56 -19
- {rucio-35.7.0.data → rucio-37.0.0.data}/data/rucio/etc/alembic.ini.template +1 -1
- {rucio-35.7.0.data → rucio-37.0.0.data}/data/rucio/etc/alembic_offline.ini.template +1 -1
- {rucio-35.7.0.data → rucio-37.0.0.data}/data/rucio/etc/rucio.cfg.atlas.client.template +3 -2
- {rucio-35.7.0.data → rucio-37.0.0.data}/data/rucio/etc/rucio.cfg.template +3 -19
- {rucio-35.7.0.data → rucio-37.0.0.data}/data/rucio/etc/rucio_multi_vo.cfg.template +1 -18
- {rucio-35.7.0.data → rucio-37.0.0.data}/data/rucio/requirements.server.txt +97 -68
- rucio-37.0.0.data/scripts/rucio +133 -0
- rucio-37.0.0.data/scripts/rucio-admin +97 -0
- {rucio-35.7.0.data → rucio-37.0.0.data}/scripts/rucio-atropos +2 -2
- {rucio-35.7.0.data → rucio-37.0.0.data}/scripts/rucio-auditor +2 -1
- {rucio-35.7.0.data → rucio-37.0.0.data}/scripts/rucio-automatix +2 -2
- {rucio-35.7.0.data → rucio-37.0.0.data}/scripts/rucio-cache-client +17 -10
- {rucio-35.7.0.data → rucio-37.0.0.data}/scripts/rucio-conveyor-receiver +1 -0
- {rucio-35.7.0.data → rucio-37.0.0.data}/scripts/rucio-kronos +1 -0
- {rucio-35.7.0.data → rucio-37.0.0.data}/scripts/rucio-minos +2 -2
- {rucio-35.7.0.data → rucio-37.0.0.data}/scripts/rucio-minos-temporary-expiration +2 -2
- {rucio-35.7.0.data → rucio-37.0.0.data}/scripts/rucio-necromancer +2 -2
- {rucio-35.7.0.data → rucio-37.0.0.data}/scripts/rucio-reaper +6 -6
- {rucio-35.7.0.data → rucio-37.0.0.data}/scripts/rucio-transmogrifier +2 -2
- rucio-37.0.0.dist-info/METADATA +92 -0
- {rucio-35.7.0.dist-info → rucio-37.0.0.dist-info}/RECORD +237 -243
- {rucio-35.7.0.dist-info → rucio-37.0.0.dist-info}/licenses/AUTHORS.rst +3 -0
- rucio/common/schema/atlas.py +0 -413
- rucio/common/schema/belleii.py +0 -408
- rucio/common/schema/domatpc.py +0 -401
- rucio/common/schema/escape.py +0 -426
- rucio/common/schema/icecube.py +0 -406
- rucio/core/permission/atlas.py +0 -1348
- rucio/core/permission/belleii.py +0 -1077
- rucio/core/permission/escape.py +0 -1078
- rucio/daemons/c3po/algorithms/__init__.py +0 -13
- rucio/daemons/c3po/algorithms/simple.py +0 -134
- rucio/daemons/c3po/algorithms/t2_free_space.py +0 -128
- rucio/daemons/c3po/algorithms/t2_free_space_only_pop.py +0 -130
- rucio/daemons/c3po/algorithms/t2_free_space_only_pop_with_network.py +0 -294
- rucio/daemons/c3po/c3po.py +0 -371
- rucio/daemons/c3po/collectors/agis.py +0 -108
- rucio/daemons/c3po/collectors/free_space.py +0 -81
- rucio/daemons/c3po/collectors/jedi_did.py +0 -57
- rucio/daemons/c3po/collectors/mock_did.py +0 -51
- rucio/daemons/c3po/collectors/network_metrics.py +0 -71
- rucio/daemons/c3po/collectors/workload.py +0 -112
- rucio/daemons/c3po/utils/__init__.py +0 -13
- rucio/daemons/c3po/utils/dataset_cache.py +0 -50
- rucio/daemons/c3po/utils/expiring_dataset_cache.py +0 -56
- rucio/daemons/c3po/utils/expiring_list.py +0 -62
- rucio/daemons/c3po/utils/popularity.py +0 -85
- rucio/daemons/c3po/utils/timeseries.py +0 -89
- rucio/rse/protocols/gsiftp.py +0 -92
- rucio-35.7.0.data/scripts/rucio-c3po +0 -85
- rucio-35.7.0.dist-info/METADATA +0 -72
- /rucio/{daemons/c3po → cli/bin_legacy}/__init__.py +0 -0
- {rucio-35.7.0.data → rucio-37.0.0.data}/data/rucio/etc/globus-config.yml.template +0 -0
- {rucio-35.7.0.data → rucio-37.0.0.data}/data/rucio/etc/ldap.cfg.template +0 -0
- {rucio-35.7.0.data → rucio-37.0.0.data}/data/rucio/etc/mail_templates/rule_approval_request.tmpl +0 -0
- {rucio-35.7.0.data → rucio-37.0.0.data}/data/rucio/etc/mail_templates/rule_approved_admin.tmpl +0 -0
- {rucio-35.7.0.data → rucio-37.0.0.data}/data/rucio/etc/mail_templates/rule_approved_user.tmpl +0 -0
- {rucio-35.7.0.data → rucio-37.0.0.data}/data/rucio/etc/mail_templates/rule_denied_admin.tmpl +0 -0
- {rucio-35.7.0.data → rucio-37.0.0.data}/data/rucio/etc/mail_templates/rule_denied_user.tmpl +0 -0
- {rucio-35.7.0.data → rucio-37.0.0.data}/data/rucio/etc/mail_templates/rule_ok_notification.tmpl +0 -0
- {rucio-35.7.0.data → rucio-37.0.0.data}/data/rucio/etc/rse-accounts.cfg.template +0 -0
- {rucio-35.7.0.data → rucio-37.0.0.data}/data/rucio/tools/bootstrap.py +0 -0
- {rucio-35.7.0.data → rucio-37.0.0.data}/data/rucio/tools/merge_rucio_configs.py +0 -0
- {rucio-35.7.0.data → rucio-37.0.0.data}/data/rucio/tools/reset_database.py +0 -0
- {rucio-35.7.0.data → rucio-37.0.0.data}/scripts/rucio-abacus-account +0 -0
- {rucio-35.7.0.data → rucio-37.0.0.data}/scripts/rucio-abacus-collection-replica +0 -0
- {rucio-35.7.0.data → rucio-37.0.0.data}/scripts/rucio-abacus-rse +0 -0
- {rucio-35.7.0.data → rucio-37.0.0.data}/scripts/rucio-bb8 +0 -0
- {rucio-35.7.0.data → rucio-37.0.0.data}/scripts/rucio-cache-consumer +0 -0
- {rucio-35.7.0.data → rucio-37.0.0.data}/scripts/rucio-conveyor-finisher +0 -0
- {rucio-35.7.0.data → rucio-37.0.0.data}/scripts/rucio-conveyor-poller +0 -0
- {rucio-35.7.0.data → rucio-37.0.0.data}/scripts/rucio-conveyor-preparer +0 -0
- {rucio-35.7.0.data → rucio-37.0.0.data}/scripts/rucio-conveyor-stager +0 -0
- {rucio-35.7.0.data → rucio-37.0.0.data}/scripts/rucio-conveyor-submitter +0 -0
- {rucio-35.7.0.data → rucio-37.0.0.data}/scripts/rucio-conveyor-throttler +0 -0
- {rucio-35.7.0.data → rucio-37.0.0.data}/scripts/rucio-dark-reaper +0 -0
- {rucio-35.7.0.data → rucio-37.0.0.data}/scripts/rucio-dumper +0 -0
- {rucio-35.7.0.data → rucio-37.0.0.data}/scripts/rucio-follower +0 -0
- {rucio-35.7.0.data → rucio-37.0.0.data}/scripts/rucio-hermes +0 -0
- {rucio-35.7.0.data → rucio-37.0.0.data}/scripts/rucio-judge-cleaner +0 -0
- {rucio-35.7.0.data → rucio-37.0.0.data}/scripts/rucio-judge-evaluator +0 -0
- {rucio-35.7.0.data → rucio-37.0.0.data}/scripts/rucio-judge-injector +0 -0
- {rucio-35.7.0.data → rucio-37.0.0.data}/scripts/rucio-judge-repairer +0 -0
- {rucio-35.7.0.data → rucio-37.0.0.data}/scripts/rucio-oauth-manager +0 -0
- {rucio-35.7.0.data → rucio-37.0.0.data}/scripts/rucio-replica-recoverer +0 -0
- {rucio-35.7.0.data → rucio-37.0.0.data}/scripts/rucio-rse-decommissioner +0 -0
- {rucio-35.7.0.data → rucio-37.0.0.data}/scripts/rucio-storage-consistency-actions +0 -0
- {rucio-35.7.0.data → rucio-37.0.0.data}/scripts/rucio-undertaker +0 -0
- {rucio-35.7.0.dist-info → rucio-37.0.0.dist-info}/WHEEL +0 -0
- {rucio-35.7.0.dist-info → rucio-37.0.0.dist-info}/licenses/LICENSE +0 -0
- {rucio-35.7.0.dist-info → rucio-37.0.0.dist-info}/top_level.txt +0 -0
rucio/core/permission/belleii.py
DELETED
|
@@ -1,1077 +0,0 @@
|
|
|
1
|
-
# Copyright European Organization for Nuclear Research (CERN) since 2012
|
|
2
|
-
#
|
|
3
|
-
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
4
|
-
# you may not use this file except in compliance with the License.
|
|
5
|
-
# You may obtain a copy of the License at
|
|
6
|
-
#
|
|
7
|
-
# http://www.apache.org/licenses/LICENSE-2.0
|
|
8
|
-
#
|
|
9
|
-
# Unless required by applicable law or agreed to in writing, software
|
|
10
|
-
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
11
|
-
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
12
|
-
# See the License for the specific language governing permissions and
|
|
13
|
-
# limitations under the License.
|
|
14
|
-
|
|
15
|
-
from typing import TYPE_CHECKING
|
|
16
|
-
|
|
17
|
-
import rucio.core.scope
|
|
18
|
-
from rucio.common.config import config_get
|
|
19
|
-
from rucio.common.constants import RseAttr
|
|
20
|
-
from rucio.common.types import InternalAccount, InternalScope
|
|
21
|
-
from rucio.core.account import has_account_attribute, list_account_attributes
|
|
22
|
-
from rucio.core.did import get_metadata
|
|
23
|
-
from rucio.core.identity import exist_identity_account
|
|
24
|
-
from rucio.core.lifetime_exception import list_exceptions
|
|
25
|
-
from rucio.core.rse import list_rse_attributes
|
|
26
|
-
from rucio.core.rse_expression_parser import parse_expression
|
|
27
|
-
from rucio.core.rule import get_rule
|
|
28
|
-
from rucio.db.sqla.constants import IdentityType
|
|
29
|
-
|
|
30
|
-
if TYPE_CHECKING:
|
|
31
|
-
from typing import Optional
|
|
32
|
-
|
|
33
|
-
from sqlalchemy.orm import Session
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
def has_permission(issuer: "InternalAccount", action: str, kwargs: dict, *, session: "Optional[Session]" = None) -> bool:
|
|
37
|
-
"""
|
|
38
|
-
Checks if an account has the specified permission to
|
|
39
|
-
execute an action with parameters.
|
|
40
|
-
|
|
41
|
-
:param issuer: Account identifier which issues the command..
|
|
42
|
-
:param action: The action(API call) called by the account.
|
|
43
|
-
:param kwargs: List of arguments for the action.
|
|
44
|
-
:param session: The DB session to use
|
|
45
|
-
:returns: True if account is allowed, otherwise False
|
|
46
|
-
"""
|
|
47
|
-
perm = {'add_account': perm_add_account,
|
|
48
|
-
'del_account': perm_del_account,
|
|
49
|
-
'update_account': perm_update_account,
|
|
50
|
-
'add_rule': perm_add_rule,
|
|
51
|
-
'add_subscription': perm_add_subscription,
|
|
52
|
-
'add_scope': perm_add_scope,
|
|
53
|
-
'add_rse': perm_add_rse,
|
|
54
|
-
'update_rse': perm_update_rse,
|
|
55
|
-
'add_protocol': perm_add_protocol,
|
|
56
|
-
'del_protocol': perm_del_protocol,
|
|
57
|
-
'update_protocol': perm_update_protocol,
|
|
58
|
-
'declare_bad_file_replicas': perm_declare_bad_file_replicas,
|
|
59
|
-
'declare_suspicious_file_replicas': perm_declare_suspicious_file_replicas,
|
|
60
|
-
'add_replicas': perm_add_replicas,
|
|
61
|
-
'delete_replicas': perm_delete_replicas,
|
|
62
|
-
'skip_availability_check': perm_skip_availability_check,
|
|
63
|
-
'update_replicas_states': perm_update_replicas_states,
|
|
64
|
-
'add_rse_attribute': perm_add_rse_attribute,
|
|
65
|
-
'del_rse_attribute': perm_del_rse_attribute,
|
|
66
|
-
'del_rse': perm_del_rse,
|
|
67
|
-
'del_rule': perm_del_rule,
|
|
68
|
-
'update_rule': perm_update_rule,
|
|
69
|
-
'approve_rule': perm_approve_rule,
|
|
70
|
-
'update_subscription': perm_update_subscription,
|
|
71
|
-
'reduce_rule': perm_reduce_rule,
|
|
72
|
-
'move_rule': perm_move_rule,
|
|
73
|
-
'get_auth_token_user_pass': perm_get_auth_token_user_pass,
|
|
74
|
-
'get_auth_token_gss': perm_get_auth_token_gss,
|
|
75
|
-
'get_auth_token_x509': perm_get_auth_token_x509,
|
|
76
|
-
'get_auth_token_saml': perm_get_auth_token_saml,
|
|
77
|
-
'add_account_identity': perm_add_account_identity,
|
|
78
|
-
'add_did': perm_add_did,
|
|
79
|
-
'add_dids': perm_add_dids,
|
|
80
|
-
'attach_dids': perm_attach_dids,
|
|
81
|
-
'detach_dids': perm_detach_dids,
|
|
82
|
-
'attach_dids_to_dids': perm_attach_dids_to_dids,
|
|
83
|
-
'create_did_sample': perm_create_did_sample,
|
|
84
|
-
'set_metadata': perm_set_metadata,
|
|
85
|
-
'set_metadata_bulk': perm_set_metadata_bulk,
|
|
86
|
-
'set_status': perm_set_status,
|
|
87
|
-
'queue_requests': perm_queue_requests,
|
|
88
|
-
'set_rse_usage': perm_set_rse_usage,
|
|
89
|
-
'set_rse_limits': perm_set_rse_limits,
|
|
90
|
-
'get_request_by_did': perm_get_request_by_did,
|
|
91
|
-
'cancel_request': perm_cancel_request,
|
|
92
|
-
'get_next': perm_get_next,
|
|
93
|
-
'set_local_account_limit': perm_set_local_account_limit,
|
|
94
|
-
'set_global_account_limit': perm_set_global_account_limit,
|
|
95
|
-
'delete_local_account_limit': perm_delete_local_account_limit,
|
|
96
|
-
'delete_global_account_limit': perm_delete_global_account_limit,
|
|
97
|
-
'config_sections': perm_config,
|
|
98
|
-
'config_add_section': perm_config,
|
|
99
|
-
'config_has_section': perm_config,
|
|
100
|
-
'config_options': perm_config,
|
|
101
|
-
'config_has_option': perm_config,
|
|
102
|
-
'config_get': perm_config,
|
|
103
|
-
'config_items': perm_config,
|
|
104
|
-
'config_set': perm_config,
|
|
105
|
-
'config_remove_section': perm_config,
|
|
106
|
-
'config_remove_option': perm_config,
|
|
107
|
-
'get_local_account_usage': perm_get_local_account_usage,
|
|
108
|
-
'get_global_account_usage': perm_get_global_account_usage,
|
|
109
|
-
'add_attribute': perm_add_account_attribute,
|
|
110
|
-
'del_attribute': perm_del_account_attribute,
|
|
111
|
-
'list_heartbeats': perm_list_heartbeats,
|
|
112
|
-
'resurrect': perm_resurrect,
|
|
113
|
-
'update_lifetime_exceptions': perm_update_lifetime_exceptions,
|
|
114
|
-
'get_auth_token_ssh': perm_get_auth_token_ssh,
|
|
115
|
-
'get_signed_url': perm_get_signed_url,
|
|
116
|
-
'add_bad_pfns': perm_add_bad_pfns,
|
|
117
|
-
'del_account_identity': perm_del_account_identity,
|
|
118
|
-
'del_identity': perm_del_identity,
|
|
119
|
-
'remove_did_from_followed': perm_remove_did_from_followed,
|
|
120
|
-
'remove_dids_from_followed': perm_remove_dids_from_followed}
|
|
121
|
-
|
|
122
|
-
return perm.get(action, perm_default)(issuer=issuer, kwargs=kwargs, session=session)
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
def _is_root(issuer):
|
|
126
|
-
return issuer.external == 'root'
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
def _perm_country(issuer: "InternalAccount", rses: list, roles: list, *, session: "Optional[Session]" = None) -> bool:
|
|
130
|
-
admin_in_country = []
|
|
131
|
-
for kv in list_account_attributes(account=issuer, session=session):
|
|
132
|
-
if kv['key'].startswith('country-') and kv['value'] == 'admin':
|
|
133
|
-
admin_in_country.append(kv['key'].partition('-')[2])
|
|
134
|
-
if admin_in_country:
|
|
135
|
-
for rse in rses:
|
|
136
|
-
if list_rse_attributes(rse_id=rse['id'], session=session).get(RseAttr.COUNTRY) in admin_in_country:
|
|
137
|
-
return True
|
|
138
|
-
return False
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
def perm_default(issuer: "InternalAccount", kwargs: dict, *, session: "Optional[Session]" = None) -> bool:
|
|
142
|
-
"""
|
|
143
|
-
Default permission.
|
|
144
|
-
|
|
145
|
-
:param issuer: Account identifier which issues the command.
|
|
146
|
-
:param kwargs: List of arguments for the action.
|
|
147
|
-
:param session: The DB session to use
|
|
148
|
-
:returns: True if account is allowed, otherwise False
|
|
149
|
-
"""
|
|
150
|
-
return _is_root(issuer) or has_account_attribute(account=issuer, key='admin', session=session)
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
def perm_add_rse(issuer: "InternalAccount", kwargs: dict, *, session: "Optional[Session]" = None) -> bool:
|
|
154
|
-
"""
|
|
155
|
-
Checks if an account can add a RSE.
|
|
156
|
-
|
|
157
|
-
:param issuer: Account identifier which issues the command.
|
|
158
|
-
:param kwargs: List of arguments for the action.
|
|
159
|
-
:param session: The DB session to use
|
|
160
|
-
:returns: True if account is allowed, otherwise False
|
|
161
|
-
"""
|
|
162
|
-
return perm_default(issuer, kwargs, session=session)\
|
|
163
|
-
or has_account_attribute(account=issuer, key='rse_admin', session=session)
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
def perm_update_rse(issuer: "InternalAccount", kwargs: dict, *, session: "Optional[Session]" = None) -> bool:
|
|
167
|
-
"""
|
|
168
|
-
Checks if an account can update a RSE.
|
|
169
|
-
|
|
170
|
-
:param issuer: Account identifier which issues the command.
|
|
171
|
-
:param kwargs: List of arguments for the action.
|
|
172
|
-
:param session: The DB session to use
|
|
173
|
-
:returns: True if account is allowed, otherwise False
|
|
174
|
-
"""
|
|
175
|
-
return perm_default(issuer, kwargs, session=session)\
|
|
176
|
-
or has_account_attribute(account=issuer, key='rse_admin', session=session)
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
def perm_add_rule(issuer: "InternalAccount", kwargs: dict, *, session: "Optional[Session]" = None) -> bool:
|
|
180
|
-
"""
|
|
181
|
-
Checks if an account can add a replication rule.
|
|
182
|
-
|
|
183
|
-
:param issuer: Account identifier which issues the command.
|
|
184
|
-
:param kwargs: List of arguments for the action.
|
|
185
|
-
:param session: The DB session to use
|
|
186
|
-
:returns: True if account is allowed, otherwise False
|
|
187
|
-
"""
|
|
188
|
-
restricted_scopes = config_get('permission', 'restricted_scopes', raise_exception=False, default=[], session=session)
|
|
189
|
-
# TODO change to config_get_list
|
|
190
|
-
if kwargs['account'] == issuer:
|
|
191
|
-
if kwargs.get('scope') and restricted_scopes and kwargs['scope'] in restricted_scopes:
|
|
192
|
-
return False
|
|
193
|
-
if kwargs.get('dids'):
|
|
194
|
-
for did in kwargs['dids']:
|
|
195
|
-
if restricted_scopes and did['scope'] in restricted_scopes:
|
|
196
|
-
return False
|
|
197
|
-
return True
|
|
198
|
-
return perm_default(issuer, kwargs, session=session) or has_account_attribute(account=issuer, key='rule_admin', session=session)
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
def perm_add_subscription(issuer: "InternalAccount", kwargs: dict, *, session: "Optional[Session]" = None) -> bool:
|
|
202
|
-
"""
|
|
203
|
-
Checks if an account can add a subscription.
|
|
204
|
-
|
|
205
|
-
:param issuer: Account identifier which issues the command.
|
|
206
|
-
:param kwargs: List of arguments for the action.
|
|
207
|
-
:param session: The DB session to use
|
|
208
|
-
:returns: True if account is allowed, otherwise False
|
|
209
|
-
"""
|
|
210
|
-
return perm_default(issuer, kwargs, session=session)\
|
|
211
|
-
or has_account_attribute(account=issuer, key='subscription_admin', session=session)
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
def perm_add_rse_attribute(issuer: "InternalAccount", kwargs: dict, *, session: "Optional[Session]" = None) -> bool:
|
|
215
|
-
"""
|
|
216
|
-
Checks if an account can add a RSE attribute.
|
|
217
|
-
|
|
218
|
-
:param issuer: Account identifier which issues the command.
|
|
219
|
-
:param kwargs: List of arguments for the action.
|
|
220
|
-
:param session: The DB session to use
|
|
221
|
-
:returns: True if account is allowed, otherwise False
|
|
222
|
-
"""
|
|
223
|
-
return perm_default(issuer, kwargs, session=session)\
|
|
224
|
-
or has_account_attribute(account=issuer, key='rse_admin', session=session)
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
def perm_del_rse_attribute(issuer: "InternalAccount", kwargs: dict, *, session: "Optional[Session]" = None) -> bool:
|
|
228
|
-
"""
|
|
229
|
-
Checks if an account can delete a RSE attribute.
|
|
230
|
-
|
|
231
|
-
:param issuer: Account identifier which issues the command.
|
|
232
|
-
:param kwargs: List of arguments for the action.
|
|
233
|
-
:param session: The DB session to use
|
|
234
|
-
:returns: True if account is allowed, otherwise False
|
|
235
|
-
"""
|
|
236
|
-
return perm_default(issuer, kwargs, session=session)\
|
|
237
|
-
or has_account_attribute(account=issuer, key='rse_admin', session=session)
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
def perm_del_rse(issuer: "InternalAccount", kwargs: dict, *, session: "Optional[Session]" = None) -> bool:
|
|
241
|
-
"""
|
|
242
|
-
Checks if an account can delete a RSE.
|
|
243
|
-
|
|
244
|
-
:param issuer: Account identifier which issues the command.
|
|
245
|
-
:param kwargs: List of arguments for the action.
|
|
246
|
-
:param session: The DB session to use
|
|
247
|
-
:returns: True if account is allowed, otherwise False
|
|
248
|
-
"""
|
|
249
|
-
return perm_default(issuer, kwargs, session=session)\
|
|
250
|
-
or has_account_attribute(account=issuer, key='rse_admin', session=session)
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
def perm_add_account(issuer: "InternalAccount", kwargs: dict, *, session: "Optional[Session]" = None) -> bool:
|
|
254
|
-
"""
|
|
255
|
-
Checks if an account can add an account.
|
|
256
|
-
|
|
257
|
-
:param issuer: Account identifier which issues the command.
|
|
258
|
-
:param kwargs: List of arguments for the action.
|
|
259
|
-
:param session: The DB session to use
|
|
260
|
-
:returns: True if account is allowed, otherwise False
|
|
261
|
-
"""
|
|
262
|
-
return perm_default(issuer, kwargs, session=session)\
|
|
263
|
-
or has_account_attribute(account=issuer, key='account_admin', session=session)
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
def perm_del_account(issuer: "InternalAccount", kwargs: dict, *, session: "Optional[Session]" = None) -> bool:
|
|
267
|
-
"""
|
|
268
|
-
Checks if an account can del an account.
|
|
269
|
-
|
|
270
|
-
:param issuer: Account identifier which issues the command.
|
|
271
|
-
:param kwargs: List of arguments for the action.
|
|
272
|
-
:param session: The DB session to use
|
|
273
|
-
:returns: True if account is allowed, otherwise False
|
|
274
|
-
"""
|
|
275
|
-
return perm_default(issuer, kwargs, session=session)\
|
|
276
|
-
or has_account_attribute(account=issuer, key='account_admin', session=session)
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
def perm_update_account(issuer: "InternalAccount", kwargs: dict, *, session: "Optional[Session]" = None) -> bool:
|
|
280
|
-
"""
|
|
281
|
-
Checks if an account can update an account.
|
|
282
|
-
|
|
283
|
-
:param issuer: Account identifier which issues the command.
|
|
284
|
-
:param kwargs: List of arguments for the action.
|
|
285
|
-
:param session: The DB session to use
|
|
286
|
-
:returns: True if account is allowed, otherwise False
|
|
287
|
-
"""
|
|
288
|
-
return perm_default(issuer, kwargs, session=session)\
|
|
289
|
-
or has_account_attribute(account=issuer, key='account_admin', session=session)
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
def perm_add_scope(issuer: "InternalAccount", kwargs: dict, *, session: "Optional[Session]" = None) -> bool:
|
|
293
|
-
"""
|
|
294
|
-
Checks if an account can add a scope to an account.
|
|
295
|
-
|
|
296
|
-
:param issuer: Account identifier which issues the command.
|
|
297
|
-
:param kwargs: List of arguments for the action.
|
|
298
|
-
:param session: The DB session to use
|
|
299
|
-
:returns: True if account is allowed, otherwise False
|
|
300
|
-
"""
|
|
301
|
-
return perm_default(issuer, kwargs, session=session)\
|
|
302
|
-
or has_account_attribute(account=issuer, key='scope_admin', session=session)
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
def perm_get_auth_token_user_pass(issuer: "InternalAccount", kwargs: dict, *, session: "Optional[Session]" = None) -> bool:
|
|
306
|
-
"""
|
|
307
|
-
Checks if a user can request a token with user_pass for an account.
|
|
308
|
-
|
|
309
|
-
:param issuer: Account identifier which issues the command.
|
|
310
|
-
:param kwargs: List of arguments for the action.
|
|
311
|
-
:param session: The DB session to use
|
|
312
|
-
:returns: True if account is allowed, otherwise False
|
|
313
|
-
"""
|
|
314
|
-
if exist_identity_account(identity=kwargs['username'], type_=IdentityType.USERPASS, account=kwargs['account'], session=session):
|
|
315
|
-
return True
|
|
316
|
-
return False
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
def perm_get_auth_token_gss(issuer: "InternalAccount", kwargs: dict, *, session: "Optional[Session]" = None) -> bool:
|
|
320
|
-
"""
|
|
321
|
-
Checks if a user can request a token with user_pass for an account.
|
|
322
|
-
|
|
323
|
-
:param issuer: Account identifier which issues the command.
|
|
324
|
-
:param kwargs: List of arguments for the action.
|
|
325
|
-
:param session: The DB session to use
|
|
326
|
-
:returns: True if account is allowed, otherwise False
|
|
327
|
-
"""
|
|
328
|
-
if exist_identity_account(identity=kwargs['gsscred'], type_=IdentityType.GSS, account=kwargs['account'], session=session):
|
|
329
|
-
return True
|
|
330
|
-
return False
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
def perm_get_auth_token_x509(issuer: "InternalAccount", kwargs: dict, *, session: "Optional[Session]" = None) -> bool:
|
|
334
|
-
"""
|
|
335
|
-
Checks if a user can request a token with user_pass for an account.
|
|
336
|
-
|
|
337
|
-
:param issuer: Account identifier which issues the command.
|
|
338
|
-
:param kwargs: List of arguments for the action.
|
|
339
|
-
:param session: The DB session to use
|
|
340
|
-
:returns: True if account is allowed, otherwise False
|
|
341
|
-
"""
|
|
342
|
-
if exist_identity_account(identity=kwargs['dn'], type_=IdentityType.X509, account=kwargs['account'], session=session):
|
|
343
|
-
return True
|
|
344
|
-
return False
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
def perm_get_auth_token_saml(issuer: "InternalAccount", kwargs: dict, *, session: "Optional[Session]" = None) -> bool:
|
|
348
|
-
"""
|
|
349
|
-
Checks if a user can request a token with user_pass for an account.
|
|
350
|
-
|
|
351
|
-
:param issuer: Account identifier which issues the command.
|
|
352
|
-
:param kwargs: List of arguments for the action.
|
|
353
|
-
:param session: The DB session to use
|
|
354
|
-
:returns: True if account is allowed, otherwise False
|
|
355
|
-
"""
|
|
356
|
-
if exist_identity_account(identity=kwargs['saml_nameid'], type_=IdentityType.SAML, account=kwargs['account'], session=session):
|
|
357
|
-
return True
|
|
358
|
-
return False
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
def perm_add_account_identity(issuer: "InternalAccount", kwargs: dict, *, session: "Optional[Session]" = None) -> bool:
|
|
362
|
-
"""
|
|
363
|
-
Checks if an account can add an identity to an account.
|
|
364
|
-
|
|
365
|
-
:param issuer: Account identifier which issues the command.
|
|
366
|
-
:param kwargs: List of arguments for the action.
|
|
367
|
-
:param session: The DB session to use
|
|
368
|
-
:returns: True if account is allowed, otherwise False
|
|
369
|
-
"""
|
|
370
|
-
return perm_default(issuer, kwargs, session=session)\
|
|
371
|
-
or has_account_attribute(account=issuer, key='account_admin', session=session)
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
def perm_del_account_identity(issuer: "InternalAccount", kwargs: dict, *, session: "Optional[Session]" = None) -> bool:
|
|
375
|
-
"""
|
|
376
|
-
Checks if an account can delete an identity to an account.
|
|
377
|
-
|
|
378
|
-
:param issuer: Account identifier which issues the command.
|
|
379
|
-
:param kwargs: List of arguments for the action.
|
|
380
|
-
:param session: The DB session to use
|
|
381
|
-
:returns: True if account is allowed, otherwise False
|
|
382
|
-
"""
|
|
383
|
-
return perm_default(issuer, kwargs, session=session)\
|
|
384
|
-
or has_account_attribute(account=issuer, key='account_admin', session=session)
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
def perm_del_identity(issuer: "InternalAccount", kwargs: dict, *, session: "Optional[Session]" = None) -> bool:
|
|
388
|
-
"""
|
|
389
|
-
Checks if an account can delete an identity.
|
|
390
|
-
|
|
391
|
-
:param issuer: Account identifier which issues the command.
|
|
392
|
-
:param kwargs: List of arguments for the action.
|
|
393
|
-
:param session: The DB session to use
|
|
394
|
-
:returns: True if account is allowed, otherwise False
|
|
395
|
-
"""
|
|
396
|
-
return perm_default(issuer, kwargs, session=session)\
|
|
397
|
-
or has_account_attribute(account=issuer, key='account_admin', session=session)
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
def perm_add_did(issuer: "InternalAccount", kwargs: dict, *, session: "Optional[Session]" = None) -> bool:
|
|
401
|
-
"""
|
|
402
|
-
Checks if an account can add an data identifier to a scope.
|
|
403
|
-
|
|
404
|
-
:param issuer: Account identifier which issues the command.
|
|
405
|
-
:param kwargs: List of arguments for the action.
|
|
406
|
-
:param session: The DB session to use
|
|
407
|
-
:returns: True if account is allowed, otherwise False
|
|
408
|
-
"""
|
|
409
|
-
# Check the accounts of the issued rules
|
|
410
|
-
for rule in kwargs.get('rules', []):
|
|
411
|
-
kwargs_rule = rule
|
|
412
|
-
if 'scope' not in kwargs_rule:
|
|
413
|
-
if kwargs['scope'] and not isinstance(kwargs['scope'], str):
|
|
414
|
-
kwargs_rule['scope'] = kwargs['scope'].external
|
|
415
|
-
else:
|
|
416
|
-
kwargs_rule['scope'] = kwargs['scope']
|
|
417
|
-
if not perm_add_rule(issuer, kwargs=kwargs_rule, session=session):
|
|
418
|
-
return False
|
|
419
|
-
|
|
420
|
-
scope = kwargs['scope']
|
|
421
|
-
if isinstance(kwargs['scope'], str):
|
|
422
|
-
scope = InternalScope(kwargs['scope'])
|
|
423
|
-
return perm_default(issuer, kwargs, session=session)\
|
|
424
|
-
or has_account_attribute(account=issuer, key='did_admin', session=session)\
|
|
425
|
-
or has_account_attribute(account=issuer, key='production_account', session=session)\
|
|
426
|
-
or rucio.core.scope.is_scope_owner(scope=scope, account=issuer, session=session)\
|
|
427
|
-
or (kwargs.get('name', False) and kwargs['name'].startswith('/belle/scout'))
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
def perm_add_dids(issuer: "InternalAccount", kwargs: dict, *, session: "Optional[Session]" = None) -> bool:
|
|
431
|
-
"""
|
|
432
|
-
Checks if an account can bulk add data identifiers.
|
|
433
|
-
|
|
434
|
-
:param issuer: Account identifier which issues the command.
|
|
435
|
-
:param kwargs: List of arguments for the action.
|
|
436
|
-
:param session: The DB session to use
|
|
437
|
-
:returns: True if account is allowed, otherwise False
|
|
438
|
-
"""
|
|
439
|
-
# Check the accounts of the issued rules
|
|
440
|
-
for did in kwargs['dids']:
|
|
441
|
-
if not perm_add_did(issuer, kwargs=did, session=session):
|
|
442
|
-
return False
|
|
443
|
-
return True
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
def perm_attach_dids(issuer: "InternalAccount", kwargs: dict, *, session: "Optional[Session]" = None) -> bool:
|
|
447
|
-
"""
|
|
448
|
-
Checks if an account can append an data identifier to the other data identifier.
|
|
449
|
-
|
|
450
|
-
:param issuer: Account identifier which issues the command.
|
|
451
|
-
:param kwargs: List of arguments for the action.
|
|
452
|
-
:param session: The DB session to use
|
|
453
|
-
:returns: True if account is allowed, otherwise False
|
|
454
|
-
"""
|
|
455
|
-
return perm_default(issuer, kwargs, session=session)\
|
|
456
|
-
or has_account_attribute(account=issuer, key='did_admin', session=session)\
|
|
457
|
-
or rucio.core.scope.is_scope_owner(scope=kwargs['scope'], account=issuer, session=session)
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
def perm_attach_dids_to_dids(issuer: "InternalAccount", kwargs: dict, *, session: "Optional[Session]" = None) -> bool:
|
|
461
|
-
"""
|
|
462
|
-
Checks if an account can append an data identifier to the other data identifier.
|
|
463
|
-
|
|
464
|
-
:param issuer: Account identifier which issues the command.
|
|
465
|
-
:param kwargs: List of arguments for the action.
|
|
466
|
-
:param session: The DB session to use
|
|
467
|
-
:returns: True if account is allowed, otherwise False
|
|
468
|
-
"""
|
|
469
|
-
if perm_default(issuer, kwargs, session=session) or has_account_attribute(account=issuer, key='did_admin', session=session):
|
|
470
|
-
return True
|
|
471
|
-
else:
|
|
472
|
-
attachments = kwargs['attachments']
|
|
473
|
-
scopes = [did['scope'] for did in attachments]
|
|
474
|
-
scopes = list(set(scopes))
|
|
475
|
-
for scope in scopes:
|
|
476
|
-
if not rucio.core.scope.is_scope_owner(scope, issuer, session=session):
|
|
477
|
-
return False
|
|
478
|
-
return True
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
def perm_create_did_sample(issuer: "InternalAccount", kwargs: dict, *, session: "Optional[Session]" = None) -> bool:
|
|
482
|
-
"""
|
|
483
|
-
Checks if an account can create a sample of a data identifier collection.
|
|
484
|
-
|
|
485
|
-
:param issuer: Account identifier which issues the command.
|
|
486
|
-
:param kwargs: List of arguments for the action.
|
|
487
|
-
:param session: The DB session to use
|
|
488
|
-
:returns: True if account is allowed, otherwise False
|
|
489
|
-
"""
|
|
490
|
-
return perm_default(issuer, kwargs, session=session)\
|
|
491
|
-
or has_account_attribute(account=issuer, key='did_admin', session=session)\
|
|
492
|
-
or rucio.core.scope.is_scope_owner(scope=kwargs['scope'], account=issuer, session=session)\
|
|
493
|
-
or kwargs['scope'].external == 'mock'
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
def perm_del_rule(issuer: "InternalAccount", kwargs: dict, *, session: "Optional[Session]" = None) -> bool:
|
|
497
|
-
"""
|
|
498
|
-
Checks if an issuer can delete a replication rule.
|
|
499
|
-
|
|
500
|
-
:param issuer: Account identifier which issues the command.
|
|
501
|
-
:param kwargs: List of arguments for the action.
|
|
502
|
-
:param session: The DB session to use
|
|
503
|
-
:returns: True if account is allowed to call the API call, otherwise False
|
|
504
|
-
"""
|
|
505
|
-
rule = get_rule(rule_id=kwargs['rule_id'], session=session)
|
|
506
|
-
rses = parse_expression(rule['rse_expression'], filter_={'vo': issuer.vo}, session=session)
|
|
507
|
-
# Check if user is a country admin
|
|
508
|
-
if _perm_country(issuer=issuer, rses=rses, roles=['admin', ], session=session):
|
|
509
|
-
return True
|
|
510
|
-
|
|
511
|
-
# DELETERS can delete the rule
|
|
512
|
-
for rse in rses:
|
|
513
|
-
rse_attr = list_rse_attributes(rse_id=rse['id'], session=session)
|
|
514
|
-
if rse_attr.get(RseAttr.RULE_DELETERS):
|
|
515
|
-
if issuer.external in rse_attr.get(RseAttr.RULE_DELETERS).split(','):
|
|
516
|
-
return True
|
|
517
|
-
return perm_default(issuer, kwargs, session=session)\
|
|
518
|
-
or has_account_attribute(account=issuer, key='rule_admin', session=session)\
|
|
519
|
-
or get_rule(kwargs['rule_id'], session=session)['account'] == issuer
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
def perm_update_rule(issuer: "InternalAccount", kwargs: dict, *, session: "Optional[Session]" = None) -> bool:
|
|
523
|
-
"""
|
|
524
|
-
Checks if an issuer can update a replication rule.
|
|
525
|
-
|
|
526
|
-
:param issuer: Account identifier which issues the command.
|
|
527
|
-
:param kwargs: List of arguments for the action.
|
|
528
|
-
:param session: The DB session to use
|
|
529
|
-
:returns: True if account is allowed to call the API call, otherwise False
|
|
530
|
-
"""
|
|
531
|
-
return perm_default(issuer, kwargs, session=session)\
|
|
532
|
-
or has_account_attribute(account=issuer, key='rule_admin', session=session)\
|
|
533
|
-
or (kwargs.get('rule_id', False) and get_rule(kwargs['rule_id'], session=session)['account'] == issuer)
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
def perm_approve_rule(issuer: "InternalAccount", kwargs: dict, *, session: "Optional[Session]" = None) -> bool:
|
|
537
|
-
"""
|
|
538
|
-
Checks if an issuer can approve a replication rule.
|
|
539
|
-
|
|
540
|
-
:param issuer: Account identifier which issues the command.
|
|
541
|
-
:param kwargs: List of arguments for the action.
|
|
542
|
-
:param session: The DB session to use
|
|
543
|
-
:returns: True if account is allowed to call the API call, otherwise False
|
|
544
|
-
"""
|
|
545
|
-
return perm_default(issuer, kwargs, session=session)\
|
|
546
|
-
or has_account_attribute(account=issuer, key='rule_admin', session=session)
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
def perm_reduce_rule(issuer: "InternalAccount", kwargs: dict, *, session: "Optional[Session]" = None) -> bool:
|
|
550
|
-
"""
|
|
551
|
-
Checks if an issuer can reduce a replication rule.
|
|
552
|
-
|
|
553
|
-
:param issuer: Account identifier which issues the command.
|
|
554
|
-
:param kwargs: List of arguments for the action.
|
|
555
|
-
:param session: The DB session to use
|
|
556
|
-
:returns: True if account is allowed to call the API call, otherwise False
|
|
557
|
-
"""
|
|
558
|
-
return perm_default(issuer, kwargs, session=session)\
|
|
559
|
-
or has_account_attribute(account=issuer, key='rule_admin', session=session)
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
def perm_move_rule(issuer: "InternalAccount", kwargs: dict, *, session: "Optional[Session]" = None) -> bool:
|
|
563
|
-
"""
|
|
564
|
-
Checks if an issuer can move a replication rule.
|
|
565
|
-
|
|
566
|
-
:param issuer: Account identifier which issues the command.
|
|
567
|
-
:param kwargs: List of arguments for the action.
|
|
568
|
-
:param session: The DB session to use
|
|
569
|
-
:returns: True if account is allowed to call the API call, otherwise False
|
|
570
|
-
"""
|
|
571
|
-
return perm_default(issuer, kwargs, session=session)\
|
|
572
|
-
or has_account_attribute(account=issuer, key='rule_admin', session=session)\
|
|
573
|
-
or get_rule(kwargs['rule_id'], session=session)['account'] == issuer
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
def perm_update_subscription(issuer: "InternalAccount", kwargs: dict, *, session: "Optional[Session]" = None) -> bool:
|
|
577
|
-
"""
|
|
578
|
-
Checks if an account can update a subscription.
|
|
579
|
-
|
|
580
|
-
:param issuer: Account identifier which issues the command.
|
|
581
|
-
:param kwargs: List of arguments for the action.
|
|
582
|
-
:param session: The DB session to use
|
|
583
|
-
:returns: True if account is allowed, otherwise False
|
|
584
|
-
"""
|
|
585
|
-
return perm_default(issuer, kwargs, session=session)\
|
|
586
|
-
or has_account_attribute(account=issuer, key='subscription_admin', session=session)
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
def perm_detach_dids(issuer: "InternalAccount", kwargs: dict, *, session: "Optional[Session]" = None) -> bool:
|
|
590
|
-
"""
|
|
591
|
-
Checks if an account can detach an data identifier from the other data identifier.
|
|
592
|
-
|
|
593
|
-
:param issuer: Account identifier which issues the command.
|
|
594
|
-
:param kwargs: List of arguments for the action.
|
|
595
|
-
:param session: The DB session to use
|
|
596
|
-
:returns: True if account is allowed, otherwise False
|
|
597
|
-
"""
|
|
598
|
-
return perm_default(issuer, kwargs, session=session)\
|
|
599
|
-
or has_account_attribute(account=issuer, key='did_admin', session=session)\
|
|
600
|
-
or rucio.core.scope.is_scope_owner(scope=kwargs['scope'], account=issuer, session=session)
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
def perm_set_metadata_bulk(issuer: "InternalAccount", kwargs: dict, *, session: "Optional[Session]" = None) -> bool:
|
|
604
|
-
"""
|
|
605
|
-
Checks if an account can set a metadata on a data identifier.
|
|
606
|
-
|
|
607
|
-
:param issuer: Account identifier which issues the command.
|
|
608
|
-
:param kwargs: List of arguments for the action.
|
|
609
|
-
:param session: The DB session to use
|
|
610
|
-
:returns: True if account is allowed, otherwise False
|
|
611
|
-
"""
|
|
612
|
-
meta = get_metadata(kwargs['scope'], kwargs['name'], session=session)
|
|
613
|
-
return perm_default(issuer, kwargs, session=session)\
|
|
614
|
-
or has_account_attribute(account=issuer, key='did_admin', session=session)\
|
|
615
|
-
or meta.get('account', '') == issuer\
|
|
616
|
-
or rucio.core.scope.is_scope_owner(scope=kwargs['scope'], account=issuer, session=session)
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
def perm_set_metadata(issuer: "InternalAccount", kwargs: dict, *, session: "Optional[Session]" = None) -> bool:
|
|
620
|
-
"""
|
|
621
|
-
Checks if an account can set a metadata on a data identifier.
|
|
622
|
-
|
|
623
|
-
:param issuer: Account identifier which issues the command.
|
|
624
|
-
:param kwargs: List of arguments for the action.
|
|
625
|
-
:param session: The DB session to use
|
|
626
|
-
:returns: True if account is allowed, otherwise False
|
|
627
|
-
"""
|
|
628
|
-
meta = get_metadata(kwargs['scope'], kwargs['name'], session=session)
|
|
629
|
-
return perm_default(issuer, kwargs, session=session)\
|
|
630
|
-
or has_account_attribute(account=issuer, key='did_admin', session=session)\
|
|
631
|
-
or meta.get('account', '') == issuer\
|
|
632
|
-
or rucio.core.scope.is_scope_owner(scope=kwargs['scope'], account=issuer, session=session)
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
def perm_set_status(issuer: "InternalAccount", kwargs: dict, *, session: "Optional[Session]" = None) -> bool:
|
|
636
|
-
"""
|
|
637
|
-
Checks if an account can set status on an data identifier.
|
|
638
|
-
|
|
639
|
-
:param issuer: Account identifier which issues the command.
|
|
640
|
-
:param kwargs: List of arguments for the action.
|
|
641
|
-
:param session: The DB session to use
|
|
642
|
-
:returns: True if account is allowed, otherwise False
|
|
643
|
-
"""
|
|
644
|
-
meta = get_metadata(kwargs['scope'], kwargs['name'], session=session)
|
|
645
|
-
return perm_default(issuer, kwargs, session=session)\
|
|
646
|
-
or has_account_attribute(account=issuer, key='did_admin', session=session)\
|
|
647
|
-
or meta.get('account', '') == issuer\
|
|
648
|
-
or rucio.core.scope.is_scope_owner(scope=kwargs['scope'], account=issuer, session=session)
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
def perm_add_protocol(issuer: "InternalAccount", kwargs: dict, *, session: "Optional[Session]" = None) -> bool:
|
|
652
|
-
"""
|
|
653
|
-
Checks if an account can add a protocol to an RSE.
|
|
654
|
-
|
|
655
|
-
:param issuer: Account identifier which issues the command.
|
|
656
|
-
:param kwargs: List of arguments for the action.
|
|
657
|
-
:param session: The DB session to use
|
|
658
|
-
:returns: True if account is allowed, otherwise False
|
|
659
|
-
"""
|
|
660
|
-
return perm_default(issuer, kwargs, session=session)\
|
|
661
|
-
or has_account_attribute(account=issuer, key='rse_admin', session=session)
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
def perm_del_protocol(issuer: "InternalAccount", kwargs: dict, *, session: "Optional[Session]" = None) -> bool:
|
|
665
|
-
"""
|
|
666
|
-
Checks if an account can delete protocols from an RSE.
|
|
667
|
-
|
|
668
|
-
:param issuer: Account identifier which issues the command.
|
|
669
|
-
:param kwargs: List of arguments for the action.
|
|
670
|
-
:param session: The DB session to use
|
|
671
|
-
:returns: True if account is allowed, otherwise False
|
|
672
|
-
"""
|
|
673
|
-
return perm_default(issuer, kwargs, session=session)\
|
|
674
|
-
or has_account_attribute(account=issuer, key='rse_admin', session=session)
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
def perm_update_protocol(issuer: "InternalAccount", kwargs: dict, *, session: "Optional[Session]" = None) -> bool:
|
|
678
|
-
"""
|
|
679
|
-
Checks if an account can update protocols of an RSE.
|
|
680
|
-
|
|
681
|
-
:param issuer: Account identifier which issues the command.
|
|
682
|
-
:param kwargs: List of arguments for the action.
|
|
683
|
-
:param session: The DB session to use
|
|
684
|
-
:returns: True if account is allowed, otherwise False
|
|
685
|
-
"""
|
|
686
|
-
return perm_default(issuer, kwargs, session=session)\
|
|
687
|
-
or has_account_attribute(account=issuer, key='rse_admin', session=session)
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
def perm_declare_bad_file_replicas(issuer: "InternalAccount", kwargs: dict, *, session: "Optional[Session]" = None) -> bool:
|
|
691
|
-
"""
|
|
692
|
-
Checks if an account can declare bad file replicas.
|
|
693
|
-
|
|
694
|
-
:param issuer: Account identifier which issues the command.
|
|
695
|
-
:param kwargs: List of arguments for the action.
|
|
696
|
-
:param session: The DB session to use
|
|
697
|
-
:returns: True if account is allowed, otherwise False
|
|
698
|
-
"""
|
|
699
|
-
return perm_default(issuer, kwargs, session=session)
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
def perm_declare_suspicious_file_replicas(issuer: "InternalAccount", kwargs: dict, *, session: "Optional[Session]" = None) -> bool:
|
|
703
|
-
"""
|
|
704
|
-
Checks if an account can declare suspicious file replicas.
|
|
705
|
-
|
|
706
|
-
:param issuer: Account identifier which issues the command.
|
|
707
|
-
:param kwargs: List of arguments for the action.
|
|
708
|
-
:param session: The DB session to use
|
|
709
|
-
:returns: True if account is allowed, otherwise False
|
|
710
|
-
"""
|
|
711
|
-
return True
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
def perm_add_replicas(issuer: "InternalAccount", kwargs: dict, *, session: "Optional[Session]" = None) -> bool:
|
|
715
|
-
"""
|
|
716
|
-
Checks if an account can add replicas.
|
|
717
|
-
|
|
718
|
-
:param issuer: Account identifier which issues the command.
|
|
719
|
-
:param kwargs: List of arguments for the action.
|
|
720
|
-
:param session: The DB session to use
|
|
721
|
-
:returns: True if account is allowed, otherwise False
|
|
722
|
-
"""
|
|
723
|
-
rses = [{'id': kwargs['rse_id']}]
|
|
724
|
-
if str(kwargs.get('rse', '')).endswith('LOCAL-SE')\
|
|
725
|
-
and _perm_country(issuer=issuer, rses=rses, roles=['admin', 'user'], session=session):
|
|
726
|
-
return True
|
|
727
|
-
return str(kwargs.get('rse', '')).endswith('TMP-SE')\
|
|
728
|
-
or perm_default(issuer, kwargs, session=session)
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
def perm_skip_availability_check(issuer: "InternalAccount", kwargs: dict, *, session: "Optional[Session]" = None) -> bool:
|
|
732
|
-
"""
|
|
733
|
-
Checks if an account can skip the availabity check to add/delete file replicas.
|
|
734
|
-
|
|
735
|
-
:param issuer: Account identifier which issues the command.
|
|
736
|
-
:param kwargs: List of arguments for the action.
|
|
737
|
-
:param session: The DB session to use
|
|
738
|
-
:returns: True if account is allowed, otherwise False
|
|
739
|
-
"""
|
|
740
|
-
return perm_default(issuer, kwargs, session=session)
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
def perm_delete_replicas(issuer: "InternalAccount", kwargs: dict, *, session: "Optional[Session]" = None) -> bool:
|
|
744
|
-
"""
|
|
745
|
-
Checks if an account can delete replicas.
|
|
746
|
-
|
|
747
|
-
:param issuer: Account identifier which issues the command.
|
|
748
|
-
:param kwargs: List of arguments for the action.
|
|
749
|
-
:param session: The DB session to use
|
|
750
|
-
:returns: True if account is allowed, otherwise False
|
|
751
|
-
"""
|
|
752
|
-
return False
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
def perm_update_replicas_states(issuer: "InternalAccount", kwargs: dict, *, session: "Optional[Session]" = None) -> bool:
|
|
756
|
-
"""
|
|
757
|
-
Checks if an account can delete replicas.
|
|
758
|
-
|
|
759
|
-
:param issuer: Account identifier which issues the command.
|
|
760
|
-
:param kwargs: List of arguments for the action.
|
|
761
|
-
:param session: The DB session to use
|
|
762
|
-
:returns: True if account is allowed, otherwise False
|
|
763
|
-
"""
|
|
764
|
-
return perm_default(issuer, kwargs, session=session)
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
def perm_queue_requests(issuer: "InternalAccount", kwargs: dict, *, session: "Optional[Session]" = None) -> bool:
|
|
768
|
-
"""
|
|
769
|
-
Checks if an account can submit transfer or deletion requests on destination RSEs for data identifiers.
|
|
770
|
-
|
|
771
|
-
:param issuer: Account identifier which issues the command.
|
|
772
|
-
:param kwargs: List of arguments for the action.
|
|
773
|
-
:param session: The DB session to use
|
|
774
|
-
:returns: True if account is allowed, otherwise False
|
|
775
|
-
"""
|
|
776
|
-
return _is_root(issuer)
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
def perm_query_request(issuer: "InternalAccount", kwargs: dict, *, session: "Optional[Session]" = None) -> bool:
|
|
780
|
-
"""
|
|
781
|
-
Checks if an account can query a request.
|
|
782
|
-
|
|
783
|
-
:param issuer: Account identifier which issues the command.
|
|
784
|
-
:param kwargs: List of arguments for the action.
|
|
785
|
-
:param session: The DB session to use
|
|
786
|
-
:returns: True if account is allowed, otherwise False
|
|
787
|
-
"""
|
|
788
|
-
return _is_root(issuer)
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
def perm_get_request_by_did(issuer: "InternalAccount", kwargs: dict, *, session: "Optional[Session]" = None) -> bool:
|
|
792
|
-
"""
|
|
793
|
-
Checks if an account can get a request by DID.
|
|
794
|
-
|
|
795
|
-
:param issuer: Account identifier which issues the command.
|
|
796
|
-
:param kwargs: List of arguments for the action.
|
|
797
|
-
:param session: The DB session to use
|
|
798
|
-
:returns: True if account is allowed, otherwise False
|
|
799
|
-
"""
|
|
800
|
-
return True
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
def perm_cancel_request(issuer: "InternalAccount", kwargs: dict, *, session: "Optional[Session]" = None) -> bool:
|
|
804
|
-
"""
|
|
805
|
-
Checks if an account can cancel a request.
|
|
806
|
-
|
|
807
|
-
:param issuer: Account identifier which issues the command.
|
|
808
|
-
:param kwargs: List of arguments for the action.
|
|
809
|
-
:param session: The DB session to use
|
|
810
|
-
:returns: True if account is allowed, otherwise False
|
|
811
|
-
"""
|
|
812
|
-
return _is_root(issuer)
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
def perm_get_next(issuer: "InternalAccount", kwargs: dict, *, session: "Optional[Session]" = None) -> bool:
|
|
816
|
-
"""
|
|
817
|
-
Checks if an account can retrieve the next request matching the request type and state.
|
|
818
|
-
|
|
819
|
-
:param issuer: Account identifier which issues the command.
|
|
820
|
-
:param kwargs: List of arguments for the action.
|
|
821
|
-
:param session: The DB session to use
|
|
822
|
-
:returns: True if account is allowed, otherwise False
|
|
823
|
-
"""
|
|
824
|
-
return _is_root(issuer)
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
def perm_set_rse_usage(issuer: "InternalAccount", kwargs: dict, *, session: "Optional[Session]" = None) -> bool:
|
|
828
|
-
"""
|
|
829
|
-
Checks if an account can set RSE usage information.
|
|
830
|
-
|
|
831
|
-
:param issuer: Account identifier which issues the command.
|
|
832
|
-
:param kwargs: List of arguments for the action.
|
|
833
|
-
:param session: The DB session to use
|
|
834
|
-
:returns: True if account is allowed to call the API call, otherwise False
|
|
835
|
-
"""
|
|
836
|
-
return perm_default(issuer, kwargs, session=session)\
|
|
837
|
-
or has_account_attribute(account=issuer, key='rse_admin', session=session)
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
def perm_set_rse_limits(issuer: "InternalAccount", kwargs: dict, *, session: "Optional[Session]" = None) -> bool:
|
|
841
|
-
"""
|
|
842
|
-
Checks if an account can set RSE limits.
|
|
843
|
-
|
|
844
|
-
:param issuer: Account identifier which issues the command.
|
|
845
|
-
:param kwargs: List of arguments for the action.
|
|
846
|
-
:param session: The DB session to use
|
|
847
|
-
:returns: True if account is allowed to call the API call, otherwise False
|
|
848
|
-
"""
|
|
849
|
-
return perm_default(issuer, kwargs, session=session)\
|
|
850
|
-
or has_account_attribute(account=issuer, key='rse_admin', session=session)
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
def perm_set_local_account_limit(issuer: "InternalAccount", kwargs: dict, *, session: "Optional[Session]" = None) -> bool:
|
|
854
|
-
"""
|
|
855
|
-
Checks if an account can set an account limit.
|
|
856
|
-
|
|
857
|
-
:param account: Account identifier which issues the command.
|
|
858
|
-
:param kwargs: List of arguments for the action.
|
|
859
|
-
:param session: The DB session to use
|
|
860
|
-
:returns: True if account is allowed, otherwise False
|
|
861
|
-
"""
|
|
862
|
-
rses = [{'id': kwargs['rse_id']}]
|
|
863
|
-
if _perm_country(issuer=issuer, rses=rses, roles=['admin', ], session=session):
|
|
864
|
-
return True
|
|
865
|
-
return perm_default(issuer, kwargs, session=session)\
|
|
866
|
-
or (has_account_attribute(account=issuer, key='rse_admin', session=session) and has_account_attribute(account=issuer, key='account_admin', session=session))
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
def perm_set_global_account_limit(issuer: "InternalAccount", kwargs: dict, *, session: "Optional[Session]" = None) -> bool:
|
|
870
|
-
"""
|
|
871
|
-
Checks if an account can set a global account limit.
|
|
872
|
-
|
|
873
|
-
:param account: Account identifier which issues the command.
|
|
874
|
-
:param kwargs: List of arguments for the action.
|
|
875
|
-
:param session: The DB session to use
|
|
876
|
-
:returns: True if account is allowed, otherwise False
|
|
877
|
-
"""
|
|
878
|
-
return perm_default(issuer, kwargs, session=session)\
|
|
879
|
-
or (has_account_attribute(account=issuer, key='rse_admin', session=session) and has_account_attribute(account=issuer, key='account_admin', session=session))
|
|
880
|
-
|
|
881
|
-
|
|
882
|
-
def perm_delete_local_account_limit(issuer: "InternalAccount", kwargs: dict, *, session: "Optional[Session]" = None) -> bool:
|
|
883
|
-
"""
|
|
884
|
-
Checks if an account can delete an account limit.
|
|
885
|
-
|
|
886
|
-
:param account: Account identifier which issues the command.
|
|
887
|
-
:param kwargs: List of arguments for the action.
|
|
888
|
-
:param session: The DB session to use
|
|
889
|
-
:returns: True if account is allowed, otherwise False
|
|
890
|
-
"""
|
|
891
|
-
return perm_default(issuer, kwargs, session=session)\
|
|
892
|
-
or (has_account_attribute(account=issuer, key='rse_admin', session=session) and has_account_attribute(account=issuer, key='account_admin', session=session))
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
def perm_delete_global_account_limit(issuer: "InternalAccount", kwargs: dict, *, session: "Optional[Session]" = None) -> bool:
|
|
896
|
-
"""
|
|
897
|
-
Checks if an account can delete a global account limit.
|
|
898
|
-
|
|
899
|
-
:param issuer: Account identifier which issues the command.
|
|
900
|
-
:param kwargs: List of arguments for the action.
|
|
901
|
-
:param session: The DB session to use
|
|
902
|
-
:returns: True if account is allowed, otherwise False
|
|
903
|
-
"""
|
|
904
|
-
return perm_default(issuer, kwargs, session=session)\
|
|
905
|
-
or (has_account_attribute(account=issuer, key='rse_admin', session=session) and has_account_attribute(account=issuer, key='account_admin', session=session))
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
def perm_config(issuer: "InternalAccount", kwargs: dict, *, session: "Optional[Session]" = None) -> bool:
|
|
909
|
-
"""
|
|
910
|
-
Checks if an account can read/write the configuration.
|
|
911
|
-
|
|
912
|
-
:param issuer: Account identifier which issues the command.
|
|
913
|
-
:param kwargs: List of arguments for the action.
|
|
914
|
-
:param session: The DB session to use
|
|
915
|
-
:returns: True if account is allowed to call the API call, otherwise False
|
|
916
|
-
"""
|
|
917
|
-
return perm_default(issuer, kwargs, session=session)\
|
|
918
|
-
or has_account_attribute(account=issuer, key='config_admin', session=session)
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
def perm_get_local_account_usage(issuer: "InternalAccount", kwargs: dict, *, session: "Optional[Session]" = None) -> bool:
|
|
922
|
-
"""
|
|
923
|
-
Checks if an account can get the account usage of an account.
|
|
924
|
-
|
|
925
|
-
:param issuer: Account identifier which issues the command.
|
|
926
|
-
:param kwargs: List of arguments for the action.
|
|
927
|
-
:param session: The DB session to use
|
|
928
|
-
:returns: True if account is allowed, otherwise False
|
|
929
|
-
"""
|
|
930
|
-
return perm_default(issuer, kwargs, session=session)\
|
|
931
|
-
or kwargs.get('account') == issuer\
|
|
932
|
-
or has_account_attribute(account=issuer, key='rse_admin', session=session)\
|
|
933
|
-
or has_account_attribute(account=issuer, key='account_admin', session=session)
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
def perm_get_global_account_usage(issuer: "InternalAccount", kwargs: dict, *, session: "Optional[Session]" = None) -> bool:
|
|
937
|
-
"""
|
|
938
|
-
Checks if an account can get the account usage of an account.
|
|
939
|
-
|
|
940
|
-
:param issuer: Account identifier which issues the command.
|
|
941
|
-
:param kwargs: List of arguments for the action.
|
|
942
|
-
:param session: The DB session to use
|
|
943
|
-
:returns: True if account is allowed, otherwise False
|
|
944
|
-
"""
|
|
945
|
-
return perm_default(issuer, kwargs, session=session)\
|
|
946
|
-
or kwargs.get('account') == issuer\
|
|
947
|
-
or has_account_attribute(account=issuer, key='rse_admin', session=session)\
|
|
948
|
-
or has_account_attribute(account=issuer, key='account_admin', session=session)
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
def perm_add_account_attribute(issuer: "InternalAccount", kwargs: dict, *, session: "Optional[Session]" = None) -> bool:
|
|
952
|
-
"""
|
|
953
|
-
Checks if an account can add attributes to accounts.
|
|
954
|
-
|
|
955
|
-
:param issuer: Account identifier which issues the command.
|
|
956
|
-
:param kwargs: List of arguments for the action.
|
|
957
|
-
:param session: The DB session to use
|
|
958
|
-
:returns: True if account is allowed to call the API call, otherwise False
|
|
959
|
-
"""
|
|
960
|
-
return perm_default(issuer, kwargs, session=session)\
|
|
961
|
-
or has_account_attribute(account=issuer, key='account_admin', session=session)
|
|
962
|
-
|
|
963
|
-
|
|
964
|
-
def perm_del_account_attribute(issuer: "InternalAccount", kwargs: dict, *, session: "Optional[Session]" = None) -> bool:
|
|
965
|
-
"""
|
|
966
|
-
Checks if an account can add attributes to accounts.
|
|
967
|
-
|
|
968
|
-
:param issuer: Account identifier which issues the command.
|
|
969
|
-
:param kwargs: List of arguments for the action.
|
|
970
|
-
:param session: The DB session to use
|
|
971
|
-
:returns: True if account is allowed to call the API call, otherwise False
|
|
972
|
-
"""
|
|
973
|
-
return perm_default(issuer, kwargs, session=session)\
|
|
974
|
-
or has_account_attribute(account=issuer, key='account_admin', session=session)
|
|
975
|
-
|
|
976
|
-
|
|
977
|
-
def perm_list_heartbeats(issuer: "InternalAccount", kwargs: dict, *, session: "Optional[Session]" = None) -> bool:
|
|
978
|
-
"""
|
|
979
|
-
Checks if an account can list heartbeats.
|
|
980
|
-
|
|
981
|
-
:param issuer: Account identifier which issues the command.
|
|
982
|
-
:param kwargs: List of arguments for the action.
|
|
983
|
-
:param session: The DB session to use
|
|
984
|
-
:returns: True if account is allowed to call the API call, otherwise False
|
|
985
|
-
"""
|
|
986
|
-
return perm_default(issuer, kwargs, session=session)
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
def perm_resurrect(issuer: "InternalAccount", kwargs: dict, *, session: "Optional[Session]" = None) -> bool:
|
|
990
|
-
"""
|
|
991
|
-
Checks if an account can resurrect DIDS.
|
|
992
|
-
|
|
993
|
-
:param issuer: Account identifier which issues the command.
|
|
994
|
-
:param kwargs: List of arguments for the action.
|
|
995
|
-
:param session: The DB session to use
|
|
996
|
-
:returns: True if account is allowed to call the API call, otherwise False
|
|
997
|
-
"""
|
|
998
|
-
return perm_default(issuer, kwargs, session=session)
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
def perm_update_lifetime_exceptions(issuer: "InternalAccount", kwargs: dict, *, session: "Optional[Session]" = None) -> bool:
|
|
1002
|
-
"""
|
|
1003
|
-
Checks if an account can approve/reject Lifetime Model exceptions.
|
|
1004
|
-
|
|
1005
|
-
:param issuer: Account identifier which issues the command.
|
|
1006
|
-
:param kwargs: List of arguments for the action.
|
|
1007
|
-
:param session: The DB session to use
|
|
1008
|
-
:returns: True if account is allowed to call the API call, otherwise False
|
|
1009
|
-
"""
|
|
1010
|
-
if kwargs['vo'] is not None:
|
|
1011
|
-
exceptions = next(list_exceptions(exception_id=kwargs['exception_id'], states=False, session=session))
|
|
1012
|
-
if exceptions['scope'].vo != kwargs['vo']:
|
|
1013
|
-
return False
|
|
1014
|
-
return perm_default(issuer, kwargs, session=session)
|
|
1015
|
-
|
|
1016
|
-
|
|
1017
|
-
def perm_get_auth_token_ssh(issuer: "InternalAccount", kwargs: dict, *, session: "Optional[Session]" = None) -> bool:
|
|
1018
|
-
"""
|
|
1019
|
-
Checks if an account can request an ssh token.
|
|
1020
|
-
|
|
1021
|
-
:param issuer: Account identifier which issues the command.
|
|
1022
|
-
:param kwargs: List of arguments for the action.
|
|
1023
|
-
:param session: The DB session to use
|
|
1024
|
-
:returns: True if account is allowed to call the API call, otherwise False
|
|
1025
|
-
"""
|
|
1026
|
-
return True
|
|
1027
|
-
|
|
1028
|
-
|
|
1029
|
-
def perm_get_signed_url(issuer: "InternalAccount", kwargs: dict, *, session: "Optional[Session]" = None) -> bool:
|
|
1030
|
-
"""
|
|
1031
|
-
Checks if an account can request a signed URL.
|
|
1032
|
-
|
|
1033
|
-
:param issuer: Account identifier which issues the command.
|
|
1034
|
-
:param kwargs: List of arguments for the action.
|
|
1035
|
-
:param session: The DB session to use
|
|
1036
|
-
:returns: True if account is allowed to call the API call, otherwise False
|
|
1037
|
-
"""
|
|
1038
|
-
return perm_default(issuer, kwargs, session=session)\
|
|
1039
|
-
or has_account_attribute(account=issuer, key='sign-gcs', session=session)
|
|
1040
|
-
|
|
1041
|
-
|
|
1042
|
-
def perm_add_bad_pfns(issuer: "InternalAccount", kwargs: dict, *, session: "Optional[Session]" = None) -> bool:
|
|
1043
|
-
"""
|
|
1044
|
-
Checks if an account can declare bad PFNs.
|
|
1045
|
-
|
|
1046
|
-
:param issuer: Account identifier which issues the command.
|
|
1047
|
-
:param kwargs: List of arguments for the action.
|
|
1048
|
-
:param session: The DB session to use
|
|
1049
|
-
:returns: True if account is allowed, otherwise False
|
|
1050
|
-
"""
|
|
1051
|
-
return perm_default(issuer, kwargs, session=session)
|
|
1052
|
-
|
|
1053
|
-
|
|
1054
|
-
def perm_remove_did_from_followed(issuer: "InternalAccount", kwargs: dict, *, session: "Optional[Session]" = None) -> bool:
|
|
1055
|
-
"""
|
|
1056
|
-
Checks if an account can remove did from followed table.
|
|
1057
|
-
|
|
1058
|
-
:param issuer: Account identifier which issues the command.
|
|
1059
|
-
:param kwargs: List of arguments for the action.
|
|
1060
|
-
:param session: The DB session to use
|
|
1061
|
-
:returns: True if account is allowed, otherwise False
|
|
1062
|
-
"""
|
|
1063
|
-
return perm_default(issuer, kwargs, session=session)\
|
|
1064
|
-
or kwargs['account'] == issuer
|
|
1065
|
-
|
|
1066
|
-
|
|
1067
|
-
def perm_remove_dids_from_followed(issuer: "InternalAccount", kwargs: dict, *, session: "Optional[Session]" = None) -> bool:
|
|
1068
|
-
"""
|
|
1069
|
-
Checks if an account can bulk remove dids from followed table.
|
|
1070
|
-
|
|
1071
|
-
:param issuer: Account identifier which issues the command.
|
|
1072
|
-
:param kwargs: List of arguments for the action.
|
|
1073
|
-
:param session: The DB session to use
|
|
1074
|
-
:returns: True if account is allowed, otherwise False
|
|
1075
|
-
"""
|
|
1076
|
-
return perm_default(issuer, kwargs, session=session)\
|
|
1077
|
-
or kwargs['account'] == issuer
|