Campaign owner can access for editing only their campaign

I have 3 Roles

  1. Customer
  2. Business
  3. Admin

Business can create campaign to ranking customer who join the campaign and give point to customer.

So in the app have many campaigns, I want to fix that only campaign owner who can give a point to his customer who join the campaign. Cannot give a point to customer who join other campaign that they didn’t create.

I have property isBusiness to check that users are Customer/Business/Admin, but I don’t know how to specify business by who created the campaign.


Hi @Matzumoto,

As for me you need to create many-to-one relationship “Campains” - “Users”: one user can have many campaigns, but each campaign may belong only to one user.
Then when you create / manage the campaign, make sure that these options are available only for Business users (you already do it using visibility).

Best regards, Victor.

I Many-to-Many for Users-Campaign
because User: can be 1. Customers 2. Business

Customer can join many Campaigns
Business can create manny Campaigns too but Campaign only 1 Business.

So how can I fix with visibility for business who created his campaign only?

Hi @Matzumoto,

You can have several relationships between 2 collections. For example:

  • you create first customer relationship: Many Users - one Campaign.
  • you create second relationship for business: One User - Many Campaigns.
    Don’t forget to properly name the relationship fields in both collections, so that you can indicate them later.

And then you filter out the campaigns for business based on second relationship. For a logged-in user it will be something like: list of Campaigns, filtered by Logged-in User → BusinessCampaigns.


This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.