"Fossies" - the Fresh Open Source Software Archive

Member "ampache-5.0.0/src/Repository/AccessRepositoryInterface.php" (31 Aug 2021, 2945 Bytes) of package /linux/www/ampache-5.0.0.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) PHP source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file. For more information about "AccessRepositoryInterface.php" see the Fossies "Dox" file reference documentation.

    1 <?php
    2 /*
    3  * vim:set softtabstop=4 shiftwidth=4 expandtab:
    4  *
    5  * LICENSE: GNU Affero General Public License, version 3 (AGPL-3.0-or-later)
    6  * Copyright 2001 - 2020 Ampache.org
    7  *
    8  * This program is free software: you can redistribute it and/or modify
    9  * it under the terms of the GNU Affero General Public License as published by
   10  * the Free Software Foundation, either version 3 of the License, or
   11  * (at your option) any later version.
   12  *
   13  * This program is distributed in the hope that it will be useful,
   14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
   15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   16  * GNU Affero General Public License for more details.
   17  *
   18  * You should have received a copy of the GNU Affero General Public License
   19  * along with this program.  If not, see <https://www.gnu.org/licenses/>.
   20  *
   21  */
   22 
   23 namespace Ampache\Repository;
   24 
   25 /**
   26  * This repository contains all db calls related to the `access_list` table
   27  */
   28 interface AccessRepositoryInterface
   29 {
   30     /**
   31      * Returns a full listing of all access rules on this server
   32      * @return int[]
   33      */
   34     public function getAccessLists(): array;
   35 
   36     /**
   37      * Searches for certain ip and config. Returns true if a match was found
   38      */
   39     public function findByIp(
   40         string $userIp,
   41         int $level,
   42         string $type,
   43         ?int $userId
   44     ): bool;
   45 
   46     /**
   47      * deletes the specified access_list entry
   48      */
   49     public function delete(int $accessId): void;
   50 
   51     /**
   52      * This sees if the ACL that we've specified already exists in order to
   53      * prevent duplicates. The name is ignored.
   54      */
   55     public function exists(
   56         string $inAddrStart,
   57         string $inAddrEnd,
   58         string $type,
   59         int $userId
   60     ): bool;
   61 
   62     /**
   63      * Creates a new acl item
   64      *
   65      * @param string $startIp The startip in in-addr notation
   66      * @param string $endIp The end ip in in-addr notation
   67      * @param string $name Name of the acl
   68      * @param integer $userId Designated user id (or -1 if none)
   69      * @param integer $level Access level
   70      * @param string $type Access type
   71      */
   72     public function create(
   73         string $startIp,
   74         string $endIp,
   75         string $name,
   76         int $userId,
   77         int $level,
   78         string $type
   79     ): void;
   80 
   81     /**
   82      * Updates the data of a certain acl item
   83      *
   84      * @param integer $accessId Id of an existing acl item
   85      * @param string $startIp The startip in in-addr notation
   86      * @param string $endIp The end ip in in-addr notation
   87      * @param string $name Name of the acl
   88      * @param integer $userId Designated user id (or -1 if none)
   89      * @param integer $level Access level
   90      * @param string $type Access type
   91      */
   92     public function update(
   93         int $accessId,
   94         string $startIp,
   95         string $endIp,
   96         string $name,
   97         int $userId,
   98         int $level,
   99         string $type
  100     ): void;
  101 }