本文整理汇总了Python中st2common.rbac.types.PermissionType.get_permission_description方法的典型用法代码示例。如果您正苦于以下问题:Python PermissionType.get_permission_description方法的具体用法?Python PermissionType.get_permission_description怎么用?Python PermissionType.get_permission_description使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类st2common.rbac.types.PermissionType
的用法示例。
在下文中一共展示了PermissionType.get_permission_description方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: main
# 需要导入模块: from st2common.rbac.types import PermissionType [as 别名]
# 或者: from st2common.rbac.types.PermissionType import get_permission_description [as 别名]
def main():
lines = []
lines.append(HEADER)
lines.append('')
for resource_type in RESOURCE_DISPLAY_ORDER:
resource_title = resource_type.replace('_', ' ').title() # pylint: disable=no-member
lines.append('%s' % (resource_title))
lines.append('~' * len(resource_title))
lines.append('')
permission_types = PermissionType.get_valid_permissions_for_resource_type(
resource_type=resource_type)
rows = []
rows.append(TABLE_HEADER)
for permission_type in permission_types:
description = PermissionType.get_permission_description(permission_type)
rows.append([permission_type, description])
table = as_rest_table(rows, full=True)
lines.extend(table.split('\n'))
lines.append('')
result = '\n'.join(lines)
with open(DESTINATION_PATH, 'w') as fp:
fp.write(result)
print('Generated: %s' % (DESTINATION_PATH))
return result
示例2: main
# 需要导入模块: from st2common.rbac.types import PermissionType [as 别名]
# 或者: from st2common.rbac.types.PermissionType import get_permission_description [as 别名]
def main():
lines = []
lines.append(HEADER)
lines.append("")
for resource_type in RESOURCE_DISPLAY_ORDER:
resource_title = resource_type.replace("_", " ").title() # pylint: disable=no-member
lines.append("%s" % (resource_title))
lines.append("~" * len(resource_title))
lines.append("")
permission_types = PermissionType.get_valid_permissions_for_resource_type(resource_type=resource_type)
rows = []
rows.append(TABLE_HEADER)
for permission_type in permission_types:
description = PermissionType.get_permission_description(permission_type)
rows.append(["**%s**" % (permission_type), description])
table = as_rest_table(rows, full=True)
lines.extend(table.split("\n"))
lines.append("")
result = "\n".join(lines)
with open(DESTINATION_PATH, "w") as fp:
fp.write(result)
print("Generated: %s" % (DESTINATION_PATH))
return result