本文整理汇总了Python中indy_common.auth.Authoriser.isValidRole方法的典型用法代码示例。如果您正苦于以下问题:Python Authoriser.isValidRole方法的具体用法?Python Authoriser.isValidRole怎么用?Python Authoriser.isValidRole使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类indy_common.auth.Authoriser
的用法示例。
在下文中一共展示了Authoriser.isValidRole方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: from indy_common.auth import Authoriser [as 别名]
# 或者: from indy_common.auth.Authoriser import isValidRole [as 别名]
def __init__(self,
identifier: Identifier,
trust_anchor: Identifier=None,
verkey=None,
role=None,
last_synced=None,
seq_no=None):
"""
:param identifier:
:param trust_anchor:
:param verkey:
:param role: If role is explicitly passed as `null` then in the request
to ledger, `role` key would be sent as None which would stop the
Identity's ability to do any privileged actions. If role is not passed,
`role` key will not be included in the request to the ledger
:param last_synced:
:param seq_no:
"""
self.identity = DidIdentity(identifier, verkey=verkey)
self.trustAnchor = trust_anchor
# if role and role not in (TRUST_ANCHOR, STEWARD):
if not Authoriser.isValidRole(self.correctRole(role)):
raise AttributeError("Invalid role {}".format(role))
self._role = role
# timestamp for when the ledger was last checked for key replacement or
# revocation
self.last_synced = last_synced
# sequence number of the latest key management transaction for this
# identifier
self.seqNo = seq_no
示例2: _doStaticValidationNym
# 需要导入模块: from indy_common.auth import Authoriser [as 别名]
# 或者: from indy_common.auth.Authoriser import isValidRole [as 别名]
def _doStaticValidationNym(self, identifier, reqId, operation):
role = operation.get(ROLE)
nym = operation.get(TARGET_NYM)
if not nym:
raise InvalidClientRequest(identifier, reqId,
"{} needs to be present".
format(TARGET_NYM))
if not Authoriser.isValidRole(role):
raise InvalidClientRequest(identifier, reqId,
"{} not a valid role".
format(role))
示例3: role
# 需要导入模块: from indy_common.auth import Authoriser [as 别名]
# 或者: from indy_common.auth.Authoriser import isValidRole [as 别名]
def role(self, role):
if not Authoriser.isValidRole(self.correctRole(role)):
raise AttributeError("Invalid role {}".format(role))
self._role = role