Get is primary.

@param [[@doctodo param_type:role]] $role [[@doctodo param_description:role]]

@return [[@doctodo return_type:isPrimary]] [[@doctodo return_description:isPrimary]]
490344
public function isPrimary($role)
    {
        if (!$this->handlePrimary($role)) {
            return false;
        }
        $primaryField = $this->getPrimaryField($role);

        return !empty($this->owner->{$primaryField});
    }
839800
protected function getPrimaryDomain($domain)
    {
        /** @var \Rcm\Entity\Domain $domain */
        $domain = $this->_em->getRepository(\Rcm\Entity\Domain::class)
            ->findOneBy(['domain' => $domain]);

        if (empty($domain)) {
            return null;
        }

        $primary = $domain->getPrimary();

        if (!$primary->getPrimary()) {
            return $primary;
        }

        return $this->getPrimaryDomain($primary->getDomainName());
    }
1193129
public function getRoleParents($role, $onlyParents = true) {
        $parents = array();
        if (Zend_Registry::isRegistered('Zend_Acl')) {
            $acl = Zend_Registry::get('Zend_Acl');
            $roles = $acl->getRoles();

            foreach ($roles as $potentialParent) {
                if ($acl->inheritsRole($role, $potentialParent, $onlyParents)) {
                    $parents[] = $potentialParent;
                }
            }
        }
        return $parents;
    }
595540
protected function _getPrimaryConstraint(Constraint\Primary $constraint)
    {
        $columns = implode(', ', $constraint->getColumnNames());
        return sprintf(
            'CONSTRAINT %s PRIMARY KEY (%s)',
            $constraint->getName(),
            $columns
        );
    }
309277
private static function get_role( $role ) {
		global $wp_roles;

		$role_obj = $wp_roles->get_role( $role );

		if ( ! $role_obj ) {
			WP_CLI::error( "'{$role}' role not found." );
		}

		return $role_obj;
	}
1339228
public function setPrimary($role)
    {
        if (!$this->handlePrimary($role)) {
            return false;
        }
        $primaryField = $this->getPrimaryField($role);
        $primarySiblings = $this->getSiblings($role, true);
        foreach ($primarySiblings as $sibling) {
            $sibling->{$primaryField} = 0;
            if (!$sibling->save()) {
                return false;
            }
        }
        $this->owner->{$primaryField} = 1;

        return $this->owner->save();
    }
839940
public function getRolesByPrivilege($privilege)
    {
        $roles = array();

        if ($this->acl) {
            foreach ($this->acl->getRoles() as $role) {
                if ($this->acl->isAllowed($role, null, $privilege)) {
                    //Do not translate, only make first one uppercase
                    $roles[$role] = ucfirst($role);
                }
            }
        }

        return $roles;
    }
529590
public function hasRole($role) {
        $roles = (array) $this->Session->read('Acl.roles');

        if (is_numeric($role)) {
            return isset($roles[$role]);
        }

        return in_array($role, $roles);
    }
767992
public function getRoles(string $role): array
    {
        if(!\in_array($role, $this->roles))
            throw new UndefinedRoleException("This role '{$role}' is not registered into RoleHierarchy");
        
        return isset($this->map[$role]) ? \array_merge([], [$role], $this->map[$role]) : [$role];
    }
758347
private function hasRole($role) {

        if (substr($role, 0, 4) !== 'urn:')
        {
            $role = 'urn:lti:role:ims/lis/' . $role;
        }

        return in_array($role, $this->roles);

    }
606803
public function isAll($role)
    {
        foreach ($this->getArrayFrom($role) as $role) {
            if (!$this->hasRole($role)) {
                return false;
            }
        }

        return true;
    }
1023675
public function revokeRole($role)
    {
        return $this->mapArray($role, function ($role) {

            $roleId = $this->parseRoleId($role);

            return $this->roles()->detach($roleId);
        });
    }
1073330
public function checkRole( $role, $parent = null )
    {
        if ( null === $role )
        {
            return null;
        }

        if ( $role instanceof Acl\Role\RoleInterface )
        {
            $role = $role->getRoleId();
        }

        $acl = $this->getAcl();

        if ( ! $acl->hasRole( $role ) )
        {
            if ( null === $parent )
            {
                $parent = $this->getParentId( $role );
            }
            elseif ( $parent instanceof Acl\Role\RoleInterface )
            {
                $parent = $parent->getRoleId();
            }

            $parent = $this->checkRole( $parent );
            $acl->addRole( $role, (array) $parent );

            $matches    = array();
            $structures = array();

            if ( preg_match( '/^(\d+)$/', $role, $matches ) ) //group
            {
                $structures = $this->getMapper()
                                   ->findAllByGroupId( $matches[1] );
            }
            else if ( preg_match( '/^(\d+)\.(\d+)$/', $role, $matches ) ) //user
            {
                $structures = $this->getMapper()
                                   ->findAllByUserId( $matches[2] );

                $resource = 'user.group.' . $matches[1] .
                            '.identity.' . $matches[2];

                $this->checkResource( $resource );
                $acl->allow( $role, $resource );
            }

            foreach ( $structures as $structure )
            {
                $this->checkResource( $structure->resource );
                $acl->allow( $role, $structure->resource, $structure->privilege );
            }
        }

        return $role;
    }
759003
public function translateToRoleId($role)
    {
        $lookup = array_flip($this->_roleTranslations);

        if (isset($lookup[$role])) {
            return $lookup[$role];
        }

        return $role;
    }
729184
public static function get(string $role): OODBBean {
		self::check();
		$r = new self($role);

		return $r->getRole();
	}
231319
public function hasRole($role = ''){

        $session = $this->getSession();
        $cookie = $this->getCookie();


        if ($cookie->has(self::USER_SESSION)) {
            $login = $cookie->get(self::USER_SESSION);
        }elseif (false !== $session->has(self::USER_SESSION)) {
            $login = $session->get(self::USER_SESSION);
        }else{
            return false;
        }

        $roleLogin = $login['role'];

        if (is_string($role)) {
            return $roleLogin === $role;
        }elseif(is_array($role)){
            return array_search($roleLogin, $role);
        }

        return false;
    }
569749
public function getRolePermissions(Role $role)
    {
        $key = $this->getRoleKey($role);

        // If we've saved the caller permissions we don't need to fetch them again.
        if (array_key_exists($key, $this->rolePermissions)) {
            return $this->rolePermissions[$key];
        }

        $results = $this->getTable()->where('role', $role->getRoleName())->get()->toArray();

        return $this->rolePermissions[$key] = PermissionFactory::createFromData($results);
    }