> ## Documentation Index
> Fetch the complete documentation index at: https://docs.kinetica.com/llms.txt
> Use this file to discover all available pages before exploring further.

# has_role

<div className="kinetica-pydoc">
  <div className="dl py method">
    <div className="dt sig sig-object py" id="gpudb.GPUdb.has_role"> <span className="sig-name descname"><span className="pre">has\_role</span></span><span className="sig-paren">(</span><span className="em sig-param"><span className="n"><span className="pre">principal</span></span><span className="o"><span className="pre">=</span></span><span className="default_value"><span className="pre">''</span></span></span>, <span className="em sig-param"><span className="n"><span className="pre">role</span></span><span className="o"><span className="pre">=</span></span><span className="default_value"><span className="pre">None</span></span></span>, <span className="em sig-param"><span className="n"><span className="pre">options</span></span><span className="o"><span className="pre">=</span></span><span className="default_value"><span className="pre">{"{"}{"}"}</span></span></span><span className="sig-paren">)</span><a href="https://github.com/kineticadb/kinetica-api-python/blob/master/gpudb/gpudb.py#L32902"><span className="viewcode-link"><span className="pre">\[source]</span></span></a></div>

    <div className="dd">
      <p>Checks if the specified user has the specified role.</p>
      <p><strong>Parameters</strong></p>

      <div className="blockquote">
        <div>
          <div className="dl">
            <div className="dt">principal (<span className="em">str</span>) –</div>

            <div className="dd">
              <p>Name of the user for which role membership is being checked. Must be an existing user. If blank, will use the current user. The default value is ‘’.</p>
            </div>

            <div className="dt">role (<span className="em">str</span>) –</div>

            <div className="dd">
              <p>Name of role to check for membership.</p>
            </div>

            <div className="dt">options (<span className="em">dict of str to str</span>) –</div>

            <div className="dd">
              <p>Optional parameters. Allowed keys are:</p>

              <ul>
                <li>
                  <p><strong>no\_error\_if\_not\_exists</strong> – If <span className="em">false</span> will return an error if the provided input parameter <span className="em">role</span> does not exist or is blank. If <span className="em">true</span> then it will return <span className="em">false</span> for output parameter <span className="em">has\_role</span>. Allowed values are:</p>

                  <ul className="simple">
                    <li>
                      <p>true</p>
                    </li>

                    <li>
                      <p>false</p>
                    </li>
                  </ul>

                  <p>The default value is ‘false’.</p>
                </li>

                <li>
                  <p><strong>only\_direct</strong> – If <span className="em">false</span> will search recursively if the input parameter <span className="em">principal</span> is a member of input parameter <span className="em">role</span>. If <span className="em">true</span> then input parameter <span className="em">principal</span> must directly be a member of input parameter <span className="em">role</span>. Allowed values are:</p>

                  <ul className="simple">
                    <li>
                      <p>true</p>
                    </li>

                    <li>
                      <p>false</p>
                    </li>
                  </ul>

                  <p>The default value is ‘false’.</p>
                </li>
              </ul>

              <p>The default value is an empty dict ( {"{"}{"}"} ).</p>
            </div>
          </div>
        </div>
      </div>

      <p><strong>Returns</strong></p>

      <div className="blockquote">
        <div>
          <p>A dict with the following entries–</p>

          <div className="dl">
            <div className="dt">principal (<span className="em">str</span>) –</div>

            <div className="dd">
              <p>Value of input parameter <span className="em">principal</span>.</p>
            </div>

            <div className="dt">role (<span className="em">str</span>) –</div>

            <div className="dd">
              <p>Input parameter <span className="em">role</span> for which membership is being checked.</p>
            </div>

            <div className="dt">has\_role (<span className="em">bool</span>) –</div>

            <div className="dd">
              <p>Indicates whether the specified user has membership in the specified target input parameter <span className="em">role</span>. Allowed values are:</p>

              <ul className="simple">
                <li>
                  <p><strong>True</strong> – User has membership in the role.</p>
                </li>

                <li>
                  <p><strong>False</strong> – User does not have membership in the role.</p>
                </li>
              </ul>
            </div>

            <div className="dt">info (<span className="em">dict of str to str</span>) –</div>

            <div className="dd">
              <p>Additional information. Allowed keys are:</p>

              <ul>
                <li>
                  <p><strong>direct</strong> – <span className="em">true</span> when principal is directly a member of the role. Allowed values are:</p>

                  <ul className="simple">
                    <li>
                      <p>true</p>
                    </li>

                    <li>
                      <p>false</p>
                    </li>
                  </ul>

                  <p>The default value is ‘false’.</p>
                </li>
              </ul>

              <p>The default value is an empty dict ( {"{"}{"}"} ).</p>
            </div>
          </div>
        </div>
      </div>
    </div>
  </div>
</div>
