# How to run default script when user request the api

**URL:** <https://discuss.elastic.co/t/how-to-run-default-script-when-user-request-the-api/15422>\
**Category:** Elasticsearch\
**Created:** [January 26, 2014, 4:39am UTC](https://discuss.elastic.co/t/how-to-run-default-script-when-user-request-the-api/15422 "2014-01-26T04:39:59Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![David\_shi](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/david_shi/32/1125_2.png) [@David\_shi](https://discuss.elastic.co/u/David_shi)\
**Post date:** [January 26, 2014, 4:39am UTC](https://discuss.elastic.co/t/how-to-run-default-script-when-user-request-the-api/15422/1 "2014-01-26T04:39:59Z")

</div>

Hi guys:

I have data like: {"emolument":20000, "partment":"Financial", "ACL":  
{"jack":"rw","david":"r"} }

Now when user request api with "DELETE" or "PUT" (with useranme like.  
jack, david....), I will check permission with username in ACL.

But how to do it would be more convenient to perform this check by default,  
like. if ACL.username in [rw, w] to do next else stop request and raise  
exception

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/6998a8c5-739e-4ed9-918a-528378cf2348%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/6998a8c5-739e-4ed9-918a-528378cf2348%40googlegroups.com).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<div class="post-metadata">

**Author:** ![Hendrik](https://avatars.discourse-cdn.com/v4/letter/h/839c29/32.png) [@Hendrik](https://discuss.elastic.co/u/Hendrik)\
**Post date:** [February 4, 2014, 10:50am UTC](https://discuss.elastic.co/t/how-to-run-default-script-when-user-request-the-api/15422/2 "2014-02-04T10:50:15Z")

</div>

Maybe this helps: [GitHub - salyh/elasticsearch-security-plugin: Kerberos, LDAP, Active Directory, PKI/SSL/TLS and host/ip based ACL coarse-grained and document level security for elasticsearch (Authentication, Authorization, Auth, Spnego, ACL, Mutual authentication)](https://github.com/salyh/elasticsearch-security-plugin)

Am Sonntag, 26. Januar 2014 05:39:59 UTC+1 schrieb David shi:

> Hi guys:
> 
> I have data like: {"emolument":20000, "partment":"Financial", "ACL":  
> {"jack":"rw","david":"r"} }
> 
> Now when user request api with "DELETE" or "PUT" (with useranme like.  
> jack, david....), I will check permission with username in ACL.
> 
> But how to do it would be more convenient to perform this check by  
> default, like. if ACL.username in [rw, w] to do next else stop request  
> and raise exception

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/f4085f7c-bd13-4853-8f26-84ed33a724f5%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/f4085f7c-bd13-4853-8f26-84ed33a724f5%40googlegroups.com).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [July 6, 2017, 1:52am UTC](https://discuss.elastic.co/t/how-to-run-default-script-when-user-request-the-api/15422/3 "2017-07-06T01:52:48Z")

</div>

Closed on July 6, 2017, 1:52am UTC


