4

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?

2
  • Matt, do you want unauthorized (not logged in) users to create nodes using services? Do your mobile app users log in in order to publish or not ? Can you clarify that?
    – LLub
    Commented Nov 6, 2011 at 22:42
  • Yes, so each user has to be logged in to be able to create a node
    – Matt
    Commented Nov 7, 2011 at 12:12

4 Answers 4

1

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.

http://drupal.org/sandbox/tpainton/1851382

Still experimental but please try, and if you find bugs, report. Hope it works for you.

0

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.

1
  • but the user still needs that role to be able to add content via services i.e. they still need to log in to post nodes
    – Matt
    Commented Nov 6, 2011 at 21:23
0

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

0

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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.