<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Implement Authorization for $batch request XSJS in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/implement-authorization-for-batch-request-xsjs/m-p/12278374#M1988499</link>
    <description>&lt;P&gt;Hi Sunoj,&lt;/P&gt;&lt;P&gt;You don't put authorization check on batch request itself. You do the authorization check on those individual CRUD operations that are put inside the batch request.&lt;/P&gt;</description>
    <pubDate>Sun, 12 Jul 2020 05:57:05 GMT</pubDate>
    <dc:creator>jhodel18</dc:creator>
    <dc:date>2020-07-12T05:57:05Z</dc:date>
    <item>
      <title>Implement Authorization for $batch request XSJS</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/implement-authorization-for-batch-request-xsjs/m-p/12278373#M1988498</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
  &lt;P&gt;I have an oData on SCP Cloud foundry XSA. &lt;/P&gt;
  &lt;P&gt;I want to implement authorization check for $batch request. Basically i am having express + passport for the user auth related aspects. &lt;/P&gt;
  &lt;P&gt;A set of users have GET privilege, another set have update prevliage etc.&lt;/P&gt;
  &lt;P&gt;The logics works perfectly fine for GET/PUT/POST/DELETE request.&lt;/P&gt;
  &lt;P&gt;But for $batch as we know its at POST request with multiple request in request body. It can be a GET/PUT etc.&lt;/P&gt;
  &lt;P&gt;So how do we do such a thing? &lt;/P&gt;</description>
      <pubDate>Sat, 11 Jul 2020 15:22:15 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/implement-authorization-for-batch-request-xsjs/m-p/12278373#M1988498</guid>
      <dc:creator>sunojmichael1</dc:creator>
      <dc:date>2020-07-11T15:22:15Z</dc:date>
    </item>
    <item>
      <title>Re: Implement Authorization for $batch request XSJS</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/implement-authorization-for-batch-request-xsjs/m-p/12278374#M1988499</link>
      <description>&lt;P&gt;Hi Sunoj,&lt;/P&gt;&lt;P&gt;You don't put authorization check on batch request itself. You do the authorization check on those individual CRUD operations that are put inside the batch request.&lt;/P&gt;</description>
      <pubDate>Sun, 12 Jul 2020 05:57:05 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/implement-authorization-for-batch-request-xsjs/m-p/12278374#M1988499</guid>
      <dc:creator>jhodel18</dc:creator>
      <dc:date>2020-07-12T05:57:05Z</dc:date>
    </item>
    <item>
      <title>Re: Implement Authorization for $batch request XSJS</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/implement-authorization-for-batch-request-xsjs/m-p/12278375#M1988500</link>
      <description>&lt;P&gt;Hi Jhodel,&lt;/P&gt;&lt;P&gt;Thanks!.&lt;/P&gt;&lt;P&gt;Ya, totally agree that we put authorization check for CRUD requests inside batch.&lt;/P&gt;&lt;P&gt;That's my doubt as well. &lt;/P&gt;&lt;P&gt;How do we get the request details inside. I know about that the code added below can give me the request body content as a string which, I might be able to phase based on boundary and changeset. But rather than that, is there any npm package ? Or is there a better way to do that? &lt;/P&gt;&lt;P&gt;Basically what I need, is to get the all the requests that are inside the request body, as a request array. So that, I can process them in sequence.&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;var body = [];
req.on('data', (chunk) =&amp;gt; {
  body.push(chunk);
}).on('end', () =&amp;gt; {
  body = Buffer.concat(body).toString();&amp;lt;br&amp;gt;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sun, 12 Jul 2020 16:13:28 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/implement-authorization-for-batch-request-xsjs/m-p/12278375#M1988500</guid>
      <dc:creator>sunojmichael1</dc:creator>
      <dc:date>2020-07-12T16:13:28Z</dc:date>
    </item>
    <item>
      <title>Re: Implement Authorization for $batch request XSJS</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/implement-authorization-for-batch-request-xsjs/m-p/12278376#M1988501</link>
      <description>&lt;P&gt;Wait?! Where did you inject that code? To me, it looks like you have injected a middleware to your XSJS or XSODATA implementation, is this correct assumption?&lt;/P&gt;&lt;P&gt;If you are using XSJS just like what you mentioned on the title of your post, the parsing of the body of the $batch request is already handled by the XSODATA framework and you shouldn't really bother yourself about parsing it yourself. The only thing you need to do is use the XSJS event hooks (before, on, and after events) that the framework provided to you.&lt;/P&gt;</description>
      <pubDate>Mon, 13 Jul 2020 13:41:03 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/implement-authorization-for-batch-request-xsjs/m-p/12278376#M1988501</guid>
      <dc:creator>jhodel18</dc:creator>
      <dc:date>2020-07-13T13:41:03Z</dc:date>
    </item>
    <item>
      <title>Re: Implement Authorization for $batch request XSJS</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/implement-authorization-for-batch-request-xsjs/m-p/12278377#M1988502</link>
      <description>&lt;P&gt;Yes Jhodel.&lt;/P&gt;&lt;P&gt;We have a middleware+ passport in server.js file. and process some of the odata request there - which is needed.&lt;/P&gt;&lt;P&gt;My only issue was with $batch, I can have validation exits like you said.&lt;/P&gt;&lt;P&gt;But do the hook evens trigger for GET requests[I would be bypassing the $batch from server.js].&lt;/P&gt;</description>
      <pubDate>Tue, 14 Jul 2020 10:30:12 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/implement-authorization-for-batch-request-xsjs/m-p/12278377#M1988502</guid>
      <dc:creator>sunojmichael1</dc:creator>
      <dc:date>2020-07-14T10:30:12Z</dc:date>
    </item>
  </channel>
</rss>

