Answer the question
In order to leave comments, you need to log in
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
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;
}
}
On the topic, the first thing that came to my mind: REST API Design Rulebook, RESTful Java with Jax-RS, RESTful Web Services Cookbook.
>> 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
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 ".
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 questionAsk a Question
731 491 924 answers to any question