-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 777bbda
Showing
93 changed files
with
1,182 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
|
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
eventHandler<Trade>("TRADE_INSERT", transactional = true) { | ||
// AUTH-COMMENT | ||
// A user must have the RIGHT CODE "TradeUpdate" to call this event | ||
// Without this call will be rejected | ||
permissioning { | ||
permissionCodes = listOf("TradeUpdate") | ||
// AUTH-COMMENT | ||
// A user must have authorisation for the country they are inserting a transaction against | ||
// This is applying row level insert authorisation | ||
auth(mapName = "COUNTRY_VISIBILITY") { | ||
authKeyWithUserName { | ||
key(data.countryName, userName) | ||
} | ||
} | ||
} | ||
onCommit { event -> | ||
val details = event.details | ||
// AUTH-COMMENT | ||
// If a user cannot see the Customer Name column they should not be able to insert this value so set to blank | ||
// Cannot think of a viable business use case for this, but showing the code for reference | ||
if (!userHasRight(event.userName, "TradeViewFull")) { | ||
details.customerName = "" | ||
} | ||
val insertedRow = entityDb.insert(details) | ||
// return an ack response which contains a list of record IDs | ||
ack(listOf(mapOf( | ||
"TRADE_ID" to insertedRow.record.tradeId, | ||
))) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
requestReply("RR_ALL_TRADES_4", TRADE) { | ||
permissioning { | ||
// AUTH-COMMENT | ||
// The below will force people to have this RIGHT_CODE to access this request reply query | ||
// N.B. this can be a list of RIGHT_CODE's | ||
permissionCodes = listOf("TradeViewRestricted") | ||
// AUTH-COMMENT | ||
// The below will force a mapping to the COUNTRY_VISIBILITY that is defined for authorisation purposes in the | ||
// file scripts\<appname>-permissions.kts (same directory as this file) | ||
// in this app it is called permissions-permissions.kts | ||
auth(mapName = "COUNTRY_VISIBILITY") { | ||
authKeyWithUserName { | ||
key(data.countryName, userName) | ||
} | ||
} | ||
auth{ | ||
// AUTH-COMMENT | ||
// The below will check RIGHT_CODE's to hide columns at run time, enabling column specific authorisation | ||
hideFields { userName, rowData -> | ||
if (!userHasRight(userName, "TradeViewFull")) listOf(CUSTOMER_NAME) | ||
else emptyList() | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
query("ALL_TRADES_3", TRADE) { | ||
permissioning { | ||
// AUTH-COMMENT | ||
// The below will force people to have this RIGHT_CODE to access this data server query | ||
// N.B. this can be a list of RIGHT_CODE's | ||
permissionCodes = listOf("TradeViewRestricted") | ||
auth{ | ||
// AUTH-COMMENT | ||
// The below will check RIGHT_CODE's to hide columns at run time, enabling column specific authorisation | ||
hideFields { userName, rowData -> | ||
if (!userHasRight(userName, "TradeViewFull")) listOf(CUSTOMER_NAME) | ||
else emptyList() | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
requestReply("RR_ALL_TRADES_1", TRADE) { | ||
permissioning { | ||
// AUTH-COMMENT | ||
// The below will force people to have this RIGHT_CODE to access this request reply query | ||
// N.B. this can be a list of RIGHT_CODE's | ||
permissionCodes = listOf("TradeViewFull") | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
requestReply("RR_ALL_TRADES_3", TRADE) { | ||
permissioning { | ||
// AUTH-COMMENT | ||
// The below will force people to have this RIGHT_CODE to access this request reply query | ||
// N.B. this can be a list of RIGHT_CODE's | ||
permissionCodes = listOf("TradeViewRestricted") | ||
auth{ | ||
// AUTH-COMMENT | ||
// The below will check RIGHT_CODE's to hide columns at run time, enabling column specific authorisation | ||
hideFields { userName, rowData -> | ||
if (!userHasRight(userName, "TradeViewFull")) listOf(CUSTOMER_NAME) | ||
else emptyList() | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
VERSION COUNTRY_NAME SIDE RATE NOTIONAL SOURCE_CURRENCY TARGET_CURRENCY CUSTOMER_ID CUSTOMER_NAME | ||
1 Canada Buy 1.23 2,310,000 USD EUR 1 AutomationUser |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
VERSION COUNTRY_NAME SIDE RATE NOTIONAL SOURCE_CURRENCY TARGET_CURRENCY CUSTOMER_ID CUSTOMER_NAME EVENT | ||
1 Canada Buy 1.23 100.000 GBP EUR 11 AutomationUser EVENT_TRADE_INSERT | ||
1 Canada Sell 1.24 125.000 USD TRY 12 AutomationUser EVENT_TRADE_MODIFY | ||
1 Canada Sell 1.24 125.000 USD TRY 12 AutomationUser EVENT_TRADE_DELETE |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
query("ALL_TRADES_4", TRADE) { | ||
permissioning { | ||
// AUTH-COMMENT | ||
// The below will force people to have this RIGHT_CODE to access this data server query | ||
// N.B. this can be a list of RIGHT_CODE's | ||
permissionCodes = listOf("TradeViewRestricted") | ||
// AUTH-COMMENT | ||
// The below will force a mapping to the COUNTRY_VISIBILITY that is defined for authorisation purposes in the | ||
// file scripts\<appname>-permissions.kts (same directory as this file) | ||
// in this app it is called permissions-permissions.kts | ||
auth(mapName = "COUNTRY_VISIBILITY") { | ||
authKeyWithUserName { | ||
key(data.countryName, userName) | ||
} | ||
} | ||
auth{ | ||
// AUTH-COMMENT | ||
// The below will check RIGHT_CODE's to hide columns at run time, enabling column specific authorisation | ||
hideFields { userName, rowData -> | ||
if (!userHasRight(userName, "TradeViewFull")) listOf(CUSTOMER_NAME) | ||
else emptyList() | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
eventHandler<Trade>("TRADE_DELETE", transactional = true) { | ||
// AUTH-COMMENT | ||
// A user must have the RIGHT CODE "TradeUpdate" to call this event | ||
// Without this call will be rejected | ||
permissioning { | ||
permissionCodes = listOf("TradeUpdate") | ||
// AUTH-COMMENT | ||
// A user must have authorisation for the country they are deleting a transaction against | ||
// This is applying row level insert authorisation | ||
auth(mapName = "COUNTRY_VISIBILITY") { | ||
authKeyWithUserName { | ||
val existingTrade= syncDb.get(Trade.byId(data.tradeId)) | ||
key(existingTrade?.countryName, userName) | ||
} | ||
} | ||
} | ||
onCommit { event -> | ||
val details = event.details | ||
entityDb.delete(details) | ||
ack() | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
query("ALL_TRADES_2", TRADE) { | ||
permissioning { | ||
// AUTH-COMMENT | ||
// The below will force people to have this RIGHT_CODE to access this data server query | ||
// N.B. this can be a list of RIGHT_CODE's | ||
permissionCodes = listOf("TradeViewRestricted") | ||
// AUTH-COMMENT | ||
// The below will force a mapping to the COUNTRY_VISIBILITY that is defined for authorisation purposes in <appname>-permissions.kts | ||
auth(mapName = "COUNTRY_VISIBILITY") { | ||
authKeyWithUserName { | ||
key(data.countryName, userName) | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
query("ALL_TRADES_4", TRADE) { | ||
permissioning { | ||
// AUTH-COMMENT | ||
// The below will force people to have this RIGHT_CODE to access this data server query | ||
// N.B. this can be a list of RIGHT_CODE's | ||
permissionCodes = listOf("TradeViewRestricted") | ||
// AUTH-COMMENT | ||
// The below will force a mapping to the COUNTRY_VISIBILITY that is defined for authorisation purposes in the | ||
// file scripts\<appname>-permissions.kts (same directory as this file) | ||
// in this app it is called permissions-permissions.kts | ||
auth(mapName = "COUNTRY_VISIBILITY") { | ||
authKeyWithUserName { | ||
key(data.countryName, userName) | ||
} | ||
} | ||
auth{ | ||
// AUTH-COMMENT | ||
// The below will check RIGHT_CODE's to hide columns at run time, enabling column specific authorisation | ||
hideFields { userName, rowData -> | ||
if (!userHasRight(userName, "TradeViewFull")) listOf(CUSTOMER_NAME) | ||
else emptyList() | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
query("ALL_TRADES_1", TRADE) { | ||
permissioning { | ||
// AUTH-COMMENT | ||
// The below will force people to have this RIGHT_CODE to access this data server query | ||
// N.B. this can be a list of RIGHT_CODE's | ||
permissionCodes = listOf("TradeViewFull") | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
query("ALL_TRADES_3", TRADE) { | ||
permissioning { | ||
// AUTH-COMMENT | ||
// The below will force people to have this RIGHT_CODE to access this data server query | ||
// N.B. this can be a list of RIGHT_CODE's | ||
permissionCodes = listOf("TradeViewRestricted") | ||
auth{ | ||
// AUTH-COMMENT | ||
// The below will check RIGHT_CODE's to hide columns at run time, enabling column specific authorisation | ||
hideFields { userName, rowData -> | ||
if (!userHasRight(userName, "TradeViewFull")) listOf(CUSTOMER_NAME) | ||
else emptyList() | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
VERSION COUNTRY_NAME SIDE RATE NOTIONAL SOURCE_CURRENCY TARGET_CURRENCY CUSTOMER_ID CUSTOMER_NAME | ||
1 Canada Buy 1.23 2,310,000 USD EUR 1 AutomationUser |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
src/test/resources/result/AmyAccess/expected/trades-grid_expected.json |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
requestReply("RR_ALL_TRADES_2", TRADE) { | ||
permissioning { | ||
// AUTH-COMMENT | ||
// The below will force people to have this RIGHT_CODE to access this request reply query | ||
// N.B. this can be a list of RIGHT_CODE's | ||
permissionCodes = listOf("TradeViewRestricted") | ||
// AUTH-COMMENT | ||
// The below will force a mapping to the COUNTRY_VISIBILITY that is defined for authorisation purposes in <appname>-permissions.kts | ||
auth(mapName = "COUNTRY_VISIBILITY") { | ||
authKeyWithUserName { | ||
key(data.countryName, userName) | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
VERSION COUNTRY_NAME SIDE RATE NOTIONAL SOURCE_CURRENCY TARGET_CURRENCY CUSTOMER_ID CUSTOMER_NAME EVENT | ||
1 Canada Buy 1.23 100.000 GBP EUR 11 AutomationUser EVENT_TRADE_INSERT | ||
1 Canada Sell 1.24 125.000 USD TRY 12 AutomationUser EVENT_TRADE_MODIFY | ||
1 Canada Sell 1.24 125.000 USD TRY 12 AutomationUser EVENT_TRADE_DELETE |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
eventHandler<Trade>("TRADE_MODIFY", transactional = true) { | ||
// AUTH-COMMENT | ||
// A user must have the RIGHT CODE "TradeUpdate" to call this event | ||
// Without this call will be rejected | ||
permissioning { | ||
permissionCodes = listOf("TradeUpdate") | ||
// AUTH-COMMENT | ||
// A user must have authorisation for the country they are inserting a transaction against | ||
// This is applying row level insert authorisation. | ||
// Both the existing database record as well as the update to apply must have correct authorisation. | ||
auth(mapName = "COUNTRY_VISIBILITY") { | ||
authKeyWithUserName { | ||
val existingTrade= syncDb.get(Trade.byId(data.tradeId)) | ||
key(existingTrade?.countryName, userName) | ||
} | ||
} and auth(mapName = "COUNTRY_VISIBILITY") { | ||
authKeyWithUserName { | ||
key(data.countryName, userName) | ||
} | ||
} | ||
} | ||
// AUTH-COMMENT | ||
//This verifies prior version of trade exists in the database - otherwise reject | ||
onValidate { event -> | ||
verify { | ||
entityDb hasEntry Trade.ById(event.details.tradeId) | ||
} | ||
ack() | ||
} | ||
onCommit { event -> | ||
val details = event.details | ||
// AUTH-COMMENT | ||
// If a user cannot see the Customer Name column they should not be able to edit this value | ||
// so ensure set to value in prior version - ie it is not changed | ||
if (!userHasRight(event.userName, "TradeViewFull")) { | ||
val trade = entityDb.get(Trade.ById(event.details.tradeId))!! //The two !! are stating "we know there is a trade" as we checked in onValidate | ||
details.customerName = trade.customerName | ||
} | ||
entityDb.modify(details) | ||
ack() | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
requestReply("RR_ALL_TRADES_3", TRADE) { | ||
permissioning { | ||
// AUTH-COMMENT | ||
// The below will force people to have this RIGHT_CODE to access this request reply query | ||
// N.B. this can be a list of RIGHT_CODE's | ||
permissionCodes = listOf("TradeViewRestricted") | ||
auth{ | ||
// AUTH-COMMENT | ||
// The below will check RIGHT_CODE's to hide columns at run time, enabling column specific authorisation | ||
hideFields { userName, rowData -> | ||
if (!userHasRight(userName, "TradeViewFull")) listOf(CUSTOMER_NAME) | ||
else emptyList() | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
query("ALL_TRADES_1", TRADE) { | ||
permissioning { | ||
// AUTH-COMMENT | ||
// The below will force people to have this RIGHT_CODE to access this data server query | ||
// N.B. this can be a list of RIGHT_CODE's | ||
permissionCodes = listOf("TradeViewFull") | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
requestReply("RR_ALL_TRADES_4", TRADE) { | ||
permissioning { | ||
// AUTH-COMMENT | ||
// The below will force people to have this RIGHT_CODE to access this request reply query | ||
// N.B. this can be a list of RIGHT_CODE's | ||
permissionCodes = listOf("TradeViewRestricted") | ||
// AUTH-COMMENT | ||
// The below will force a mapping to the COUNTRY_VISIBILITY that is defined for authorisation purposes in the | ||
// file scripts\<appname>-permissions.kts (same directory as this file) | ||
// in this app it is called permissions-permissions.kts | ||
auth(mapName = "COUNTRY_VISIBILITY") { | ||
authKeyWithUserName { | ||
key(data.countryName, userName) | ||
} | ||
} | ||
auth{ | ||
// AUTH-COMMENT | ||
// The below will check RIGHT_CODE's to hide columns at run time, enabling column specific authorisation | ||
hideFields { userName, rowData -> | ||
if (!userHasRight(userName, "TradeViewFull")) listOf(CUSTOMER_NAME) | ||
else emptyList() | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
requestReply("RR_ALL_TRADES_1", TRADE) { | ||
permissioning { | ||
// AUTH-COMMENT | ||
// The below will force people to have this RIGHT_CODE to access this request reply query | ||
// N.B. this can be a list of RIGHT_CODE's | ||
permissionCodes = listOf("TradeViewFull") | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
src/test/resources/result/AmyAccess/expected/trades-grid_expected.json |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
VERSION COUNTRY_NAME SIDE RATE NOTIONAL SOURCE_CURRENCY TARGET_CURRENCY CUSTOMER_ID CUSTOMER_NAME EVENT | ||
1 Canada Buy 1.23 100.000 GBP EUR 11 AutomationUser EVENT_TRADE_INSERT | ||
1 Canada Sell 1.24 125.000 USD TRY 12 AutomationUser EVENT_TRADE_MODIFY | ||
1 Canada Sell 1.24 125.000 USD TRY 12 AutomationUser EVENT_TRADE_DELETE |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
requestReply("RR_ALL_TRADES_2", TRADE) { | ||
permissioning { | ||
// AUTH-COMMENT | ||
// The below will force people to have this RIGHT_CODE to access this request reply query | ||
// N.B. this can be a list of RIGHT_CODE's | ||
permissionCodes = listOf("TradeViewRestricted") | ||
// AUTH-COMMENT | ||
// The below will force a mapping to the COUNTRY_VISIBILITY that is defined for authorisation purposes in <appname>-permissions.kts | ||
auth(mapName = "COUNTRY_VISIBILITY") { | ||
authKeyWithUserName { | ||
key(data.countryName, userName) | ||
} | ||
} | ||
} | ||
} |
Oops, something went wrong.