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


Python Role.by_foreign_id方法代码示例

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


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

示例1: get_public_roles

# 需要导入模块: from aleph.model import Role [as 别名]
# 或者: from aleph.model.Role import by_foreign_id [as 别名]
def get_public_roles():
    app = current_app._get_current_object()
    if not hasattr(app, '_public_roles') or not len(app._public_roles):
        roles = [
            Role.by_foreign_id(Role.SYSTEM_GUEST),
            Role.by_foreign_id(Role.SYSTEM_USER)
        ]
        app._public_roles = [r.id for r in roles if r is not None]
    return app._public_roles
开发者ID:nivertech,项目名称:aleph,代码行数:11,代码来源:authz.py

示例2: grant_foreign

# 需要导入模块: from aleph.model import Role [as 别名]
# 或者: from aleph.model.Role import by_foreign_id [as 别名]
 def grant_foreign(cls, resource, foreign_id, read, write):
     from aleph.model import Source, Collection, Role
     role = Role.by_foreign_id(foreign_id)
     if role is None:
         return
     if isinstance(resource, Source):
         cls.grant_resource(cls.SOURCE, resource.id, role, read, write)
     if isinstance(resource, Collection):
         cls.grant_resource(cls.COLLECTION, resource.id, role, read, write)
开发者ID:01-,项目名称:aleph,代码行数:11,代码来源:permission.py

示例3: grant_foreign

# 需要导入模块: from aleph.model import Role [as 别名]
# 或者: from aleph.model.Role import by_foreign_id [as 别名]
 def grant_foreign(cls, resource, foreign_id, read, write):
     from aleph.model import Source, Watchlist, Role
     role = Role.by_foreign_id(foreign_id)
     if role is None:
         return
     if isinstance(resource, Source):
         cls.grant_resource(cls.SOURCE, resource.id, role, read, write)
     if isinstance(resource, Watchlist):
         cls.grant_resource(cls.WATCHLIST, resource.id, role, read, write)
开发者ID:DavidLemayian,项目名称:aleph,代码行数:11,代码来源:permission.py

示例4: grant_publish

# 需要导入模块: from aleph.model import Role [as 别名]
# 或者: from aleph.model.Role import by_foreign_id [as 别名]
 def grant_publish(self, collection):
     visitor = Role.by_foreign_id(Role.SYSTEM_GUEST)
     self.grant(collection, visitor, True, False)
开发者ID:pudo,项目名称:aleph,代码行数:5,代码来源:util.py


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