# Path: m2core/utils/decorators.py
# class classproperty(property):
#     def __get__(self, obj, objtype=None):
#         return super(classproperty, self).__get__(objtype)
# 
#     def __set__(self, obj, value):
#         super(classproperty, self).__set__(type(obj), value)
# 
#     def __delete__(self, obj):
#         super(classproperty, self).__delete__(type(obj))


import re
from m2core.utils.decorators import classproperty
            return self in user_permissions
        else:
            return self.rule_chain(user_permissions)

    def __repr__(self):
        if self.rule_chain:
            return self.rule_chain.__repr__()
        else:
            return f'<{self.__class__.__name__}.{self.sys_name}>'


class PermissionsEnumMeta(type):
    """Metaclass for PermissionsEnum"""

    def __init__(cls, name, bases, nmspc):
        super(PermissionsEnumMeta, cls).__init__(name, bases, nmspc)
        if not hasattr(cls, 'registry'):
            cls.registry = set()
        cls.registry.add(cls)
        cls.registry -= set(bases)  # Remove base classes

    def __str__(cls):
        if cls in cls.registry:
            return cls.__name__
        return cls.__name__ + ": " + ", ".join([sc.__name__ for sc in cls])


class PermissionsEnum(metaclass=PermissionsEnumMeta):
    AUTHORIZED = Permission('authorized')


# Path: m2core/utils/decorators.py
# class classproperty(property):
#     def __get__(self, obj, objtype=None):
#         return super(classproperty, self).__get__(objtype)
# 
#     def __set__(self, obj, value):
#         super(classproperty, self).__set__(type(obj), value)
# 
#     def __delete__(self, obj):
#         super(classproperty, self).__delete__(type(obj))


# Path: m2core/common/permissions.py
import re
from m2core.utils.decorators import classproperty

            return self in user_permissions
        else:
            return self.rule_chain(user_permissions)

    def __repr__(self):
        if self.rule_chain:
            return self.rule_chain.__repr__()
        else:
            return f'<{self.__class__.__name__}.{self.sys_name}>'


class PermissionsEnumMeta(type):
    """Metaclass for PermissionsEnum"""

    def __init__(cls, name, bases, nmspc):
        super(PermissionsEnumMeta, cls).__init__(name, bases, nmspc)
        if not hasattr(cls, 'registry'):
            cls.registry = set()
        cls.registry.add(cls)
        cls.registry -= set(bases)  # Remove base classes

    def __str__(cls):
        if cls in cls.registry:
            return cls.__name__
        return cls.__name__ + ": " + ", ".join([sc.__name__ for sc in cls])


class PermissionsEnum(metaclass=PermissionsEnumMeta):
    AUTHORIZED = Permission('authorized')


    @classproperty