Zum Hauptinhalt springen

isUserAllowedToReleaseAmount

const isUserAllowedToReleaseAmount: (releaseUser, requestedAmount) => boolean

Checks if the given releaseUser is allowed to release the given amount.

  1. It looks for the release employee file of the releaseUser.
  2. If no release employee file is found, it returns false.
  3. If a employee file is found, it looks for a temporal release role.
  4. If a temporal release role is active, it uses the temporal release role. If a date-range is provided, it checks if the current date is between the date-range.
  5. It looks for the release role.
  6. If no release role is found, it returns false.
  7. If a release role is found, it checks if the requested amount is greater than the release amount of the release role.
  8. If the requested amount is greater than the release amount of the release role, it returns false otherwise it true.

Parameters

releaseUser

string

The release user for which the amount should be released

requestedAmount

number

The amount that should be released

Returns

boolean

true if the release user is allowed to release the amount, otherwise false