authorizable source pure
Package authorizable is an extension of p/nt/ownable; It allows the user to instantiate an Authorizable struct, which...
Package authorizable is an extension of p/nt/ownable; It allows the user to instantiate an Authorizable struct, which extends p/nt/ownable with a list of users that are authorized for something. By using authorizable, you have a superuser (ownable), as well as another authorization level, which can be used for adding moderators or similar to your realm.
1
1
1
type Authorizable
structMethods on Authorizable
func AddToAuthList
method on AuthorizableAddToAuthList adds addr to the auth list. rlm must be the caller's own captured cur; rlm.Previous().Address() must equal the superuser (the underlying Ownable's owner).
func AssertOnAuthList
method on Authorizablefunc AssertPreviousOnAuthList
method on Authorizablefunc DeleteFromAuthList
method on AuthorizableDeleteFromAuthList removes addr from the auth list. rlm must be the caller's own captured cur; rlm.Previous().Address() must equal the superuser (the underlying Ownable's owner).
func OnAuthList
method on AuthorizableOnAuthList reports whether rlm.Address() is on the auth list. rlm must be the caller's own captured cur (asserted via rlm.IsCurrent()). Pre-migration shape used unsafe.CurrentRealm().Address() — vulnerable to the .Title()-class read where a non-crossing wrapper made the walk return the wrong realm. Explicit rlm closes that.
func PreviousOnAuthList
method on AuthorizablePreviousOnAuthList reports whether rlm.Previous().Address() — the realm that crossed into the caller — is on the auth list. Same rlm contract as OnAuthList.