models.py 文件源码

python
阅读 18 收藏 0 点赞 0 评论 0

项目:mist.api 作者: mistio 项目源码 文件源码
def init_mappings(self):
        """Initialize RBAC Mappings.

        RBAC Mappings always refer to a (Organization, Team) combination.

        In order to reference the Organization instance of this Team, we
        are using `self._instance`, which is a proxy object to the upper
        level Document.

        """
        if not RBACMapping:
            return
        if self.name == 'Owners':
            return
        if RBACMapping.objects(org=self._instance.id, team=self.id).only('id'):
            raise me.ValidationError(
                'RBAC Mappings already initialized for Team %s' % self
            )
        for perm in ('read', 'read_logs'):
            RBACMapping(
                org=self._instance.id, team=self.id, permission=perm
            ).save()
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号