File tree Expand file tree Collapse file tree 1 file changed +10
-1
lines changed Expand file tree Collapse file tree 1 file changed +10
-1
lines changed Original file line number Diff line number Diff line change @@ -999,7 +999,16 @@ protected function _detect_api_key()
999999 // Find the key from server or arguments
10001000 if (($ key = isset ($ this ->_args [$ api_key_variable ]) ? $ this ->_args [$ api_key_variable ] : $ this ->input ->server ($ key_name )))
10011001 {
1002- if ( ! ($ row = $ this ->rest ->db ->where ($ this ->config ->item ('rest_key_column ' ), $ key )->get ($ this ->config ->item ('rest_keys_table ' ))->row ()))
1002+ //if you have a field to check if the API KEY provided by the user is activated or not
1003+ //(in case you quickly want to deactivate specific users)
1004+ // you can also perform an extra check for this
1005+
1006+ $ existsactive = $ this ->db ->query ("SELECT api_key_activated FROM api_keys WHERE api_key = ' " .$ key ."' " );
1007+ // Using the Query builder method. This will only work if you have a column named activated in the api_key table.
1008+ //If you also want to add this as a config item replace the get('activated') with $this->config->item('rest_key_activated_column').
1009+ $ existsactive = $ this ->rest ->db ->where ($ this ->config ->item ('rest_key_column ' ), $ key )->get ('activated ' )->result ();
1010+ $ isactive = $ existsactive ->result ();
1011+ if ( ! ($ row = $ this ->rest ->db ->where ($ this ->config ->item ('rest_key_column ' ), $ key )->get ($ this ->config ->item ('rest_keys_table ' ))->row () ) || $ isactive [0 ]->api_key_activated == 'no ' )
10031012 {
10041013 return FALSE ;
10051014 }
You can’t perform that action at this time.
0 commit comments