(self, domain=None, checking_global_admin=True, allow_enterprise=False)
Get the role object for this user
Get the role object for this user
Get the role object for this user
def get_role(self, domain=None, checking_global_admin=True, allow_enterprise=False):
        """
        Get the role object for this user
        """
        if domain is None:
            # default to current_domain for django templates
            if hasattr(self, 'current_domain'):
                domain = self.current_domain
            else:
                domain = None

        if checking_global_admin and self.is_global_admin():
            return StaticRole.domain_admin(domain)
        if self.is_member_of(domain, allow_enterprise):
            return self.get_domain_membership(domain, allow_enterprise).role
        else:
            raise DomainMembershipError()
def get_role ( self , domain = None , checking_global_admin = True , allow_enterprise = False ) : if domain is None : # default to current_domain for django templates if hasattr ( self , 'current_domain' ) : domain = self . current_domain else : domain = None if checking_global_admin and self . is_global_admin ( ) : return StaticRole . domain_admin ( domain ) if self . is_member_of ( domain , allow_enterprise ) : return self . get_domain_membership ( domain , allow_enterprise ) . role else : raise DomainMembershipError ( )