Exemplo n.º 1
0
 public function action_delete($id = null)
 {
     if ($api_user = Model_Api_User::find($id)) {
         $api_user->delete();
         Session::set_flash('success', 'Deleted api_user #' . $id);
     } else {
         Session::set_flash('error', 'Could not delete api_user #' . $id);
     }
     Response::redirect('api/users');
 }
Exemplo n.º 2
0
	public static function check_api_key($key)
	{
		$keyDetails = \Model_Api_User::find()->where('key', $key)->where('status', 'active');
		if ($keyDetails->count() > 0)
		{
			$apiDetails = $keyDetails->get_one();
			$ipAddresses = explode("/", $apiDetails->ip);
			
			if (in_array('0.0.0.0', $ipAddresses))
			{
				return true;
			}
			else
			{
				return false;
			}
		}
		else
		{
			return false;	
		}
	}