本文整理汇总了Python中calvin.utilities.security.Security.set_subject_attributes方法的典型用法代码示例。如果您正苦于以下问题:Python Security.set_subject_attributes方法的具体用法?Python Security.set_subject_attributes怎么用?Python Security.set_subject_attributes使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类calvin.utilities.security.Security
的用法示例。
在下文中一共展示了Security.set_subject_attributes方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: new_from_migration
# 需要导入模块: from calvin.utilities.security import Security [as 别名]
# 或者: from calvin.utilities.security.Security import set_subject_attributes [as 别名]
def new_from_migration(self, actor_type, state, prev_connections=None, callback=None):
"""Instantiate an actor of type 'actor_type' and apply the 'state' to the actor."""
try:
_log.analyze(self.node.id, "+", state)
subject_attributes = state.pop('subject_attributes', None)
migration_info = state.pop('migration_info', None)
try:
state['_managed'].remove('subject_attributes')
state['_managed'].remove('migration_info')
except:
pass
if security_enabled():
security = Security(self.node)
security.set_subject_attributes(subject_attributes)
else:
security = None
actor_def, signer = self.lookup_and_verify(actor_type, security)
requirements = actor_def.requires if hasattr(actor_def, "requires") else []
self.check_requirements_and_sec_policy(requirements, security, state['id'],
signer, migration_info,
CalvinCB(self.new, actor_type, None,
state, prev_connections,
callback=callback,
actor_def=actor_def,
security=security))
except Exception:
# Still want to create shadow actor.
self.new(actor_type, None, state, prev_connections, callback=callback, shadow_actor=True)