| security | by dg | User::isAllowed() is final (BC break) | | | |
| security | by dg | Voter::vote() receives the privilege unchanged, a name or a case of an enum The case of an enum reaches the voters as it is, so a voter tells its own enum by instanceof and a case of another enum with the same value cannot pass. The ACL and the wrapped Authorizator, which work with names, reduce a case of a string-backed enum to its value and abstain on any other privilege. | | | |
| security | by dg | isAllowed() accepts the privilege as a case of a string-backed enum Principal::isAllowed() converts the case to its value before asking the voters, so Voter::vote() keeps the ?string privilege and the ACL with its rules keyed by privilege names understands the enum as well. A voter turns the name back with tryFrom() to get an exhaustive match. | | | |
| security | by dg | Principal::isLoggedIn(): docblock says when it is false | | | |
| security | by dg | Principal: added isLoggedIn() and getGuestIdentity(), exception messages say what to do isLoggedIn() is the way for a voter to say any logged-in user. getGuestIdentity() gives a voter the data of the guest identity, which getIdentity() and hasId() keep hiding for a guest. The defaults of isAllowed() are a plain null: what it means is up to the voters, for the ACL all resources or all privileges. A missing voter, a short UID of the cookie storage and a missing key of the identity data are reported with a hint. | | | |
| security | by dg | updated upgrading.md | | | |
| security | by dg | AGENTS.md: added invariants of identity hooks and TokenIdentity | | | |
| security | by dg | readme: authorization is described with voters | | | |
| security | by dg | User: $authenticatedRole is deprecated | | | |
| security | by dg | User: authorization is decided by voters instead of an authorizator per role (BC break) Voters decide about the Principal of the user, the effective state: the identity only while logged in (unlike User::getId(), which keeps returning the retained identity after logout) and the effective roles. User::createPrincipal() decides about someone else than the current user, or about a visitor for null, taking the identity as it is; getPrincipal() is built on it. Permission is one of the voters; its vote() ORs the roles, forbids when an explicit deny rule stopped them and abstains when only the default deny-all did, as well as on roles and resources the ACL does not know instead of throwing. SecurityExtension adds every service implementing Voter to the user. setAuthorizator() and the getters are deprecated; the third parameter of the User constructor is a variadic list of voters, User::isAllowed() types the privilege as ?string. | | | |
| security | by dg | added Voter, Vote and Principal A Voter decides about a Principal: the identity of a logged-in user (null for a guest), the effective roles and the voters, so that a voter may delegate through $principal->isAllowed(). Ownership is checked by Principal::hasId(), which never matches for a guest. A vote is a Vote: a single Forbid wins, otherwise a single Allow suffices. Vote::allowIf() allows or abstains, so forbidding is always written on purpose. | | | |
| security | by dg | Role is deprecated, the core works with role names only (BC break) Roles are names. An identity returning a Role object throws InvalidStateException, Permission::isAllowed() accepts the role only as a string, and getQueriedRole() and getQueriedResource() return names, so an assertion decides by names only. Resource stays: it maps an entity to the name of an ACL resource, so the rules of that resource apply to the entity. | | | |
| security | by dg | SimpleIdentity: reading an undeclared property throws (BC break) Until now __get() returned null for an unknown key and, because it returns by reference, silently created that key in the data (and thus in the storage). It now throws MemberAccessException, like any other Nette object. This also ends the by-ref write pattern $identity->cart[] = $item on a key that has not been set yet. | | | |
| security | by dg | SimpleIdentity: uses __serialize & __unserialize | | | |
| security | by dg | Identity -> SimpleIdentity Identity class must exist as an alias in order to read it from session | | | |
| security | by dg | IdentityHandler: make getGuestIdentity() a regular interface method (BC break) Promotes the optional @method to a required method, so User no longer needs method_exists() to call it. BC break: existing IdentityHandler implementations must now declare getGuestIdentity(). | | | |
| security | by dg | IIdentity: make getData() a regular interface method (BC break) | | | |
| security | by dg | IIdentity: added return typehint (BC break) | | | |
| security | by dg | User: deprecated magic properties (BC break) | | | |
| security | by dg | User: removed deprecated constants MANUAL & INACTIVITY (BC break) | | | |
| security | by dg | removed deprecated IAuthenticator (BC break) | | | |
| security | by dg | removed legacy services names (BC break) | | | |
| security | by dg | uses nette/utils 4.1 | | | |
| security | by dg | uses nette/http 3.4 | | | |
| security | by dg | used PHP 8.4 features | | | |
| security | by dg | requires PHP 8.4 | | | |
| security | by dg | opened 4.0-dev | | | |
| security | by dg | User::getLogoutReason() loads the state from the storage | | | |
| forms | by dg | updated upgrading.md | | | |
| forms | by dg | docs: internals and AGENTS.md describe the current code | | | |
| forms | by dg | added Repeater examples | | | |
| forms | by dg | netteForms: added repeater support A new item is cloned from the <template> element and the name placeholder is replaced in all its attributes. The ES module exports the Repeater class by name. | | | |