company whitelist fix

This commit is contained in:
Rushabh Mehta 2012-02-13 13:41:45 +01:00
parent 5fe5df370f
commit a9bd79487d
2 changed files with 6 additions and 5 deletions

View File

@ -2,7 +2,7 @@ import webnotes
from webnotes.utils import cint from webnotes.utils import cint
@webnotes.whitelist() @webnotes.whitelist()
def get_online_users(): def get_online_users(arg=None):
# get users # get users
return webnotes.conn.sql("""SELECT DISTINCT t1.user, t2.first_name, t2.last_name return webnotes.conn.sql("""SELECT DISTINCT t1.user, t2.first_name, t2.last_name
from tabSessions t1, tabProfile t2 from tabSessions t1, tabProfile t2
@ -10,8 +10,7 @@ def get_online_users():
and t1.user not in ('Guest','Administrator') and t1.user not in ('Guest','Administrator')
and TIMESTAMPDIFF(HOUR,t1.lastupdate,NOW()) <= 1""", as_list=1) or [] and TIMESTAMPDIFF(HOUR,t1.lastupdate,NOW()) <= 1""", as_list=1) or []
@webnotes.whitelist() def get_unread_messages(arg=None):
def get_unread_messages():
"returns unread (docstatus-0 messages for a user)" "returns unread (docstatus-0 messages for a user)"
return cint(webnotes.conn.sql("""SELECT COUNT(*) FROM `tabComment Widget Record` return cint(webnotes.conn.sql("""SELECT COUNT(*) FROM `tabComment Widget Record`
WHERE comment_doctype='My Company' WHERE comment_doctype='My Company'
@ -41,8 +40,7 @@ def get_status_details(arg=None):
} }
return ret return ret
@webnotes.whitelist() def get_setup_status(arg=None):
def get_setup_status():
""" """
Returns the setup status of the current account Returns the setup status of the current account
""" """

View File

@ -104,6 +104,7 @@ def send_welcome_mail(email, args):
# #
# post comment # post comment
# #
@webnotes.whitelist()
def post_comment(arg): def post_comment(arg):
arg = load_json(arg) arg = load_json(arg)
@ -146,6 +147,7 @@ def post_comment(arg):
# #
# update read messages # update read messages
# #
@webnotes.whitelist()
def set_read_all_messages(arg=''): def set_read_all_messages(arg=''):
webnotes.conn.sql("""UPDATE `tabComment Widget Record` webnotes.conn.sql("""UPDATE `tabComment Widget Record`
SET docstatus = 1 SET docstatus = 1
@ -153,6 +155,7 @@ def set_read_all_messages(arg=''):
AND comment_docname = %s AND comment_docname = %s
""", webnotes.user.name) """, webnotes.user.name)
@webnotes.whitelist()
def update_security(args=''): def update_security(args=''):
import json import json
args = json.loads(args) args = json.loads(args)