auth.wiki makes admin wiki_editor group member
This commit is contained in:
@@ -1 +1 @@
|
|||||||
Version 2.00.0 (2012-08-19 15:11:01) dev
|
Version 2.00.0 (2012-08-19 18:20:11) dev
|
||||||
|
|||||||
@@ -338,7 +338,6 @@ def check_credentials(request, other_application='admin', expiration = 60*60):
|
|||||||
s = get_session(request, other_application)
|
s = get_session(request, other_application)
|
||||||
return (s.authorized and s.last_time and s.last_time > dt)
|
return (s.authorized and s.last_time and s.last_time > dt)
|
||||||
|
|
||||||
|
|
||||||
def fix_newlines(path):
|
def fix_newlines(path):
|
||||||
regex = re.compile(r'''(\r
|
regex = re.compile(r'''(\r
|
||||||
|\r|
|
|\r|
|
||||||
|
|||||||
+6
-1
@@ -28,7 +28,7 @@ from email import MIMEBase, MIMEMultipart, MIMEText, Encoders, Header, message_f
|
|||||||
from contenttype import contenttype
|
from contenttype import contenttype
|
||||||
from storage import Storage, StorageList, Settings, Messages
|
from storage import Storage, StorageList, Settings, Messages
|
||||||
from utils import web2py_uuid
|
from utils import web2py_uuid
|
||||||
from fileutils import read_file
|
from fileutils import read_file, check_credentials
|
||||||
from gluon import *
|
from gluon import *
|
||||||
from gluon.contrib.autolinks import expand_one
|
from gluon.contrib.autolinks import expand_one
|
||||||
|
|
||||||
@@ -4519,6 +4519,11 @@ class Wiki(object):
|
|||||||
if tag: db.wiki_tag.insert(name=tag,wiki_page=page.id)
|
if tag: db.wiki_tag.insert(name=tag,wiki_page=page.id)
|
||||||
db.wiki_page._after_insert.append(update_tags_insert)
|
db.wiki_page._after_insert.append(update_tags_insert)
|
||||||
db.wiki_page._after_update.append(update_tags_update)
|
db.wiki_page._after_update.append(update_tags_update)
|
||||||
|
if check_credentials(current.request) and \
|
||||||
|
not 'wiki_editor' in auth.user_groups.values():
|
||||||
|
group = db.auth_group(role='wiki_editor')
|
||||||
|
gid = group.id if group else db.auth_group.insert(role='wiki_editor')
|
||||||
|
auth.add_membership(gid)
|
||||||
# WIKI ACCESS POLICY
|
# WIKI ACCESS POLICY
|
||||||
def not_authorized(self,page=None):
|
def not_authorized(self,page=None):
|
||||||
raise HTTP(401)
|
raise HTTP(401)
|
||||||
|
|||||||
Reference in New Issue
Block a user