added guest read permission to blog

This commit is contained in:
Anand Doshi 2012-07-27 14:39:27 +05:30
parent adc6c7c02b
commit b3a4c09e07
5 changed files with 27 additions and 19 deletions

View File

@ -0,0 +1,11 @@
def execute():
"""allocate read write permission to guest for doctype 'Blog'"""
import webnotes
webnotes.conn.sql("""delete from `tabDocPerm` where parent = 'Blog'""")
webnotes.conn.commit()
import webnotes.model.sync
webnotes.model.sync.sync('website', 'blog', 1)
webnotes.conn.begin()

View File

@ -497,5 +497,9 @@ patch_list = [
'patch_file': 'sync_trial_balance',
'description': "sync trial balance"
},
{
'patch_module': 'patches.july_2012',
'patch_file': 'blog_guest_permission',
},
]

View File

@ -34,6 +34,8 @@ def get_blog_list(args=None):
from webnotes.utils import global_date_format, get_fullname
res['full_name'] = get_fullname(res['owner'])
res['published'] = global_date_format(res['published'])
if not res['content']:
res['content'] = website.web_cache.get_html(res['name'])
res['content'] = split_blog_content(res['content'])
res['content'] = res['content'][:1000]
@ -94,9 +96,6 @@ def add_comment(args=None):
website.web_cache.clear_cache(args.get('page_name'),
args.get('comment_doctype'), args.get('comment_docname'))
# loads fresh blog into cache
get_blog_content(args.get('page_name'))
import webnotes.utils
comment['comment_date'] = webnotes.utils.pretty_date(comment['creation'])

View File

@ -3,9 +3,9 @@
# These values are common in all dictionaries
{
'creation': '2012-05-28 19:22:38',
'creation': '2012-07-13 13:02:27',
'docstatus': 0,
'modified': '2012-06-22 18:56:16',
'modified': '2012-07-27 14:15:24',
'modified_by': u'Administrator',
'owner': u'Administrator'
},
@ -40,6 +40,7 @@
'parent': u'Blog',
'parentfield': u'permissions',
'parenttype': u'DocType',
'permlevel': 0,
'read': 1
},
@ -51,10 +52,8 @@
# DocPerm
{
'cancel': 1,
'create': 1,
'doctype': u'DocPerm',
'permlevel': 0,
'role': u'Website Manager',
'write': 1
},
@ -63,7 +62,6 @@
{
'create': 1,
'doctype': u'DocPerm',
'permlevel': 0,
'role': u'Blogger',
'write': 1
},
@ -71,15 +69,8 @@
# DocPerm
{
'doctype': u'DocPerm',
'permlevel': 1,
'role': u'Website Manager'
},
# DocPerm
{
'doctype': u'DocPerm',
'permlevel': 1,
'role': u'Blogger'
'role': u'Guest',
'write': 0
},
# DocField

View File

@ -34,7 +34,8 @@ class DocType:
# clear web cache
import website.web_cache
website.web_cache.refresh_cache(build=['Blog'])
#website.web_cache.refresh_cache(build=['Blog'])
website.web_cache.refresh_cache()
from webnotes.session_cache import clear_cache
clear_cache('Guest')
@ -48,6 +49,8 @@ class DocType:
d = Document('Default Home Page')
d.parent = 'Control Panel'
d.parenttype = 'Control Panel'
d.parentfield = 'default_home_pages'
d.role = 'Guest'
d.home_page = self.doc.home_page
d.save()