B
B
beatlejute2011-10-28 08:16:18
Drupal
beatlejute, 2011-10-28 08:16:18

How can I make it so that only the author can view nodes of a certain type? (Drupal)

The bottom line is,
there is a type of nodes, for example, "Note".
And only he can see the “notes” created by the user and, accordingly, he should not see strangers.

Answer the question

In order to leave comments, you need to log in

6 answer(s)
A
Aminuofu, 2011-10-28
@beatlejute

Alternatively, create your own module and use hook_node_access (if it's D7). You will get something like this:

<?php
    function MY_MODULE_node_access($node, $op, $account) {
        if ($node->type == 'MY_NODE_TYPE' && $op == 'view') {
            if ($node->uid == $account->uid) {
                return NODE_ACCESS_ALLOW;
            }
            return NODE_ACCESS_DENY;
        }
    }

J
jj_killer, 2013-06-05
@jj_killer

On the topic, the first thing that came to my mind: REST API Design Rulebook, RESTful Java with Jax-RS, RESTful Web Services Cookbook.

L
Lonkly, 2013-06-04
@Lonkly

>> as applied to Java
It is better not to apply Java to web development. On the topic: learn JavaScript, now everyone is building on it

S
Sergey Cherepanov, 2013-06-05
@fear86

More about REST - blog.apigee.com/detail/restful_api_design

A
anmipo, 2013-06-05
@anmipo

Talk by Joshua Bloch (author of Effective Java, Java Concurrency In Practice, worked at Google as Chief Java Architect): " How to design a good API and why it matters ".

A
afiskon, 2013-06-10
@afiskon

If we are talking about web api - definitely REST. Otherwise, proceed from the task and your needs. For example, if you have a user database, write methods/functions getUserIdList(), getUserById(), and so on. Combine them into modules/classes according to functionality. Let's say users need to be separate from products. Remember abstraction. For example, if you suddenly decide to cache a list of user ids, the interface should remain the same.
In general, I think it comes with experience.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question