@@ -78,18 +78,31 @@ public function getListOfAllPermissions(): bool|string
7878 }
7979 }
8080
81-  public  function  getListOfSpecificPermissions ()
82-  {
8381
82+  /** 
83+  * Get list of addresses with the given permission list 
84+  * @param string $permissions Example: comma seperated permission list like, 'send,receive' 
85+  * @return bool|string 
86+  */ 
87+  public  function  getListOfSpecificPermissions (string  $ permissions ): bool |string 
88+  {
89+  $ result  = $ this  ->mc ->listpermissions ($ permissions );
90+  if  ($ result ) {
91+  $ data  = ["status "  => "success " , "code "  => 200 , "data "  => ["data "  => $ result ]];
92+  return  $ this  ->helper ->makeJsonSuccessResponse ($ data );
93+  } else  {
94+  $ data  = ["status "  => "error " , "code "  => 404 , "data "  => ["data "  => "Failed to get list permissions " ]];
95+  return  $ this  ->helper ->makeJsonErrorResponse ($ data );
96+  }
8497 }
8598
8699
87100 /** 
88101 * Get list of specific address permission 
89-  * @param string $address 
102+  * @param string|array  $address Example either pass array of addresses or string  
90103 * @return bool|string 
91104 */ 
92-  public  function  getListOfSpecificAddressPermissions (string  $ address ): bool |string 
105+  public  function  getListOfSpecificAddressPermissions (string | array  $ address ): bool |string 
93106 {
94107 $ result  = $ this  ->mc ->listpermissions ('* ' , $ address );
95108
@@ -102,21 +115,42 @@ public function getListOfSpecificAddressPermissions(string $address): bool|strin
102115 }
103116 }
104117
105-  public  function  getListOfSpecificMultipleAddressPermissions ()
106-  {
107- 108-  }
109118
110- 111-  public  function  revokeAddressPermissions ()
119+  /** 
120+  * Revoke permissions from an addresss 
121+  * @param string $address The wallet address 
122+  * @param string $permission Example: pass a single permission e.g, 'connect', or a string of permissions e.g.: 'send,receive' 
123+  * @return bool|string 
124+  */ 
125+  public  function  revokeAddressPermissions (string  $ address , string  $ permission ): bool |string 
112126 {
113- 127+  $ result  = $ this  ->mc ->revoke ($ address , $ permission );
128+  if  ($ result ) {
129+  $ data  = ["status "  => "success " , "code "  => 200 , "data "  => ["data "  => $ result ]];
130+  return  $ this  ->helper ->makeJsonSuccessResponse ($ data );
131+  } else  {
132+  $ data  = ["status "  => "error " , "code "  => 404 , "data "  => ["data "  => "Failed to revoke permission or permission was not granted to begin with " ]];
133+  return  $ this  ->helper ->makeJsonErrorResponse ($ data );
134+  }
114135 }
115136
116137
117-  public  function  verifyPermission ()
138+  /** 
139+  * Check if the permission was given 
140+  * @param string $address Wallet address 
141+  * @param string $permission Example: Pass a permission string e.g: 'send' 
142+  * @return bool|string 
143+  */ 
144+  public  function  verifyPermission (string  $ address , string  $ permission ): bool |string 
118145 {
119- 146+  $ result  = $ this  ->mc ->verifypermission ($ address , $ permission );
147+  if  ($ result ) {
148+  $ data  = ["status "  => "success " , "code "  => 200 , "data "  => ["data "  => $ result ]];
149+  return  $ this  ->helper ->makeJsonSuccessResponse ($ data );
150+  } else  {
151+  $ data  = ["status "  => "error " , "code "  => 404 , "data "  => ["data "  => "Not allowed or permission was not granted to begin with " ]];
152+  return  $ this  ->helper ->makeJsonErrorResponse ($ data );
153+  }
120154 }
121155
122156}
0 commit comments