Skip to content
This repository has been archived by the owner on Sep 9, 2024. It is now read-only.

Blanket authorization #51

Merged
merged 5 commits into from
Dec 7, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 9 additions & 3 deletions contracts/authorizers/RequesterAuthorizer.sol
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ import "./interfaces/IRequesterAuthorizer.sol";

/// @title Abstract contract to be inherited by Authorizer contracts that
/// temporarily or permanently whitelist requesters for Airnode–endpoint pairs
/// or Airnodes
/// @dev An authorization for an Airnode with endpoint ID `bytes32(0)`
/// represents a blanket authorization across all endpoints of the Airnode
abstract contract RequesterAuthorizer is Whitelist, IRequesterAuthorizer {
/// @notice Extends the expiration of the temporary whitelist of
/// `requester` for the `airnode`–`endpointId` pair and emits an event
Expand Down Expand Up @@ -142,8 +145,12 @@ abstract contract RequesterAuthorizer is Whitelist, IRequesterAuthorizer {
address airnode,
bytes32 endpointId,
address requester
) external view override returns (bool) {
) public view override returns (bool) {
return
userIsWhitelisted(
deriveServiceId(airnode, bytes32(0)),
requester
) ||
userIsWhitelisted(deriveServiceId(airnode, endpointId), requester);
}

Expand All @@ -164,8 +171,7 @@ abstract contract RequesterAuthorizer is Whitelist, IRequesterAuthorizer {
address sponsor, // solhint-disable-line no-unused-vars
address requester
) external view override returns (bool) {
return
userIsWhitelisted(deriveServiceId(airnode, endpointId), requester);
return isAuthorized(airnode, endpointId, requester);
}

/// @notice Returns the whitelist status of `requester` for the
Expand Down
14 changes: 7 additions & 7 deletions contracts/authorizers/RequesterAuthorizerWithAirnode.sol
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import "./RequesterAuthorizer.sol";
import "./interfaces/IRequesterAuthorizerWithAirnode.sol";

/// @title Authorizer contract that Airnode operators can use to temporarily or
/// indefinitely whitelist requesters for Airnode–endpoint pairs
/// indefinitely whitelist requesters for Airnode–endpoint pairs or Airnodes
contract RequesterAuthorizerWithAirnode is
WhitelistRolesWithAirnode,
RequesterAuthorizer,
Expand All @@ -22,8 +22,8 @@ contract RequesterAuthorizerWithAirnode is
{}

/// @notice Extends the expiration of the temporary whitelist of
/// `requester` for the `airnode`–`endpointId` pair if the sender has the
/// whitelist expiration extender role
/// `requester` for the `airnode`–`endpointId` pair if the sender is
/// allowed to extend whitelist expiration
/// @param airnode Airnode address
/// @param endpointId Endpoint ID
/// @param requester Requester address
Expand All @@ -48,8 +48,8 @@ contract RequesterAuthorizerWithAirnode is
}

/// @notice Sets the expiration of the temporary whitelist of `requester`
/// for the `airnode`–`endpointId` pair if the sender has the whitelist
/// expiration setter role
/// for the `airnode`–`endpointId` pair if the sender is allowed to set
/// expiration
/// @dev Unlike `extendWhitelistExpiration()`, this can hasten expiration
/// @param airnode Airnode address
/// @param endpointId Endpoint ID
Expand All @@ -75,8 +75,8 @@ contract RequesterAuthorizerWithAirnode is
}

/// @notice Sets the indefinite whitelist status of `requester` for the
/// `airnode`–`endpointId` pair if the sender has the indefinite
/// whitelister role
/// `airnode`–`endpointId` pair if the sender is allowed to whitelist
/// indefinitely
/// @param airnode Airnode address
/// @param endpointId Endpoint ID
/// @param requester Requester address
Expand Down
14 changes: 7 additions & 7 deletions contracts/authorizers/RequesterAuthorizerWithManager.sol
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import "./RequesterAuthorizer.sol";
import "./interfaces/IRequesterAuthorizerWithManager.sol";

/// @title Authorizer contract that a manager can use to temporarily or
/// indefinitely whitelist requesters for Airnode–endpoint pairs
/// indefinitely whitelist requesters for Airnode–endpoint pairs or Airnodes
contract RequesterAuthorizerWithManager is
WhitelistRolesWithManager,
RequesterAuthorizer,
Expand All @@ -28,8 +28,8 @@ contract RequesterAuthorizerWithManager is
{}

/// @notice Extends the expiration of the temporary whitelist of
/// `requester` for the `airnode`–`endpointId` pair if the sender has the
/// whitelist expiration extender role
/// `requester` for the `airnode`–`endpointId` pair if the sender is
/// allowed to extend whitelist expiration
/// @param airnode Airnode address
/// @param endpointId Endpoint ID
/// @param requester Requester address
Expand All @@ -54,8 +54,8 @@ contract RequesterAuthorizerWithManager is
}

/// @notice Sets the expiration of the temporary whitelist of `requester`
/// for the `airnode`–`endpointId` pair if the sender has the whitelist
/// expiration setter role
/// for the `airnode`–`endpointId` pair if the sender is allowed to set
/// expiration
/// @dev Unlike `extendWhitelistExpiration()`, this can hasten expiration
/// @param airnode Airnode address
/// @param endpointId Endpoint ID
Expand All @@ -81,8 +81,8 @@ contract RequesterAuthorizerWithManager is
}

/// @notice Sets the indefinite whitelist status of `requester` for the
/// `airnode`–`endpointId` pair if the sender has the indefinite
/// whitelister role
/// `airnode`–`endpointId` pair if the sender is allowed to whitelist
/// indefinitely
/// @param airnode Airnode address
/// @param endpointId Endpoint ID
/// @param requester Requester address
Expand Down
Loading