Skip to content

Commit 73ed116

Browse files
committed
use UserRolePrincipal as delegate to get access to name and roles
Signed-off-by: Stefan Bischof <[email protected]>
1 parent c00e706 commit 73ed116

File tree

18 files changed

+292
-304
lines changed

18 files changed

+292
-304
lines changed

api/src/main/java/org/eclipse/daanse/xmla/api/UserPrincipal.java renamed to api/src/main/java/org/eclipse/daanse/xmla/api/UserRolePrincipal.java

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,9 @@
1313
*/
1414
package org.eclipse.daanse.xmla.api;
1515

16-
import java.util.List;
16+
public interface UserRolePrincipal {
1717

18-
public interface UserPrincipal {
18+
String userName();
1919

20-
String userId();
21-
22-
List<String> roles();
20+
boolean hasRole(String role);
2321
}

api/src/main/java/org/eclipse/daanse/xmla/api/discover/DiscoverService.java

Lines changed: 28 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
import java.util.List;
1717

1818
import org.eclipse.daanse.xmla.api.RequestMetaData;
19-
import org.eclipse.daanse.xmla.api.UserPrincipal;
19+
import org.eclipse.daanse.xmla.api.UserRolePrincipal;
2020
import org.eclipse.daanse.xmla.api.XmlaService;
2121
import org.eclipse.daanse.xmla.api.discover.dbschema.catalogs.DbSchemaCatalogsRequest;
2222
import org.eclipse.daanse.xmla.api.discover.dbschema.catalogs.DbSchemaCatalogsResponseRow;
@@ -89,7 +89,7 @@ public interface DiscoverService {
8989
* @return the list
9090
*/
9191
List<DiscoverDataSourcesResponseRow> dataSources(DiscoverDataSourcesRequest request, RequestMetaData metaData,
92-
UserPrincipal userPrincipal);
92+
UserRolePrincipal userPrincipal);
9393

9494
/**
9595
* returns the catalogs that are accessible on the server.
@@ -98,7 +98,7 @@ List<DiscoverDataSourcesResponseRow> dataSources(DiscoverDataSourcesRequest requ
9898
* @return the list
9999
*/
100100
List<DbSchemaCatalogsResponseRow> dbSchemaCatalogs(DbSchemaCatalogsRequest request, RequestMetaData metaData,
101-
UserPrincipal userPrincipal);
101+
UserRolePrincipal userPrincipal);
102102

103103
/**
104104
* describes the structure of cubes within a database. Perspectives are also returned in this
@@ -108,7 +108,7 @@ List<DbSchemaCatalogsResponseRow> dbSchemaCatalogs(DbSchemaCatalogsRequest reque
108108
* @return the list
109109
*/
110110
List<DbSchemaColumnsResponseRow> dbSchemaColumns(DbSchemaColumnsRequest request, RequestMetaData metaData,
111-
UserPrincipal userPrincipal);
111+
UserRolePrincipal userPrincipal);
112112

113113
/**
114114
* describes the properties of members and cell properties.
@@ -117,7 +117,7 @@ List<DbSchemaColumnsResponseRow> dbSchemaColumns(DbSchemaColumnsRequest request,
117117
* @return the list
118118
*/
119119
List<DbSchemaProviderTypesResponseRow> dbSchemaProviderTypes(DbSchemaProviderTypesRequest request,
120-
RequestMetaData metaData, UserPrincipal userPrincipal);
120+
RequestMetaData metaData, UserRolePrincipal userPrincipal);
121121

122122
/**
123123
* identifies the (base) data types supported by the server.
@@ -126,7 +126,7 @@ List<DbSchemaProviderTypesResponseRow> dbSchemaProviderTypes(DbSchemaProviderTyp
126126
* @return the list
127127
*/
128128
List<DbSchemaSchemataResponseRow> dbSchemaSchemata(DbSchemaSchemataRequest request, RequestMetaData metaData,
129-
UserPrincipal userPrincipal);
129+
UserRolePrincipal userPrincipal);
130130

131131
/**
132132
*
@@ -135,7 +135,7 @@ List<DbSchemaSchemataResponseRow> dbSchemaSchemata(DbSchemaSchemataRequest reque
135135
* @return the list
136136
*/
137137
List<DbSchemaSourceTablesResponseRow> dbSchemaSourceTables(DbSchemaSourceTablesRequest request,
138-
RequestMetaData metaData, UserPrincipal userPrincipal);
138+
RequestMetaData metaData, UserRolePrincipal userPrincipal);
139139

140140
/**
141141
* returns dimensions, measure groups, or schema rowsets exposed as tables.
@@ -144,7 +144,7 @@ List<DbSchemaSourceTablesResponseRow> dbSchemaSourceTables(DbSchemaSourceTablesR
144144
* @return the list
145145
*/
146146
List<DbSchemaTablesResponseRow> dbSchemaTables(DbSchemaTablesRequest request, RequestMetaData metaData,
147-
UserPrincipal userPrincipal);
147+
UserRolePrincipal userPrincipal);
148148

149149
/**
150150
*
@@ -153,7 +153,7 @@ List<DbSchemaTablesResponseRow> dbSchemaTables(DbSchemaTablesRequest request, Re
153153
* @return the list
154154
*/
155155
List<DbSchemaTablesInfoResponseRow> dbSchemaTablesInfo(DbSchemaTablesInfoRequest request, RequestMetaData metaData,
156-
UserPrincipal userPrincipal);
156+
UserRolePrincipal userPrincipal);
157157

158158
/**
159159
* returns a row for each measure, each cube dimension attribute, and each schema rowset column,
@@ -164,7 +164,7 @@ List<DbSchemaTablesInfoResponseRow> dbSchemaTablesInfo(DbSchemaTablesInfoRequest
164164
*/
165165
// discover
166166
List<DiscoverEnumeratorsResponseRow> discoverEnumerators(DiscoverEnumeratorsRequest request,
167-
RequestMetaData metaData, UserPrincipal userPrincipal);
167+
RequestMetaData metaData, UserRolePrincipal userPrincipal);
168168

169169
/**
170170
* returns information about keywords that are reserved by the XMLA server.
@@ -173,7 +173,7 @@ List<DiscoverEnumeratorsResponseRow> discoverEnumerators(DiscoverEnumeratorsRequ
173173
* @return the list
174174
*/
175175
List<DiscoverKeywordsResponseRow> discoverKeywords(DiscoverKeywordsRequest request, RequestMetaData metaData,
176-
UserPrincipal userPrincipal);
176+
UserRolePrincipal userPrincipal);
177177

178178
/**
179179
* returns information about literals supported by the server.
@@ -182,7 +182,7 @@ List<DiscoverKeywordsResponseRow> discoverKeywords(DiscoverKeywordsRequest reque
182182
* @return the list
183183
*/
184184
List<DiscoverLiteralsResponseRow> discoverLiterals(DiscoverLiteralsRequest request, RequestMetaData metaData,
185-
UserPrincipal userPrincipal);
185+
UserRolePrincipal userPrincipal);
186186

187187
/**
188188
* returns a list of information and values about the properties that are supported by the server
@@ -192,7 +192,7 @@ List<DiscoverLiteralsResponseRow> discoverLiterals(DiscoverLiteralsRequest reque
192192
* @return the list
193193
*/
194194
List<DiscoverPropertiesResponseRow> discoverProperties(DiscoverPropertiesRequest request, RequestMetaData metaData,
195-
UserPrincipal userPrincipal);
195+
UserRolePrincipal userPrincipal);
196196

197197
/**
198198
* returns the names, restrictions, description, and other information for all Discover requests.
@@ -201,7 +201,7 @@ List<DiscoverPropertiesResponseRow> discoverProperties(DiscoverPropertiesRequest
201201
* @return the list
202202
*/
203203
List<DiscoverSchemaRowsetsResponseRow> discoverSchemaRowsets(DiscoverSchemaRowsetsRequest request,
204-
RequestMetaData metaData, UserPrincipal userPrincipal);
204+
RequestMetaData metaData, UserRolePrincipal userPrincipal);
205205

206206
/**
207207
* describes the actions that can be available to the client application.
@@ -211,7 +211,7 @@ List<DiscoverSchemaRowsetsResponseRow> discoverSchemaRowsets(DiscoverSchemaRowse
211211
*/
212212
// md
213213
List<MdSchemaActionsResponseRow> mdSchemaActions(MdSchemaActionsRequest request, RequestMetaData metaData,
214-
UserPrincipal userPrincipal);
214+
UserRolePrincipal userPrincipal);
215215

216216
/**
217217
* describes the structure of cubes within a database. Perspectives are also returned in this
@@ -221,7 +221,7 @@ List<MdSchemaActionsResponseRow> mdSchemaActions(MdSchemaActionsRequest request,
221221
* @return the list
222222
*/
223223
List<MdSchemaCubesResponseRow> mdSchemaCubes(MdSchemaCubesRequest request, RequestMetaData metaData,
224-
UserPrincipal userPrincipal);
224+
UserRolePrincipal userPrincipal);
225225

226226
/**
227227
* describes the dimensions within a database.
@@ -230,7 +230,7 @@ List<MdSchemaCubesResponseRow> mdSchemaCubes(MdSchemaCubesRequest request, Reque
230230
* @return the list
231231
*/
232232
List<MdSchemaDimensionsResponseRow> mdSchemaDimensions(MdSchemaDimensionsRequest request, RequestMetaData metaData,
233-
UserPrincipal userPrincipal);
233+
UserRolePrincipal userPrincipal);
234234

235235
/**
236236
* returns information about the functions that are currently available for use in the DAX and MDX
@@ -240,7 +240,7 @@ List<MdSchemaDimensionsResponseRow> mdSchemaDimensions(MdSchemaDimensionsRequest
240240
* @return the list
241241
*/
242242
List<MdSchemaFunctionsResponseRow> mdSchemaFunctions(MdSchemaFunctionsRequest request, RequestMetaData metaData,
243-
UserPrincipal userPrincipal);
243+
UserRolePrincipal userPrincipal);
244244

245245
/**
246246
* describes each hierarchy within a particular dimension.
@@ -249,7 +249,7 @@ List<MdSchemaFunctionsResponseRow> mdSchemaFunctions(MdSchemaFunctionsRequest re
249249
* @return the list
250250
*/
251251
List<MdSchemaHierarchiesResponseRow> mdSchemaHierarchies(MdSchemaHierarchiesRequest request,
252-
RequestMetaData metaData, UserPrincipal userPrincipal);
252+
RequestMetaData metaData, UserRolePrincipal userPrincipal);
253253

254254
/**
255255
* describes the KPIs within a database
@@ -258,7 +258,7 @@ List<MdSchemaHierarchiesResponseRow> mdSchemaHierarchies(MdSchemaHierarchiesRequ
258258
* @return the list
259259
*/
260260
List<MdSchemaKpisResponseRow> mdSchemaKpis(MdSchemaKpisRequest request, RequestMetaData metaData,
261-
UserPrincipal userPrincipal);
261+
UserRolePrincipal userPrincipal);
262262

263263
/**
264264
* describes each level within a particular hierarchy.
@@ -267,7 +267,7 @@ List<MdSchemaKpisResponseRow> mdSchemaKpis(MdSchemaKpisRequest request, RequestM
267267
* @return the list
268268
*/
269269
List<MdSchemaLevelsResponseRow> mdSchemaLevels(MdSchemaLevelsRequest request, RequestMetaData metaData,
270-
UserPrincipal userPrincipal);
270+
UserRolePrincipal userPrincipal);
271271

272272
/**
273273
* enumerates the dimensions of measure groups.
@@ -276,7 +276,7 @@ List<MdSchemaLevelsResponseRow> mdSchemaLevels(MdSchemaLevelsRequest request, Re
276276
* @return the list
277277
*/
278278
List<MdSchemaMeasureGroupDimensionsResponseRow> mdSchemaMeasureGroupDimensions(
279-
MdSchemaMeasureGroupDimensionsRequest request, RequestMetaData metaData, UserPrincipal userPrincipal);
279+
MdSchemaMeasureGroupDimensionsRequest request, RequestMetaData metaData, UserRolePrincipal userPrincipal);
280280

281281
/**
282282
* describes the MeasureGroups within a database
@@ -285,7 +285,7 @@ List<MdSchemaMeasureGroupDimensionsResponseRow> mdSchemaMeasureGroupDimensions(
285285
* @return the list
286286
*/
287287
List<MdSchemaMeasureGroupsResponseRow> mdSchemaMeasureGroups(MdSchemaMeasureGroupsRequest request,
288-
RequestMetaData metaData, UserPrincipal userPrincipal);
288+
RequestMetaData metaData, UserRolePrincipal userPrincipal);
289289

290290
/**
291291
* describes the members within a database
@@ -294,7 +294,7 @@ List<MdSchemaMeasureGroupsResponseRow> mdSchemaMeasureGroups(MdSchemaMeasureGrou
294294
* @return the list
295295
*/
296296
List<MdSchemaMeasuresResponseRow> mdSchemaMeasures(MdSchemaMeasuresRequest request, RequestMetaData metaData,
297-
UserPrincipal userPrincipal);
297+
UserRolePrincipal userPrincipal);
298298

299299
/**
300300
* describes the members within a database
@@ -303,7 +303,7 @@ List<MdSchemaMeasuresResponseRow> mdSchemaMeasures(MdSchemaMeasuresRequest reque
303303
* @return the list
304304
*/
305305
List<MdSchemaMembersResponseRow> mdSchemaMembers(MdSchemaMembersRequest request, RequestMetaData metaData,
306-
UserPrincipal userPrincipal);
306+
UserRolePrincipal userPrincipal);
307307

308308
/**
309309
* describes the properties of members and cell properties.
@@ -312,7 +312,7 @@ List<MdSchemaMembersResponseRow> mdSchemaMembers(MdSchemaMembersRequest request,
312312
* @return the list
313313
*/
314314
List<MdSchemaPropertiesResponseRow> mdSchemaProperties(MdSchemaPropertiesRequest request, RequestMetaData metaData,
315-
UserPrincipal userPrincipal);
315+
UserRolePrincipal userPrincipal);
316316

317317
/**
318318
* describes any sets that are currently defined in a database, including session- scoped sets.
@@ -321,7 +321,7 @@ List<MdSchemaPropertiesResponseRow> mdSchemaProperties(MdSchemaPropertiesRequest
321321
* @return the list
322322
*/
323323
List<MdSchemaSetsResponseRow> mdSchemaSets(MdSchemaSetsRequest request, RequestMetaData metaData,
324-
UserPrincipal userPrincipal);
324+
UserRolePrincipal userPrincipal);
325325

326326
/**
327327
* returns a rowset with one row and one column. The single cell in the rowset contains an XML
@@ -331,5 +331,5 @@ List<MdSchemaSetsResponseRow> mdSchemaSets(MdSchemaSetsRequest request, RequestM
331331
* @return the list
332332
*/
333333
List<DiscoverXmlMetaDataResponseRow> xmlMetaData(DiscoverXmlMetaDataRequest request, RequestMetaData metaData,
334-
UserPrincipal userPrincipal);
334+
UserRolePrincipal userPrincipal);
335335
}

api/src/main/java/org/eclipse/daanse/xmla/api/execute/ExecuteService.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
package org.eclipse.daanse.xmla.api.execute;
1515

1616
import org.eclipse.daanse.xmla.api.RequestMetaData;
17-
import org.eclipse.daanse.xmla.api.UserPrincipal;
17+
import org.eclipse.daanse.xmla.api.UserRolePrincipal;
1818
import org.eclipse.daanse.xmla.api.execute.alter.AlterRequest;
1919
import org.eclipse.daanse.xmla.api.execute.alter.AlterResponse;
2020
import org.eclipse.daanse.xmla.api.execute.cancel.CancelRequest;
@@ -29,23 +29,23 @@ public interface ExecuteService {
2929
/*
3030
* The method is used to alter an object that already exists on a server.
3131
*/
32-
AlterResponse alter(AlterRequest statementRequest, RequestMetaData metaData, UserPrincipal userPrincipal);
32+
AlterResponse alter(AlterRequest statementRequest, RequestMetaData metaData, UserRolePrincipal userPrincipal);
3333

3434
/*
3535
* The method cancels the currently running command on the specified connection.
3636
*/
37-
CancelResponse cancel(CancelRequest capture, RequestMetaData metaData, UserPrincipal userPrincipal);
37+
CancelResponse cancel(CancelRequest capture, RequestMetaData metaData, UserRolePrincipal userPrincipal);
3838

3939
/*
4040
* The method clears the in-memory cache of the specified object.
4141
*/
4242
ClearCacheResponse clearCache(ClearCacheRequest clearCacheRequest, RequestMetaData metaData,
43-
UserPrincipal userPrincipal);
43+
UserRolePrincipal userPrincipal);
4444

4545
/*
4646
* The method consists of a string. This MUST be a valid string in a language that is understood by
4747
* the server, such as MDX, DMX, or SQL.
4848
*/
4949
StatementResponse statement(StatementRequest statementRequest, RequestMetaData metaData,
50-
UserPrincipal userPrincipal);
50+
UserRolePrincipal userPrincipal);
5151
}

api/src/main/java/org/eclipse/daanse/xmla/api/session/SessionService.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,17 +15,17 @@
1515

1616
import java.util.Optional;
1717

18-
import org.eclipse.daanse.xmla.api.UserPrincipal;
18+
import org.eclipse.daanse.xmla.api.UserRolePrincipal;
1919
import org.eclipse.daanse.xmla.api.xmla.BeginSession;
2020
import org.eclipse.daanse.xmla.api.xmla.EndSession;
2121
import org.eclipse.daanse.xmla.api.xmla.Session;
2222

2323
public interface SessionService {
2424

25-
Optional<Session> beginSession(BeginSession beginSession, UserPrincipal userPrincipal);
25+
Optional<Session> beginSession(BeginSession beginSession, UserRolePrincipal userPrincipal);
2626

27-
boolean checkSession(Session session, UserPrincipal userPrincipal);
27+
boolean checkSession(Session session, UserRolePrincipal userPrincipal);
2828

29-
void endSession(EndSession endSession, UserPrincipal userPrincipal);
29+
void endSession(EndSession endSession, UserRolePrincipal userPrincipal);
3030

3131
}

0 commit comments

Comments
 (0)