(self, domain, role_qualified_id)
role_qualified_id is either 'admin' 'user-role:[id]'
role_qualified_id is either 'admin' 'user-role:[id]'
role_qualified_id is either admin user - role : [ id ]
def set_role(self, domain, role_qualified_id):
        """
        role_qualified_id is either 'admin' 'user-role:[id]'
        """
        dm = self.get_domain_membership(domain)
        dm.is_admin = False
        if role_qualified_id == "admin":
            dm.is_admin = True
            dm.role_id = None
        elif role_qualified_id.startswith('user-role:'):
            dm.role_id = role_qualified_id[len('user-role:'):]
        elif role_qualified_id == 'none':
            dm.role_id = None
        else:
            raise Exception("unexpected role_qualified_id is %r" % role_qualified_id)

        self.has_permission.reset_cache(self)
        self.get_role.reset_cache(self)
def set_role ( self , domain , role_qualified_id ) : dm = self . get_domain_membership ( domain ) dm . is_admin = False if role_qualified_id == "admin" : dm . is_admin = True dm . role_id = None elif role_qualified_id . startswith ( 'user-role:' ) : dm . role_id = role_qualified_id [ len ( 'user-role:' ) : ] elif role_qualified_id == 'none' : dm . role_id = None else : raise Exception ( "unexpected role_qualified_id is %r" % role_qualified_id ) self . has_permission . reset_cache ( self ) self . get_role . reset_cache ( self )