Advanced joins for linkage rules

Hi there

My collection userRoles belong to a course, a role and a user. This is used to set a specific role for a user in a course. (E,g, user X has the role “course_manager” in course Y).

users
- id

roles
- uid (e.g. "course_owner", "course_manager" etc.)

course
- id

userRoles
- userId
- roleUid
- courseId

In a popup-page for a course, I have a table-block that lists all userRoles for the current course. The table has a View-button for each userRole record. The button should only be visible if the following condition is met:

  • The userRole belongs to the current user (userRole.userId = currentUser.id)
    OR
  • The current user has a userRole in the current course, that is a specific value (e.g. “course_owner” or “course_manager”).

The first scenario is simply to implement. The second scenario does not work with my attempt. Is it possible with these kind of deep/advanced conditions?

Please have a look at my screenshot. This does unfortunately not work :frowning:

Kind Regards :slight_smile:

Please reproduce this problem in the demo environment.
https://a_8hwne7u84ho.v13.demo.nocobase.com/admin/
(NocoBase default username and password)
Provide detailed explanations of the problem using screenshots of the page.

OK, I have reproduced the problem in the given environment: Link to page (The page opens a Course record for an example “Course 1” that I created.)

There are two tables on the page:

  • The User Roles table shows ALL User Roles records for the course.
  • The Course Members table shows ONLY User Roles records where the role = “course_member”. (The View-button for each row in this table is controlled by linkage rules.)

In the Course Members table:

Screenshot 1:
Current user “Super Admin” is not a part of the User Roles for the course. View-button is hidden for all records = Correct!

Screenshot 2
Current user “Super Admin” has User Role = “course_owner” in the course. View-button is visible for all records = Correct!

Screenshot 3
Current user “Super Admin” has User Role = “course_member” in the course. View-button is visible for all records = Wrong! It should ONLY be visible for the own record.

Screenshot 4
This shows the linkage rules for the View-button:

  • Hide button by default.
  • Visible if the current user is the userId of the record.
  • Visible if the current user has a user role in the course, where the role is either “course_owner” OR “course_manager”.

It seems like the conditions for userRoles.userId = currentUser.id AND userRoles.role = “string” are not correctly applied TOGETHER in the query. (I have tried multiple ways of defining the conditions.)