added guest read permission to blog
This commit is contained in:
parent
adc6c7c02b
commit
b3a4c09e07
11
erpnext/patches/july_2012/blog_guest_permission.py
Normal file
11
erpnext/patches/july_2012/blog_guest_permission.py
Normal 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()
|
@ -497,5 +497,9 @@ patch_list = [
|
|||||||
'patch_file': 'sync_trial_balance',
|
'patch_file': 'sync_trial_balance',
|
||||||
'description': "sync trial balance"
|
'description': "sync trial balance"
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
'patch_module': 'patches.july_2012',
|
||||||
|
'patch_file': 'blog_guest_permission',
|
||||||
|
},
|
||||||
|
|
||||||
]
|
]
|
@ -34,6 +34,8 @@ def get_blog_list(args=None):
|
|||||||
from webnotes.utils import global_date_format, get_fullname
|
from webnotes.utils import global_date_format, get_fullname
|
||||||
res['full_name'] = get_fullname(res['owner'])
|
res['full_name'] = get_fullname(res['owner'])
|
||||||
res['published'] = global_date_format(res['published'])
|
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'] = split_blog_content(res['content'])
|
||||||
res['content'] = res['content'][:1000]
|
res['content'] = res['content'][:1000]
|
||||||
|
|
||||||
@ -94,9 +96,6 @@ def add_comment(args=None):
|
|||||||
website.web_cache.clear_cache(args.get('page_name'),
|
website.web_cache.clear_cache(args.get('page_name'),
|
||||||
args.get('comment_doctype'), args.get('comment_docname'))
|
args.get('comment_doctype'), args.get('comment_docname'))
|
||||||
|
|
||||||
# loads fresh blog into cache
|
|
||||||
get_blog_content(args.get('page_name'))
|
|
||||||
|
|
||||||
import webnotes.utils
|
import webnotes.utils
|
||||||
|
|
||||||
comment['comment_date'] = webnotes.utils.pretty_date(comment['creation'])
|
comment['comment_date'] = webnotes.utils.pretty_date(comment['creation'])
|
||||||
|
@ -3,9 +3,9 @@
|
|||||||
|
|
||||||
# These values are common in all dictionaries
|
# These values are common in all dictionaries
|
||||||
{
|
{
|
||||||
'creation': '2012-05-28 19:22:38',
|
'creation': '2012-07-13 13:02:27',
|
||||||
'docstatus': 0,
|
'docstatus': 0,
|
||||||
'modified': '2012-06-22 18:56:16',
|
'modified': '2012-07-27 14:15:24',
|
||||||
'modified_by': u'Administrator',
|
'modified_by': u'Administrator',
|
||||||
'owner': u'Administrator'
|
'owner': u'Administrator'
|
||||||
},
|
},
|
||||||
@ -40,6 +40,7 @@
|
|||||||
'parent': u'Blog',
|
'parent': u'Blog',
|
||||||
'parentfield': u'permissions',
|
'parentfield': u'permissions',
|
||||||
'parenttype': u'DocType',
|
'parenttype': u'DocType',
|
||||||
|
'permlevel': 0,
|
||||||
'read': 1
|
'read': 1
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -51,10 +52,8 @@
|
|||||||
|
|
||||||
# DocPerm
|
# DocPerm
|
||||||
{
|
{
|
||||||
'cancel': 1,
|
|
||||||
'create': 1,
|
'create': 1,
|
||||||
'doctype': u'DocPerm',
|
'doctype': u'DocPerm',
|
||||||
'permlevel': 0,
|
|
||||||
'role': u'Website Manager',
|
'role': u'Website Manager',
|
||||||
'write': 1
|
'write': 1
|
||||||
},
|
},
|
||||||
@ -63,7 +62,6 @@
|
|||||||
{
|
{
|
||||||
'create': 1,
|
'create': 1,
|
||||||
'doctype': u'DocPerm',
|
'doctype': u'DocPerm',
|
||||||
'permlevel': 0,
|
|
||||||
'role': u'Blogger',
|
'role': u'Blogger',
|
||||||
'write': 1
|
'write': 1
|
||||||
},
|
},
|
||||||
@ -71,15 +69,8 @@
|
|||||||
# DocPerm
|
# DocPerm
|
||||||
{
|
{
|
||||||
'doctype': u'DocPerm',
|
'doctype': u'DocPerm',
|
||||||
'permlevel': 1,
|
'role': u'Guest',
|
||||||
'role': u'Website Manager'
|
'write': 0
|
||||||
},
|
|
||||||
|
|
||||||
# DocPerm
|
|
||||||
{
|
|
||||||
'doctype': u'DocPerm',
|
|
||||||
'permlevel': 1,
|
|
||||||
'role': u'Blogger'
|
|
||||||
},
|
},
|
||||||
|
|
||||||
# DocField
|
# DocField
|
||||||
|
@ -34,7 +34,8 @@ class DocType:
|
|||||||
|
|
||||||
# clear web cache
|
# clear web cache
|
||||||
import website.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
|
from webnotes.session_cache import clear_cache
|
||||||
clear_cache('Guest')
|
clear_cache('Guest')
|
||||||
@ -48,6 +49,8 @@ class DocType:
|
|||||||
|
|
||||||
d = Document('Default Home Page')
|
d = Document('Default Home Page')
|
||||||
d.parent = 'Control Panel'
|
d.parent = 'Control Panel'
|
||||||
|
d.parenttype = 'Control Panel'
|
||||||
|
d.parentfield = 'default_home_pages'
|
||||||
d.role = 'Guest'
|
d.role = 'Guest'
|
||||||
d.home_page = self.doc.home_page
|
d.home_page = self.doc.home_page
|
||||||
d.save()
|
d.save()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user