0

Hel', I don't understand how to use "access argument" with Services Module.

Drupal is used like a server. When I follow specific link some informations about client, user and projects are added. That's work, but everybody can do it. So I want "limit access" : if you are not admin, the access is denied. So I've activated the authentication "Session authentication" and add some code in my custom module :

'create' => [
    'help' => 'Add',
    'callback' => 'custom_api_create_user',
    'access arguments' => array('administer create'),
    'access arguments append' => FALSE,
    'args' => [
        [
            'name' => 'data',
            'type' => 'struct',
            'description' => 'Something',
            'optional' => FALSE,
            'source' => 'data'
        ]
    ],
]

And when I add hook_node_access I get this message : "Access denied for user Lambda", and only the first letter of "access argument" is added to the content.

Someone can explain to me how I can add content and limit access with Services module ?

Do you understand what I want to do ?

(Yes you can see the same post here)

1
  • I can't understand only the first letter of "access argument" is added to the content.
    – Jimmy Ko
    Jul 28, 2016 at 13:47

1 Answer 1

0

in this case, the first letter is "a" because the access argument is "administer create". If I remove administer the first letter will be "c" from &create". And all fields from user entity get this letter as content :

name : "a" tel : "a" mail : "a", etc.

Actually I just want to know how to say "if you are admin you can add content, if not, you can't". The best way is to use "Session authentication" or "Basic authentication" or "oAuth" ?? Don't know...

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.