Skip to content

Commit

Permalink
make code compile again
Browse files Browse the repository at this point in the history
  • Loading branch information
DivineThreepwood committed Jan 9, 2024
1 parent 3c687dc commit 2ea5054
Showing 1 changed file with 39 additions and 40 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -131,57 +131,56 @@ object AuthorizationWithTokenHelper {
userMessage: UserMessageType.UserMessage,
permissionType: AuthorizationHelper.PermissionType,
unitRegistry: UnitRegistry,
): AuthPair = try {
// validate sender
): AuthPair = try {
// validate sender
canDo(
authenticationBaseData,
unitRegistry.getUnitConfigById(userMessage.senderId),
permissionType,
unitRegistry,
null,
null
)
} catch (ex: CouldNotPerformException) {
var exceptionStack: ExceptionStack? = null
exceptionStack = MultiException.push(AuthorizationWithTokenHelper::class.java, ex, exceptionStack)

// validate receiver if sender validation failed.
try {
canDo(
authenticationBaseData,
unitRegistry.getUnitConfigById(userMessage.senderId),
unitRegistry.getUnitConfigById(userMessage.recipientId),
permissionType,
unitRegistry,
null,
null
)
} catch (ex: CouldNotPerformException) {
var exceptionStack: ExceptionStack? = null
exceptionStack = MultiException.push(AuthorizationWithTokenHelper::class.java, ex, exceptionStack)

// validate receiver if sender validation failed.
try {
canDo(
authenticationBaseData,
unitRegistry.getUnitConfigById(userMessage.recipientId),
permissionType,
unitRegistry,
null,
null
)
} catch (exx: CouldNotPerformException) {
exceptionStack = MultiException.push(AuthorizationWithTokenHelper::class.java, exx, exceptionStack)
} catch (exx: CouldNotPerformException) {
exceptionStack = MultiException.push(AuthorizationWithTokenHelper::class.java, exx, exceptionStack)

userMessage.conditionList.firstNotNullOfOrNull { condition ->
try {
canDo(
authenticationBaseData,
unitRegistry.getUnitConfigById(condition.unitId),
permissionType,
unitRegistry,
null,
null
)
} catch (exxx: CouldNotPerformException) {
exceptionStack =
MultiException.push(AuthorizationWithTokenHelper::class.java, exxx, exceptionStack)
userMessage.conditionList.firstNotNullOfOrNull { condition ->
try {
canDo(
authenticationBaseData,
unitRegistry.getUnitConfigById(condition.unitId),
permissionType,
unitRegistry,
null,
null
}
)
} catch (exxx: CouldNotPerformException) {
exceptionStack =
MultiException.push(AuthorizationWithTokenHelper::class.java, exxx, exceptionStack)
null
}
MultiException.checkAndThrow({ "Permission denied!" }, exceptionStack)
null
}
} ?: throw FatalImplementationErrorException(
"ExceptionStack empty in error case.",
AuthorizationWithTokenHelper::class.java
)
}
MultiException.checkAndThrow({ "Permission denied!" }, exceptionStack)
null
}
} ?: throw FatalImplementationErrorException(
"ExceptionStack empty in error case.",
AuthorizationWithTokenHelper::class.java
)

/**
* Perform a permission check for authentication data including tokens.
Expand Down

0 comments on commit 2ea5054

Please sign in to comment.