Permalink
Browse files

add permission mark

  • Loading branch information...
1 parent 23c9cf9 commit b7090576f1dcfbfe4f27c9f72e87920a1df7a9a4 binux committed Mar 16, 2012
Showing with 10 additions and 1 deletion.
  1. +10 −1 libs/user_manager.py
View
@@ -38,6 +38,15 @@
"mod_task": False,
},
}
+permission_mark = {
+ "add_task": 1,
+ "add_anonymous_task": 2,
+ "mod_task": 4,
+ "view_invalid": 8,
+ "need_miaoxia": 16,
+ "admin": 32,
+ }
+
for group, permission_dict in group_permission.iteritems():
tmp = dict(default_group_permission)
tmp.update(permission_dict)
@@ -106,4 +115,4 @@ def get_permission(self, email):
def check_permission(self, email, permission):
if email is None:
return not_login_permission[permission]
- return group_permission.get(self.get_group(email), default_group_permission)[permission]
+ return group_permission.get(self.get_group(email), default_group_permission)[permission] or (self.get_permission(email) & permission_mark[permission])

0 comments on commit b709057

Please sign in to comment.