File: void.py

package info (click to toggle)
python-pysnmp4 7.1.22-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 3,504 kB
  • sloc: python: 33,673; makefile: 169; javascript: 4
file content (40 lines) | stat: -rw-r--r-- 979 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#
# This file is part of pysnmp software.
#
# Copyright (c) 2005-2020, Ilya Etingof <etingof@gmail.com>
# License: https://www.pysnmp.com/pysnmp/license.html
#
from typing import TYPE_CHECKING


from pysnmp import debug
from pysnmp.proto import errind, error

if TYPE_CHECKING:
    from pysnmp.entity.engine import SnmpEngine


# rfc3415 3.2
# noinspection PyUnusedLocal
class Vacm:
    """Void Access Control Model."""

    ACCESS_MODEL_ID = 0

    def is_access_allowed(
        self,
        snmpEngine: "SnmpEngine",
        securityModel,
        securityName,
        securityLevel,
        viewType,
        contextName,
        variableName,
    ):
        """Return whether access is allowed to a MIB object."""
        debug.logger & debug.FLAG_ACL and debug.logger(
            f"isAccessAllowed: viewType {viewType} for variableName {variableName} - OK"
        )

        # rfc3415 3.2.5c
        return error.StatusInformation(errorIndication=errind.accessAllowed)