Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
a REST API question
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  3 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Amiramix  
View profile  
 More options Oct 6 2012, 2:25 pm
From: Amiramix <li...@gjunka.com>
Date: Sat, 6 Oct 2012 11:25:15 -0700 (PDT)
Local: Sat, Oct 6 2012 2:25 pm
Subject: a REST API question

What's the difference between controller_api, which is in the mod_base, and
mod_rest?

I'd like to use controller_api to provide some JSON files but I can't use
the default is_authorized that is defined in that module because I am using
an external authorization (my users are not stored in Zotonic database).
Copying the other methods and creating my own controller would rather prove
that Zotonic isn't flexible enough so I am trying to avoid that. Can
anybody please suggest a simple and effective solution? I don't mind adding
some code to Zotonic if needed.


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Marc Worrell  
View profile  
 More options Oct 6 2012, 4:04 pm
From: Marc Worrell <mworr...@me.com>
Date: Sat, 06 Oct 2012 22:04:40 +0200
Local: Sat, Oct 6 2012 4:04 pm
Subject: Re: [Zotonic-Dev] a REST API question
Hi,

controller_api is for access to the services in the modules.

controller_rest_rsc (in mod_rest) is an experimental controller for REST like access to resources.

Did you implement your own ACL module?

- Marc

On 6 okt. 2012, at 20:25, Amiramix wrote:


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Amiramix  
View profile  
 More options Oct 6 2012, 5:35 pm
From: Amiramix <li...@gjunka.com>
Date: Sat, 6 Oct 2012 14:35:15 -0700 (PDT)
Local: Sat, Oct 6 2012 5:35 pm
Subject: Re: [Zotonic-Dev] a REST API question

No, I implemented my own controller with custom is_authorized method. Then
I store the userId in a custom field in the context. But I think
implementing my custom ACL module may be a good idea as long as I don't
have to store the user in the rsc table and still have the rest of Zotonic
working correctly. Currently some of the modules assume that the user is
stored in the rsc table and I am afraid that even if I implement my own ACL
module I still won't be able to use those modules.

Thanks for the explanation. I think I need to use controller_api because
the data I need to return as JSON come from an external database and not
from the rsc table. So I have the problem that the controller_api checks if
the user is logged in by checking if user_id in the context is not
undefined. In my case is undefined because I am using a custom field.

I think there are three ways of dealing with this problem:

1. In other modules don't assume that the user is stored in the rsc table
2. Have a separate module that would store and manage users in the system
(not necessarily in the rsc table) and use that module in other modules
3. Don't assume that the user is stored in user_id field in the context


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »