Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactoring roles module to compatibility with django permission backend
- Loading branch information
1 parent
512df4e
commit 6852439
Showing
5 changed files
with
62 additions
and
181 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,2 @@ | ||
|
||
from django.db import models | ||
from django.conf import settings | ||
|
||
|
||
class UserRole(models.Model): | ||
user = models.OneToOneField(settings.AUTH_USER_MODEL, related_name='role') | ||
role_name = models.CharField(max_length=255) | ||
|
||
def __unicode__(self): | ||
return self.user.get_full_name() + ' - ' + self.role_name | ||
|
||
|
||
class UserPermission(models.Model): | ||
user = models.ForeignKey(settings.AUTH_USER_MODEL, related_name='+') | ||
permission_name = models.CharField(max_length=255) | ||
is_granted = models.BooleanField(default=False) | ||
|
||
def __unicode__(self): | ||
return self.user.get_full_name() + ' - ' + self.permission_name + ' - ' + str(self.is_granted) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters