Skip to content

Permissions allow users to approver specific records only #200

@baselakasha

Description

@baselakasha

Hello,

I have a use case where the approver needs to be an "admin" of a team in order to approve joining requests. This means that only the admin of that specific team can approve requests.

Is that achievable using the permissions system?

My models look like:

class Team(model.Mode):
    name = models.CharField(max_length=255)
    admin = models.ForeignKey(User, on_delete=models.CASCADE)


class Role(models.Model):
   # eg: admin, member
   name = models.CharField(max_length=64, null=False, unique=True)


class Relationship(models.Model):
    user        = models.ForeignKey(User, on_delete=models.CASCADE)
    team        = models.ForeignKey(Team, on_delete=models.CASCADE)
    role        = models.ForeignKey(Role, on_delete=models.CASCADE)
    status      = StateField(on_delete=models.CASCADE) # status can be pending, active or rejected

Once a user create a new team, they automatically have the relationship of admin which is approved. Then they can approve pending Relationships for their teams that they are admin of.

Thanks.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions