Browse Source

added in_create in profile's permission info, as it represents create permission, but for a doc which is not supposed to be created using New button

version-14
Anand Doshi 13 years ago
parent
commit
5da296909f
1 changed files with 11 additions and 3 deletions
  1. +11
    -3
      py/webnotes/profile.py

+ 11
- 3
py/webnotes/profile.py View File

@@ -40,6 +40,9 @@ class Profile:
self.can_get_report = []
self.allow_modules = []
# for doctypes with create permission but are not supposed to be created using New
self.in_create = []
def _load_roles(self):
self.roles = webnotes.get_roles()
return self.roles
@@ -103,9 +106,11 @@ class Profile:
p = self.perm_map.get(dt, {})

if not dtp.get('istable'):
if p.get('create') and not dtp.get('in_create') and \
not dtp.get('issingle'):
self.can_create.append(dt)
if p.get('create') and not dtp.get('issingle'):
if dtp.get('in_create'):
self.in_create.append(dt)
else:
self.can_create.append(dt)
elif p.get('write'):
self.can_write.append(dt)
elif p.get('read'):
@@ -127,6 +132,7 @@ class Profile:
self.allow_modules.append(dtp.get('module'))

self.can_write += self.can_create
self.can_write += self.in_create
self.can_read += self.can_write
self.all_read += self.can_read

@@ -225,6 +231,8 @@ class Profile:
d['all_read'] = self.all_read
d['can_search'] = list(set(self.can_search))
d['in_create'] = self.in_create
return d
def load_from_session(self, d):


Loading…
Cancel
Save