Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

General Questions /

General questions about getting started with SilverStripe that don't fit in any of the categories above.

Moderators: martimiz, Sean, biapar, Willr, Ingo, swaiba, simon_w

Permissions on DataObject for RESTful server $api_access


Reply


2 Posts   687 Views

Avatar
woodb2

Community Member, 48 Posts

18 May 2012 at 3:06am

I have a DataObject "Enhancement"

Another server on our internal network needs to be able to pull data from Enhancement.

I've set $api_access with:

static $api_access = array(
      'view' => array(
         'Title',
         'userid',
         'Description',
         'Ecallnumber',
         'feedback'));

If I'm logged in I can go to my URL http://servername/enhancement/api/V1/Enhancement and see the data.

If I log out of the site I only get <DataObjectSet totalSize="48">
</DataObjectSet>

How can I allow users who aren't logged access to view the data?

Thanks,
Brian

Avatar
woodb2

Community Member, 48 Posts

18 May 2012 at 11:19am

Just needed to add

function canView(){
return true;
}