| # Copyright 2025 The casbin Authors. All Rights Reserved. |
| # |
| # Licensed under the Apache License, Version 2.0 (the "License"); |
| # you may not use this file except in compliance with the License. |
| # You may obtain a copy of the License at |
| # |
| # http://www.apache.org/licenses/LICENSE-2.0 |
| # |
| # Unless required by applicable law or agreed to in writing, software |
| # distributed under the License is distributed on an "AS IS" BASIS, |
| # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| # See the License for the specific language governing permissions and |
| # limitations under the License. |
| |
| from django.db import models |
| |
| |
| class CasbinRule(models.Model): |
| ptype = models.CharField(max_length=255) |
| v0 = models.CharField(max_length=255) |
| v1 = models.CharField(max_length=255) |
| v2 = models.CharField(max_length=255) |
| v3 = models.CharField(max_length=255) |
| v4 = models.CharField(max_length=255) |
| v5 = models.CharField(max_length=255) |
| |
| class Meta: |
| db_table = "casbin_rule" |
| |
| def __str__(self): |
| text = self.ptype |
| |
| if self.v0: |
| text = text + ", " + self.v0 |
| if self.v1: |
| text = text + ", " + self.v1 |
| if self.v2: |
| text = text + ", " + self.v2 |
| if self.v3: |
| text = text + ", " + self.v3 |
| if self.v4: |
| text = text + ", " + self.v4 |
| if self.v5: |
| text = text + ", " + self.v5 |
| return text |
| |
| def __repr__(self): |
| return '<CasbinRule {}: "{}">'.format(self.id, str(self)) |