Skip to content

Commit

Permalink
retrieveRows needs additional filter
Browse files Browse the repository at this point in the history
it must also filter for action ViewCellValue
  • Loading branch information
zingmane committed Aug 29, 2019
1 parent 326640a commit c98fc50
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -693,7 +693,13 @@ class TableauxModel(
def retrieveRow(table: Table, rowId: RowId): Future[Row] = {
for {
columns <- retrieveColumns(table)
row <- retrieveRow(table, columns, rowId)
filteredColumns = roleModel
.filterDomainObjects[ColumnType[_]](ScopeColumn,
columns,
ComparisonObjects(table),
isInternalCall = false,
ViewCellValue)
row <- retrieveRow(table, filteredColumns, rowId)
} yield row
}

Expand Down Expand Up @@ -744,7 +750,13 @@ class TableauxModel(
def retrieveRows(table: Table, pagination: Pagination): Future[RowSeq] = {
for {
columns <- retrieveColumns(table)
rows <- retrieveRows(table, columns, pagination)
filteredColumns = roleModel
.filterDomainObjects[ColumnType[_]](ScopeColumn,
columns,
ComparisonObjects(table),
isInternalCall = false,
ViewCellValue)
rows <- retrieveRows(table, filteredColumns, pagination)
} yield rows
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,8 @@ class RoleModel(jsonObject: JsonObject) extends LazyLogging {
scope: Scope,
domainObjects: Seq[A],
parentObjects: ComparisonObjects = ComparisonObjects(),
isInternalCall: Boolean
isInternalCall: Boolean,
action: Action = View
)(implicit requestContext: RequestContext): Seq[A] = {

if (isInternalCall) {
Expand All @@ -105,7 +106,7 @@ class RoleModel(jsonObject: JsonObject) extends LazyLogging {
case _ => ComparisonObjects()
}

isAllowed(userRoles, View, scope, _.isMatching(objects), Filter)
isAllowed(userRoles, action, scope, _.isMatching(objects), Filter)
})
}
}
Expand Down Expand Up @@ -391,7 +392,8 @@ class RoleModelStub extends RoleModel(Json.emptyObj()) with LazyLogging {
scope: Scope,
domainObjects: Seq[A],
parentObjects: ComparisonObjects,
isInternalCall: Boolean
isInternalCall: Boolean,
action: Action = View
)(implicit requestContext: RequestContext): Seq[A] = {
logAuthWarning()
domainObjects
Expand Down

0 comments on commit c98fc50

Please sign in to comment.