Find organization that has the current identity as the owner or as the member
763100
def list_my(self):
        
        org_list = self.call_contract_command("Registry", "listOrganizations", [])

        rez_owner  = []
        rez_member = []
        for idx, org_id in enumerate(org_list):
            (found, org_id, org_name, owner, members, serviceNames, repositoryNames) = self.call_contract_command("Registry", "getOrganizationById", [org_id])
            if (not found):
                raise Exception("Organization was removed during this call. Please retry.");
            if self.ident.address == owner:
                rez_owner.append((org_name, bytes32_to_str(org_id)))

            if self.ident.address in members:
                rez_member.append((org_name, bytes32_to_str(org_id)))

        if (rez_owner):
            self._printout("# Organizations you are the owner of")
            self._printout("# OrgName OrgId")
            for n,i in rez_owner:
                self._printout("%s   %s"%(n,i))

        if (rez_member):
            self._printout("# Organizations you are the member of")
            self._printout("# OrgName OrgId")
            for n,i in rez_member:
                self._printout("%s   %s"%(n,i))
23762
def is_member_of(self, group_name):
        """"""
        group_dn = 'cn=%s,cn=groups,cn=accounts,%s' % (group_name, self._base_dn)
        if str(group_dn).lower() in [str(i).lower() for i in self.member_of]:
            return True
        else:
            return False
44519
def match_member_id(self, member_conf, current_member_confs):
        
        if current_member_confs is None:
            return None

        for curr_mem_conf in current_member_confs:
            if is_same_address(member_conf['host'], curr_mem_conf['host']):
                return curr_mem_conf['_id']

        return None
836766
private static String id(String organizationId, String entityId, String version) {
        return organizationId + ':' + entityId + ':' + version;
    }
1068872
def role(organization = nil)
      # Return cached version if available
      return self.read_attribute(:role) if !organization

      # Find in arrays if organizations have been fetched
      # already. Perform remote query otherwise
      org = begin
        if self.organizations.loaded?
          self.organizations.to_a.find { |e| e.id == organization.id }
        else
          self.organizations.where(id: organization.id).first
        end
      end

      org ? org.role : nil
    end
1110467
def active_user_organisations_resource(doc):
    """"""
    if doc.get('type') == 'user' and doc.get('state') != 'deactivated':
        for org_id, resource in doc.get('organisations', {}).items():
            if resource['state'] != 'deactivated':
                resource['id'] = org_id
                resource['user_id'] = doc['_id']
                yield [doc['_id'], org_id], resource
1083570
def organization_subscription_show(self, id, **kwargs):
        ""
        api_path = "/api/v2/organization_subscriptions/{id}.json"
        api_path = api_path.format(id=id)
        return self.call(api_path, **kwargs)
20750
public OrganizationMember getMember(int orgId, int userId) {
		return getResourceFactory().getApiResource(
				"/org/" + orgId + "/member/" + userId).get(
				OrganizationMember.class);
	}
781654
def get_current_orga(request, hproject, availableOrga):
    """"""

    # If nothing available return 404
    if len(availableOrga) == 0:
        raise Http404

    # Find the current orga
    currentOrgaId = request.session.get('plugit-orgapk-' + str(hproject.pk), None)

    # If we don't have a current one select the first available
    if currentOrgaId is None:
        (tmpOrga, _) = availableOrga[0]
        currentOrgaId = tmpOrga.pk
    else:
        # If the current Orga is not among the available ones reset to the first one
        availableOrgaIds = [o.pk for (o, r) in availableOrga]
        if currentOrgaId not in availableOrgaIds:
            (tmpOrga, _) = availableOrga[0]
            currentOrgaId = tmpOrga.pk

    from organizations.models import Organization

    realCurrentOrga = get_object_or_404(Organization, pk=currentOrgaId)

    return realCurrentOrga
985073
def get_organization(self):
        # type: () -> hdx.data.organization.Organization
        
        return hdx.data.organization.Organization.read_from_hdx(self.data['owner_org'], configuration=self.configuration)
593409
def organization_organization_memberships(self, organization_id, **kwargs):
        ""
        api_path = "/api/v2/organizations/{organization_id}/organization_memberships.json"
        api_path = api_path.format(organization_id=organization_id)
        return self.call(api_path, **kwargs)
281903
function getUserOrganizationId (id, cb) {
      let promise = null
      if (typeof cb !== 'function') [promise, cb] = asyncify()

      const sqlQuery = SQL`
        SELECT org_id
        FROM users
        WHERE id = ${id}
      `
      db.query(sqlQuery, function (err, result) {
        if (err) return cb(Boom.badImplementation(err))
        if (result.rowCount === 0) return cb(Boom.notFound())

        return cb(null, result.rows[0].org_id)
      })

      return promise
    }
214576
private boolean canAccessPrivateMembers( IType ownersClass, IType whosAskin )
  {
    return getOwnersType() == whosAskin ||
           getTopLevelTypeName( whosAskin ).equals( getTopLevelTypeName( ownersClass ) );
  }
740361
@Override
	public List<CommerceAccountOrganizationRel> findByOrganizationId(
		long organizationId) {
		return findByOrganizationId(organizationId, QueryUtil.ALL_POS,
			QueryUtil.ALL_POS, null);
	}
391347
def member_info(self, cluster_id, member_id):
        """"""
        cluster = self._storage[cluster_id]
        return cluster.member_info(member_id)
299299
def find_by_id(self, project_membership, params={}, **options): 
        
        path = "/project_memberships/%s" % (project_membership)
        return self.client.get(path, params, **options)
665612
function(memberName) {
        var parent = this.super;
        do { parent = Object.getPrototypeOf(parent); } while (!parent.hasOwnProperty(memberName));
        return parent && parent[memberName];
    }