当前位置: 首页>>代码示例>>Python>>正文


Python PermissionType.get_resource_type方法代码示例

本文整理汇总了Python中st2common.rbac.types.PermissionType.get_resource_type方法的典型用法代码示例。如果您正苦于以下问题:Python PermissionType.get_resource_type方法的具体用法?Python PermissionType.get_resource_type怎么用?Python PermissionType.get_resource_type使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在st2common.rbac.types.PermissionType的用法示例。


在下文中一共展示了PermissionType.get_resource_type方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: get_resolver_for_permission_type

# 需要导入模块: from st2common.rbac.types import PermissionType [as 别名]
# 或者: from st2common.rbac.types.PermissionType import get_resource_type [as 别名]
def get_resolver_for_permission_type(permission_type):
    """
    Return resolver instance for the provided permission type.

    :rtype: Instance of :class:`PermissionsResolver`
    """
    resource_type = PermissionType.get_resource_type(permission_type=permission_type)
    resolver_instance = get_resolver_for_resource_type(resource_type=resource_type)
    return resolver_instance
开发者ID:hejin,项目名称:st2,代码行数:11,代码来源:resolvers.py

示例2: test_get_resource_type

# 需要导入模块: from st2common.rbac.types import PermissionType [as 别名]
# 或者: from st2common.rbac.types.PermissionType import get_resource_type [as 别名]
 def test_get_resource_type(self):
     self.assertEqual(PermissionType.get_resource_type(PermissionType.ACTION_CREATE), ResourceType.ACTION)
     self.assertEqual(PermissionType.get_resource_type(PermissionType.ACTION_DELETE), ResourceType.ACTION)
     self.assertEqual(PermissionType.get_resource_type(PermissionType.ACTION_ALL), ResourceType.ACTION)
     self.assertEqual(PermissionType.get_resource_type(PermissionType.PACK_ALL), ResourceType.PACK)
开发者ID:agilee,项目名称:st2,代码行数:7,代码来源:test_rbac.py

示例3: test_get_resource_type

# 需要导入模块: from st2common.rbac.types import PermissionType [as 别名]
# 或者: from st2common.rbac.types.PermissionType import get_resource_type [as 别名]
    def test_get_resource_type(self):
        self.assertEqual(PermissionType.get_resource_type(PermissionType.PACK_LIST),
                         SystemType.PACK)
        self.assertEqual(PermissionType.get_resource_type(PermissionType.PACK_VIEW),
                         SystemType.PACK)
        self.assertEqual(PermissionType.get_resource_type(PermissionType.PACK_CREATE),
                         SystemType.PACK)
        self.assertEqual(PermissionType.get_resource_type(PermissionType.PACK_MODIFY),
                         SystemType.PACK)
        self.assertEqual(PermissionType.get_resource_type(PermissionType.PACK_DELETE),
                         SystemType.PACK)
        self.assertEqual(PermissionType.get_resource_type(PermissionType.PACK_ALL),
                         SystemType.PACK)

        self.assertEqual(PermissionType.get_resource_type(PermissionType.SENSOR_LIST),
                         SystemType.SENSOR_TYPE)
        self.assertEqual(PermissionType.get_resource_type(PermissionType.SENSOR_VIEW),
                         SystemType.SENSOR_TYPE)
        self.assertEqual(PermissionType.get_resource_type(PermissionType.SENSOR_MODIFY),
                         SystemType.SENSOR_TYPE)
        self.assertEqual(PermissionType.get_resource_type(PermissionType.SENSOR_ALL),
                         SystemType.SENSOR_TYPE)

        self.assertEqual(PermissionType.get_resource_type(PermissionType.ACTION_LIST),
                         SystemType.ACTION)
        self.assertEqual(PermissionType.get_resource_type(PermissionType.ACTION_VIEW),
                         SystemType.ACTION)
        self.assertEqual(PermissionType.get_resource_type(PermissionType.ACTION_CREATE),
                         SystemType.ACTION)
        self.assertEqual(PermissionType.get_resource_type(PermissionType.ACTION_MODIFY),
                         SystemType.ACTION)
        self.assertEqual(PermissionType.get_resource_type(PermissionType.ACTION_DELETE),
                         SystemType.ACTION)
        self.assertEqual(PermissionType.get_resource_type(PermissionType.ACTION_EXECUTE),
                         SystemType.ACTION)
        self.assertEqual(PermissionType.get_resource_type(PermissionType.ACTION_ALL),
                         SystemType.ACTION)

        self.assertEqual(PermissionType.get_resource_type(PermissionType.EXECUTION_LIST),
                         SystemType.EXECUTION)
        self.assertEqual(PermissionType.get_resource_type(PermissionType.EXECUTION_VIEW),
                         SystemType.EXECUTION)
        self.assertEqual(PermissionType.get_resource_type(PermissionType.EXECUTION_RE_RUN),
                         SystemType.EXECUTION)
        self.assertEqual(PermissionType.get_resource_type(PermissionType.EXECUTION_STOP),
                         SystemType.EXECUTION)
        self.assertEqual(PermissionType.get_resource_type(PermissionType.EXECUTION_ALL),
                         SystemType.EXECUTION)

        self.assertEqual(PermissionType.get_resource_type(PermissionType.RULE_LIST),
                         SystemType.RULE)
        self.assertEqual(PermissionType.get_resource_type(PermissionType.RULE_VIEW),
                         SystemType.RULE)
        self.assertEqual(PermissionType.get_resource_type(PermissionType.RULE_CREATE),
                         SystemType.RULE)
        self.assertEqual(PermissionType.get_resource_type(PermissionType.RULE_MODIFY),
                         SystemType.RULE)
        self.assertEqual(PermissionType.get_resource_type(PermissionType.RULE_DELETE),
                         SystemType.RULE)
        self.assertEqual(PermissionType.get_resource_type(PermissionType.RULE_ALL),
                         SystemType.RULE)

        self.assertEqual(PermissionType.get_resource_type(PermissionType.RULE_ENFORCEMENT_LIST),
                         SystemType.RULE_ENFORCEMENT)
        self.assertEqual(PermissionType.get_resource_type(PermissionType.RULE_ENFORCEMENT_VIEW),
                         SystemType.RULE_ENFORCEMENT)

        self.assertEqual(PermissionType.get_resource_type(PermissionType.KEY_VALUE_VIEW),
                         SystemType.KEY_VALUE_PAIR)
        self.assertEqual(PermissionType.get_resource_type(PermissionType.KEY_VALUE_SET),
                         SystemType.KEY_VALUE_PAIR)
        self.assertEqual(PermissionType.get_resource_type(PermissionType.KEY_VALUE_DELETE),
                         SystemType.KEY_VALUE_PAIR)

        self.assertEqual(PermissionType.get_resource_type(PermissionType.WEBHOOK_CREATE),
                         SystemType.WEBHOOK)
        self.assertEqual(PermissionType.get_resource_type(PermissionType.WEBHOOK_SEND),
                         SystemType.WEBHOOK)
        self.assertEqual(PermissionType.get_resource_type(PermissionType.WEBHOOK_DELETE),
                         SystemType.WEBHOOK)
        self.assertEqual(PermissionType.get_resource_type(PermissionType.WEBHOOK_ALL),
                         SystemType.WEBHOOK)

        self.assertEqual(PermissionType.get_resource_type(PermissionType.API_KEY_LIST),
                         SystemType.API_KEY)
        self.assertEqual(PermissionType.get_resource_type(PermissionType.API_KEY_VIEW),
                         SystemType.API_KEY)
        self.assertEqual(PermissionType.get_resource_type(PermissionType.API_KEY_CREATE),
                         SystemType.API_KEY)
        self.assertEqual(PermissionType.get_resource_type(PermissionType.API_KEY_DELETE),
                         SystemType.API_KEY)
        self.assertEqual(PermissionType.get_resource_type(PermissionType.API_KEY_ALL),
                         SystemType.API_KEY)
开发者ID:lyandut,项目名称:st2,代码行数:95,代码来源:test_rbac_types.py


注:本文中的st2common.rbac.types.PermissionType.get_resource_type方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。