1+ <?php
2+ /**
3+ * For the grant and revoke commands to work correctly,
4+ * you must start the application with super user (root),
5+ * that is, 'sudo php index.php'.
6+ */
7+ namespace FaaPz \PDO \UserManager \MariaDB ;
8+
9+ use FaaPz \PDO \Definition \User ;
10+ use FaaPz \PDO \Definition \DropUser ;
11+ use FaaPz \PDO \UserManager \UserManagerInterface ;
12+ use PDO ;
13+
14+ class UserManagerMariaDB implements UserManagerInterface
15+ {
16+ public function __construct ()
17+ {
18+ }
19+
20+ public function createUser (PDO $ pdo , string $ host , string $ user , ?string $ password = '' ): User
21+ {
22+ return new User ($ pdo , $ host , $ user , $ password );
23+ }
24+
25+ public function dropUser (PDO $ pdo , string $ host , string $ user ): DropUser
26+ {
27+ return new DropUser ($ pdo , $ host , $ user );
28+ }
29+
30+
31+ public function grantPrivileges (PDO $ pdo , string $ host , string $ user , ?string $ password = '' , ?string $ database = '' , ?string $ table = '' ): GrantPrivileges
32+ {
33+ return new GrantPrivileges ($ pdo , $ host , $ user , $ password , $ database , $ table );
34+ }
35+
36+
37+ public function revokePrivileges (PDO $ pdo , string $ host , string $ user , ?string $ database = '' , ?string $ table = '' ): RevokePrivileges
38+ {
39+ return new RevokePrivileges ($ pdo , $ host , $ user , $ database , $ table );
40+ }
41+
42+ }
0 commit comments