0

Doing Drupal 8.6 is hard (I come from Laravel and Wordpress world).

I manage to do by myself OAuth token authentication with Vue, but I stopped on User relations and content-type. I know that where is programmer there is a way, but I just want to see what you do things then choose best option.

How can I, for example, create a friends system? With normal table structure is like this:

+----+--------+-----------+---------+
| id | sender | recipient |  status |
+----+--------+-----------+---------+
| 24 |   11   |    25     | [0,1,2] |
+----+--------+-----------+---------+

Is there built way in Drupal 8.6 to do it or should I get plugin? Or just do content-type Friendships with thse fields?

And when I allow user to create a Portfolio, the right way will be to create Content-Type Portfolio with Gallery field, and just give access to peoples to add nodes? How I can give User access to only edit or delete their own content?

2 Answers 2

1

You could use the Group module for this. Group allows for creating arbitrary collections of your content and users on your site, and grant access control permissions on those collections. The Group module creates groups as entities, making them fully fieldable, extensible and exportable.

Some basics about he Group module to be aware of:

  • Make sure you enable gnode, a submodule of the Group module.
  • For each group type you need to define the appropriate permissions (view, edit, delete, etc) for the various Content Types.
  • Every group can have users, roles and permissions attached to it (refer to "What are the various roles supported by the Group module?" for more details about that).

With the appropriate permissions configured, it's just a matter of assigning a node to a Group: based on how you configured the roles and permissions, the Group module will allowed/deny access for any user. Refer to "How to create collections of content that can be accessed by users with various access levels?" for more info about all this.

Resources

0
0

Drupal projects are built like Lego bricks, you add modules/features that you need from contributed modules. There aren't many projects out there that only use core Drupal modules.

To take advantage of the most praised and sought after features of Drupal it's best to use the solution tailored for it.

Sometimes you might need a custom solution where you create your own module and define database schema, but usually, you just let ready-made solutions take care of most things because they are usually fully integrated with translation, testing, other modules you might want to use...

It would be best if you could describe the features you're after and let Drupalers suggest "the Drupal way" of doing things. Although keep in mind that direct questions about "which module should I use" are not allowed here.

Drupal permissions | Edit own

Drupal Permissions system already offers a lot of control based on user Roles. Take a look there, and if it's not enough most other cases are covered with Content Access.

Friends

A lot of cases where users mark other users in some way is done with Flag. You create the "Friend" flag and allow some Roles to use it. Then your users can mark other users as their friends. Lots of information about the flagging is recordered, and it's well integrated with Views so you can create your custom lists of Flags, for example list a person's friends on their profile, show latest "friendships" on the site etc.

4
  • But there is my problem. For flag I see last update about year ago. And 8.x release is from March. It looks like no one care for it now :( and Content Access is updated to about year ago, and it is not secure by Drupal. I see lots of beta or not maintained plugins for Drupal 8. Maybe I start druppaling in Wong times :D ? Oct 6, 2018 at 8:34
  • 1
    Last release update doesn't tell you much about development activity for a module. It could be that it's very mature and working for majority of cases. A much bigger indicator is the number of installations, you can find that stats data above the download area on the project page, and the activity in the Issues queue. Security issues should be taken seriously, but it doesn't mean you can't investigate in more detail. Content access seems to have trouble with private files, so if you're not using them you're safe, and if you are you can help fix it, it's a community project after all :)
    – prkos
    Oct 6, 2018 at 11:22
  • @DariuszChowański Did you manage to solve this issue?
    – Umair
    Jun 15, 2021 at 17:42
  • Nope. I leave Drupal for custom solution. Jun 15, 2021 at 17:47

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.