GeoConstraint: The GeoConstraint object is bound to each new geo route/group, the constraint decides the behavior of the geo-route, and sets/binds the failure callback
GeoCallback: Made of a name, callable and arguments, this object is invokable, and is [usually] called in the Middleware handle method.
All callbacks are saved as GeoCallback object inside the CallbacksRegistrar, most of the time, we don't have access to the arguments, so they are optional and can be set later via the setArguments method, which is the case inside the CallbacksHandler trait.
CallbacksRegistrar: Responsible for the registration of all callbacks, default and custom ones, also used to bind callbacks to constraints in a way that makes us avoid route caching problems
GeoGroup: This class can be initialized via the geogroup Router macro method, this class will behave the same way as GeoRoute, except for the part that it handles a group instead of a single route.
With this, the issue #10 can be considered solved.
Unfortunately, this will disallow route caching, but i actually have a solution for that, and it will be implemented in the future
Changes
The method shouldHaveAccess of the trait DeterminesGeoAccess now accepts a boolean a third parameter instead of string, and also this method now converts all country codes to uppercase along with the current visitor's country code, this is now only handled in this method and removed from all other parts of code
The global middleware configuration key is changed from (string) strategy to (boolean) allowed
Deletions
The from macro was removed along with the allow and the deny methods, the same approach can be achieved with the allowFrom and the denyFrom methods
Addittions
GeoConstraint
: TheGeoConstraint
object is bound to each new geo route/group, theconstraint
decides the behavior of the geo-route, and sets/binds the failure callbackGeoCallback
: Made of a name, callable and arguments, this object is invokable, and is [usually] called in the Middlewarehandle
method. All callbacks are saved asGeoCallback
object inside theCallbacksRegistrar
, most of the time, we don't have access to the arguments, so they are optional and can be set later via thesetArguments
method, which is the case inside theCallbacksHandler
trait.CallbacksRegistrar
: Responsible for the registration of all callbacks, default and custom ones, also used tobind
callbacks to constraints in a way that makes us avoid route caching problemsGeoGroup
: This class can be initialized via thegeogroup
Router macro method, this class will behave the same way asGeoRoute
, except for the part that it handles a group instead of a single route. With this, the issue #10 can be considered solved.or
callback, usage:Unfortunately, this will disallow route caching, but i actually have a solution for that, and it will be implemented in the future
Changes
shouldHaveAccess
of the traitDeterminesGeoAccess
now accepts aboolean
a third parameter instead ofstring
, and also this method now converts all country codes to uppercase along with the current visitor's country code, this is now only handled in this method and removed from all other parts of code(string) strategy
to(boolean) allowed
Deletions
from
macro was removed along with theallow
and thedeny
methods, the same approach can be achieved with theallowFrom
and thedenyFrom
methods