Skip to content

Commit

Permalink
Better naming of permissions in manager.
Browse files Browse the repository at this point in the history
  • Loading branch information
wunki committed May 24, 2011
1 parent 537bbea commit 90b9652
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions userena/managers.py
Expand Up @@ -13,7 +13,7 @@

SHA1_RE = re.compile('^[a-f0-9]{40}$')

PERMISSIONS = {
ASSIGNED_PERMISSIONS = {
'profile': ('view_profile', 'change_profile'),
'user': ('change_user', 'delete_user')
}
Expand Down Expand Up @@ -56,11 +56,11 @@ def create_inactive_user(self, username, email, password, send_email=True):
new_profile.save(using=self._db)

# Give permissions to view and change profile
for perm in PERMISSIONS['profile']:
for perm in ASSIGNED_PERMISSIONS['profile']:
assign(perm, new_user, new_profile)

# Give permissinos to view and change itself
for perm in PERMISSIONS['user']:
for perm in ASSIGNED_PERMISSIONS['user']:
assign(perm, new_user, new_user)

if send_email:
Expand Down Expand Up @@ -194,7 +194,7 @@ def check_permissions(self):
if not user.username == 'AnonymousUser':
all_permissions = get_perms(user, user.get_profile()) + get_perms(user, user)

for model, perms in PERMISSIONS.items():
for model, perms in ASSIGNED_PERMISSIONS.items():
if model == 'profile':
perm_object = user.get_profile()
else: perm_object = user
Expand Down

0 comments on commit 90b9652

Please sign in to comment.