logo
Free, unlimited AI code reviews that run on commit
git-lrc git-lrc GitHub Install Now We'd appreciate a star git-lrc - Free, unlimited AI code reviews that run on commit | Product Hunt git-lrc - Free, unlimited AI code reviews that run on commit | Product Hunt

Wallet::Admin - Wallet system administrative interface

Author

       Russ Allbery <eagle@eyrie.org>

perl v5.40.0                                       2024-11-12                                 Wallet::Admin(3pm)

Class Methods

new()
           Creates  a  new wallet administrative object and connects to the database.  On any error, this method
           throws an exception.

Description

       Wallet::Admin implements the administrative interface to the wallet server and database.  It is normally
       instantiated and used by wallet-admin, a thin wrapper around this object that provides a command-line
       interface to its actions.

       To use this object, several configuration variables must be set (at least the database configuration).
       For information on those variables and how to set them, see Wallet::Config.  For more information on the
       normal user interface to the wallet server, see Wallet::Server.

Instance Methods

       For all methods that can fail, the caller should call error() after a failure to get the error message.

       destroy ()
           Destroys the database, deleting all of its data and all of the tables  used  by  the  wallet  server.
           Returns true on success and false on failure.

       error ()
           Returns  the  error  of  the  last  failing operation or undef if no operations have failed.  Callers
           should call this function to get the error message after an undef  return  from  any  other  instance
           method.

       initialize(PRINCIPAL)
           Initializes the database as configured in Wallet::Config and loads the wallet database schema.  Then,
           creates  an  ACL with the name ADMIN and adds an ACL entry of scheme "krb5" and instance PRINCIPAL to
           that ACL.  This bootstraps the authorization system and lets  that  Kerberos  identity  make  further
           changes  to  the ADMIN ACL and the rest of the wallet database.  Returns true on success and false on
           failure.

           initialize() uses "localhost" as the hostname and PRINCIPAL as the user when logging the  history  of
           the ADMIN ACL creation and for any subsequent actions on the object it returns.

       register_object (TYPE, CLASS)
           Register  in  the  database  a mapping from the object type TYPE to the class CLASS.  Returns true on
           success and false on failure (including when the verifier is already registered).

       register_verifier (SCHEME, CLASS)
           Register in the database a mapping from the ACL scheme SCHEME to the class CLASS.   Returns  true  on
           success and false on failure (including when the verifier is already registered).

       reinitialize (PRINCIPAL)
           Performs  the  same actions as initialize(), but first drops any existing wallet database tables from
           the database, allowing this function to be called on a prior wallet database.  All data stored in the
           database will be deleted and a fresh set of wallet database tables will be created.  This  method  is
           equivalent  to  calling  destroy()  followed  by  initialize().  Returns true on success and false on
           failure.

       upgrade ()
           Upgrades the database to the latest schema version, preserving data as  much  as  possible.   Returns
           true on success and false on failure.

Name

       Wallet::Admin - Wallet system administrative interface

See Also

wallet-admin(8)

       This   module   is   part   of   the   wallet   system.    The   current   version   is   available  from
       <https://www.eyrie.org/~eagle/software/wallet/>.

Synopsis

           use Wallet::Admin;
           my $admin = Wallet::Admin->new;
           unless ($admin->initialize ('user/admin@EXAMPLE.COM')) {
               die $admin->error;
           }

See Also