Add method to list all leases a user or project has access to.
Also adjust some of the existing lease enumeration functions to take a lease type selector argument. Here is the comment above the new GetAllowedLeases() method: Return a list of leases for which a user OR entire project has access. Permissions are determined as follows: * The owner of a lease always has full (RW) access * Users in a project with group_root or above trust always have full (RW) access to leases associated with that project. * Explicitly granted per-user and per-project permissions are extracted from the lease_permissions tables. Arguments: * upid - User OR Project object to lookup lease access for. * type - Optional lease type selector. Restrict results to this type of lease. Returns: Array of lease objects the given principal (user or project) has access to. To each of these lease objects, an "allow_modify" boolean is set, accessible via $leaseobj->allow_modify().
Showing with 198 additions and 10 deletions