mirror of
https://github.com/netbox-community/netbox.git
synced 2026-04-12 04:00:02 +02:00
Closes #21884: Deprecate the DEFAULT_ACTION_PERMISSIONS constant
This commit is contained in:
@@ -44,9 +44,9 @@ ADVISORY_LOCK_KEYS = {
|
||||
'job-schedules': 110100,
|
||||
}
|
||||
|
||||
# TODO: Remove in NetBox v4.5
|
||||
# TODO: Remove in NetBox v4.7
|
||||
# Legacy default view action permission mapping
|
||||
DEFAULT_ACTION_PERMISSIONS = {
|
||||
_DEFAULT_ACTION_PERMISSIONS = {
|
||||
'add': {'add'},
|
||||
'export': {'view'},
|
||||
'bulk_import': {'add'},
|
||||
@@ -54,6 +54,20 @@ DEFAULT_ACTION_PERMISSIONS = {
|
||||
'bulk_delete': {'delete'},
|
||||
}
|
||||
|
||||
|
||||
def __getattr__(name):
|
||||
if name == 'DEFAULT_ACTION_PERMISSIONS':
|
||||
import warnings
|
||||
warnings.warn(
|
||||
f"{name} is deprecated and will be removed in NetBox v4.7. "
|
||||
"Define action permissions via ObjectAction subclasses instead.",
|
||||
DeprecationWarning,
|
||||
stacklevel=2,
|
||||
)
|
||||
return _DEFAULT_ACTION_PERMISSIONS
|
||||
raise AttributeError(f"module {__name__!r} has no attribute {name!r}")
|
||||
|
||||
|
||||
# General-purpose tokens
|
||||
CENSOR_TOKEN = '********'
|
||||
CENSOR_TOKEN_CHANGED = '***CHANGED***'
|
||||
|
||||
Reference in New Issue
Block a user