Jump to content

  • You cannot start a new topic
  • You cannot reply to this topic

How To Deny Some Api Features Rate Topic   - - - - -

 
  • teosu
  • Senior Member
  • Members
  • Join Date: 09-Oct 14
  • 304 posts

Posted 25 July 2018 - 04:47 PM #1

hi i want to deny some api responses.

1-> disable block management

2-> denny admin user creation

 

how can i do that ? with my_changes addon ?



 
  • tbirnseth
  • CS Cart Expert
  • Authorized Reseller
  • Join Date: 08-Nov 08
  • 10770 posts

Posted 25 July 2018 - 08:42 PM #2

API honors the Permissions settings for Admin usergroups.  So use the API key associated with the user/usergroup you want to restrict.


EZ Merchant Solutions: Custom (USA based) B2B Development, Consulting, Development and Special Projects (get a quote here).
Commercial addons, payment methods and modifications to meet your business and operations needs.


 
  • eComLabs
  • CS-Cart Expert
  • Authorized Reseller
  • Join Date: 27-Jan 14
  • 17833 posts

Posted 26 July 2018 - 06:11 AM #3

hi i want to deny some api responses.

1-> disable block management

2-> denny admin user creation

 

how can i do that ? with my_changes addon ?

 

Yes, you can use the api_handle_request (app/Tygh/Api.php) hook in the My changes addon to make these changes


GET A FREE QUOTE | CS-Cart Add-ons | CS-Cart Licenses | CS-Cart Development | CS-Cart Design | Server Configuration | UniTheme and YOUPI
CS-Cart                USD 345     Multi-Vendor              USD 1250    CS-Cart RU                         24500 руб.
CS-Cart Ultimate  USD 775     CS-Cart + YOUPI      USD 545      CS-Cart RU + UniTheme    36000 руб.


 
  • teosu
  • Senior Member
  • Members
  • Join Date: 09-Oct 14
  • 304 posts

Posted 26 July 2018 - 07:53 AM #4

can u make me an sample  code? i try something but cant succes.  please give me advice for deny adding admin user ? or disable PUT POST block content



 
  • eComLabs
  • CS-Cart Expert
  • Authorized Reseller
  • Join Date: 27-Jan 14
  • 17833 posts

Posted 26 July 2018 - 12:49 PM #5

You can find useful information about hooks here

https://docs.cs-cart...ards/hooks.html

GET A FREE QUOTE | CS-Cart Add-ons | CS-Cart Licenses | CS-Cart Development | CS-Cart Design | Server Configuration | UniTheme and YOUPI
CS-Cart                USD 345     Multi-Vendor              USD 1250    CS-Cart RU                         24500 руб.
CS-Cart Ultimate  USD 775     CS-Cart + YOUPI      USD 545      CS-Cart RU + UniTheme    36000 руб.


 
  • teosu
  • Senior Member
  • Members
  • Join Date: 09-Oct 14
  • 304 posts

Posted 26 July 2018 - 02:12 PM #6

i know how can i use hooks. i just cant find any usable values on api_handle_request hooks.



 
  • tbirnseth
  • CS Cart Expert
  • Authorized Reseller
  • Join Date: 08-Nov 08
  • 10770 posts

Posted 26 July 2018 - 05:47 PM #7

Not sure what you mean.  The fn_set_hook('api_handle_request', $this, $authorized); in app/Tygh/Api.php uses both thee result from authentication and 'this' (which contains the current request).  You should be able to look at 'this' properties and then set 'authorized' appropriately if it needs to be restricted.

 

Suggest you create your hook and then dump the value of $this by using fn_print_r($this).  You can then determine what properties you should use in your specific logic.


EZ Merchant Solutions: Custom (USA based) B2B Development, Consulting, Development and Special Projects (get a quote here).
Commercial addons, payment methods and modifications to meet your business and operations needs.


 
  • teosu
  • Senior Member
  • Members
  • Join Date: 09-Oct 14
  • 304 posts

Posted 26 July 2018 - 05:56 PM #8

I try what u say , anyway i will play more :-( if anyone can help me i will be happy

 
  • tbirnseth
  • CS Cart Expert
  • Authorized Reseller
  • Join Date: 08-Nov 08
  • 10770 posts

Posted 26 July 2018 - 06:40 PM #9

I assumed the following was a statement not a question....

i know how can i use hooks.

 

If you don't know about hooks and PHP classes, I would suggest you hire one of the developers here on the forum (like me) to do the work for you after you clearly communicate your specific requirements.  Click the link in my profile to send me your requirements and I'll be happy to give you a quote.


EZ Merchant Solutions: Custom (USA based) B2B Development, Consulting, Development and Special Projects (get a quote here).
Commercial addons, payment methods and modifications to meet your business and operations needs.


 
  • teosu
  • Senior Member
  • Members
  • Join Date: 09-Oct 14
  • 304 posts

Posted 26 July 2018 - 06:52 PM #10

Mate, i check with print_r all requests. Didnt turn me post variables eg: user_type . Can i tell u now?

 
  • eComLabs
  • CS-Cart Expert
  • Authorized Reseller
  • Join Date: 27-Jan 14
  • 17833 posts

Posted 27 July 2018 - 06:00 AM #11

Mate, i check with print_r all requests. Didnt turn me post variables eg: user_type . Can i tell u now?

 

Start from checking the $_SERVER array. Possibly it contains some user identifiers 


GET A FREE QUOTE | CS-Cart Add-ons | CS-Cart Licenses | CS-Cart Development | CS-Cart Design | Server Configuration | UniTheme and YOUPI
CS-Cart                USD 345     Multi-Vendor              USD 1250    CS-Cart RU                         24500 руб.
CS-Cart Ultimate  USD 775     CS-Cart + YOUPI      USD 545      CS-Cart RU + UniTheme    36000 руб.


 
  • tbirnseth
  • CS Cart Expert
  • Authorized Reseller
  • Join Date: 08-Nov 08
  • 10770 posts

Posted 27 July 2018 - 06:31 PM #12

It's a PHP hook.  It will only pass the class pointer and an integer which indicates whether to allow access or not.  The $this->request should get you the actual request.


EZ Merchant Solutions: Custom (USA based) B2B Development, Consulting, Development and Special Projects (get a quote here).
Commercial addons, payment methods and modifications to meet your business and operations needs.


 
  • teosu
  • Senior Member
  • Members
  • Join Date: 09-Oct 14
  • 304 posts

Posted 17 August 2018 - 12:37 PM #13

still i am no luck here. anyone can help me ?


i just want to disable blocks all features and adding admin user with api ?



 
  • eComLabs
  • CS-Cart Expert
  • Authorized Reseller
  • Join Date: 27-Jan 14
  • 17833 posts

Posted 17 August 2018 - 01:30 PM #14

Please contact us to get a quote


GET A FREE QUOTE | CS-Cart Add-ons | CS-Cart Licenses | CS-Cart Development | CS-Cart Design | Server Configuration | UniTheme and YOUPI
CS-Cart                USD 345     Multi-Vendor              USD 1250    CS-Cart RU                         24500 руб.
CS-Cart Ultimate  USD 775     CS-Cart + YOUPI      USD 545      CS-Cart RU + UniTheme    36000 руб.


 
  • tbirnseth
  • CS Cart Expert
  • Authorized Reseller
  • Join Date: 08-Nov 08
  • 10770 posts

Posted 17 August 2018 - 07:21 PM #15

If you would like us to help you, please use the link in my signature and provide detailed info on "what" you want to achieve (not "how" you want to achieve it).  We'll be happy to give you a reasonable quote and explain "how" we intend to accomplish it.


EZ Merchant Solutions: Custom (USA based) B2B Development, Consulting, Development and Special Projects (get a quote here).
Commercial addons, payment methods and modifications to meet your business and operations needs.