Skip to content

Commit

Permalink
Add OlapConnection.setRoleName and .getRoleName. Dummy implementation…
Browse files Browse the repository at this point in the history
… in XMLA driver.

git-svn-id: https://olap4j.svn.sourceforge.net/svnroot/olap4j/trunk@76 c6a108a4-781c-0410-a6c6-c2d559e19af0
  • Loading branch information
julianhyde committed Mar 5, 2008
1 parent dd4e9e6 commit 8b4b2e3
Show file tree
Hide file tree
Showing 3 changed files with 43 additions and 3 deletions.
20 changes: 17 additions & 3 deletions doc/olap4j_fs.html
Original file line number Diff line number Diff line change
Expand Up @@ -79,10 +79,10 @@
<h1>olap4j Specification</h1>

<p>Authors: Julian Hyde, Barry Klawans<br>
Version: 0.9.4 (beta)<br>
Version: 0.9.5 (beta)<br>
Revision: $Id$
(<a href="http://olap4j.svn.sourceforge.net/viewvc/olap4j/trunk/doc/olap4j_fs.html?view=log">log</a>)<br>
Last modified: December 18<sup>th</sup>, 2007.</p>
Last modified: March 5<sup>th</sup>, 2008.</p>
<hr noshade="noshade">

<h2><a name="Contents">Contents</a></h2>
Expand Down Expand Up @@ -643,6 +643,13 @@ <h4>2.2.1. <a name="Connection_pooling">Connection pooling</a></h4>
Methods:</p>
<ul>
<li><code>NamedList&lt;Catalog&gt; getCatalogs()</code></li>
<li><code>Schema getSchema()</code></li>
<li><code>void setLocale(Locale locale)</code></li>
<li><code>Locale getLocale()</code></li>
<li><code>void setRoleName(String roleName)</code></li>
<li><code>String getRoleName()</code></li>
<li><code>PreparedOlapStatement prepareOlapStatement(String mdx)</code></li>
<li><code>MdxParserFactory getParserFactory()</code></li>
</ul>

<h4>2.2.3. <a name="The_OlapWrapper_interface">The OlapWrapper interface</a></h4>
Expand Down Expand Up @@ -1204,7 +1211,8 @@ <h4>2.7.1. <a name="Access_control">Access control</a></h4>
for access control depend on the provider, and this specification does not say
what those rules should be. But this specification requires that the API methods
must behave consistently with the server's access control policy.</p>
<p>For example, in mondrian, users belong to roles, and roles may be granted or

<p>For example, in mondrian, users belong to roles, and roles may be granted or
denied access to cubes, hierarchies, or members within hierarchies. Suppose that
user Fred belongs to the &quot;Sales Manager&quot; role, which does not have access to the
<code>[Nation]</code>
Expand All @@ -1215,6 +1223,12 @@ <h4>2.7.1. <a name="Access_control">Access control</a></h4>
OlapDatabaseMetaData.getLevels()</code> methods will omit the Nation level from
the list of levels they return.</p>

<p>In olap4j, you can set a connection's role at connect time using the
<code>Role</code> connect string property, or you can call the
<code>OlapConnection.setRole(String roleName)</code> method at any point
during the lifecycle of the connection. Setting the role name to
<code>null</code> reverts to the default access-control context.</p>

<h4>2.7.2. <a name="Metadata_objects">Metadata objects</a></h4>

<p>The following diagram shows the metadata objects in an olap4j schema.</p>
Expand Down
17 changes: 17 additions & 0 deletions src/org/olap4j/OlapConnection.java
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,23 @@ public interface OlapConnection extends Connection, OlapWrapper {
* @return locale of this connection
*/
Locale getLocale();

/**
* Sets the name of the role in which this connection executes queries. If
* the name of the role is null, the connection reverts to the default
* access control context.
*
* @param roleName Name of role
* @throws OlapException if role name is invalid
*/
void setRoleName(String roleName) throws OlapException;

/**
* Returns the name of the role in which this connection executes queries.
*
* @return name of the role in which this connection executes queries
*/
String getRoleName();
}

// End OlapConnection.java
9 changes: 9 additions & 0 deletions src/org/olap4j/driver/xmla/XmlaOlap4jConnection.java
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ abstract class XmlaOlap4jConnection implements OlapConnection {
private Locale locale;
private String catalogName;
private static final boolean DEBUG = true;
private String roleName;

/**
* Creates an Olap4j connection an XML/A provider.
Expand Down Expand Up @@ -391,6 +392,14 @@ public Locale getLocale() {
return locale;
}

public void setRoleName(String roleName) throws OlapException {
this.roleName = roleName;
}

public String getRoleName() {
return roleName;
}

<T extends Named> void populateList(
List<T> list,
Context context,
Expand Down

0 comments on commit 8b4b2e3

Please sign in to comment.