Is there a way to allow the creation of nodes only via services and not via node/add? I want that nodes are created by the users of a mobile application, and not using the web interface.
Is this possible?
Drupal Answers is a question and answer site for Drupal developers and administrators. It only takes a minute to sign up.Sign up to join this community
I have created a module that only allows logins through services.. therefore, you can only create a node through services if you use it in conjuction with a Session Limit, or other module which prevents multiple sessions.
Still experimental but please try, and if you find bugs, report. Hope it works for you.
Content Access allows you to manage permissions for content types by role. It allows you to specify custom view, view own, edit, edit own, delete and delete own permissions for each content type. You can restrict access to a content type by not assigning the content type permissions to the user role.
Using refineo's answer for inspiration and expanding you could :
1) setup a new roll X
2) Set permission on node creation such that only a user of roll X can create nodes
3) use Services via mobile to obtain a session
4) Grant a roll X to the user that just logged in via Services
5) Allow user to create node via Services
6) revoke roll x from user on logout
Granting and revoking rolls might be easier with Rules module
You'll want to expire sessions such that someone on their mobile app will not be logged in on the website (on a browser) at the same time because this way they will have access to node/add. Take a look at Session Limit
You could create the following rule.
Event: Drupal is initializing (though there is a performance consideration here - this will fire on every request).
Condition: Data Comparison: Compare the current path (using the pattern [site:current-page:path]) to the value node/add/article (or whichever content type you want to prevent browser users accessing).
Actions: Page Redirect to a node telling the user that access is denied.
Users will still be able to add content via the service url.
Adding another condition to filter for roles would allow admins or other roles to create new content in the browser.