Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Permissions allow users to approver specific records only #200

Open
baselakasha opened this issue Jun 12, 2022 · 0 comments
Open

Permissions allow users to approver specific records only #200

baselakasha opened this issue Jun 12, 2022 · 0 comments

Comments

@baselakasha
Copy link

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant