本文整理汇总了Python中nagare.security.get_user函数的典型用法代码示例。如果您正苦于以下问题:Python get_user函数的具体用法?Python get_user怎么用?Python get_user使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了get_user函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: create_card
def create_card(self, text=''):
"""Create a new card
In:
- ``text`` -- the title of the new card
"""
if text:
if self.can_add_cards:
new_card = DataCard.create_card(self.data, text, security.get_user().data)
self.cards.append(component.Component(self._services(
card.Card, new_card.id, self
),
'new'))
values = {'column_id': self.id,
'column': self.title().text,
'card': new_card.title}
notifications.add_history(self.board.data, new_card,
security.get_user().data,
u'card_create', values)
scard = fts_schema.Card.from_model(new_card)
self.search_engine.add_document(scard)
self.search_engine.commit()
self.set_reload_search()
else:
raise exceptions.KanshaException(_('Limit of cards reached fo this list'))
开发者ID:Reigel,项目名称:kansha,代码行数:25,代码来源:comp.py
示例2: add
def add(self, v):
"""Add a new comment to the card
In:
- ``v`` -- the comment content
"""
security.check_permissions("comment", self.parent)
if v is None:
return
v = v.strip()
if v:
v = validator.clean_text(v)
user = security.get_user()
comment = DataComment(
comment=v.strip(),
card_id=self.parent.data.id,
author=user.data,
creation_date=datetime.datetime.utcnow(),
)
session.add(comment)
session.flush()
data = {"comment": v.strip(), "card": self.parent.title().text}
notifications.add_history(
self.parent.column.board.data, self.parent.data, security.get_user().data, u"card_add_comment", data
)
self.comments.insert(0, self._create_comment_component(comment))
开发者ID:Reigel,项目名称:kansha,代码行数:26,代码来源:comp.py
示例3: go
def go(self, comp):
user = security.get_user()
while user is None:
# not logged ? Call login component
comp.call(
self._services(
login.Login,
self.app_title,
self.app_banner,
self.custom_css,
self.cfg,
)
)
user = security.get_user()
if user.last_login is None:
# first connection.
# Load template boards if any,
self.app.boards_manager.create_boards_from_templates(user.data, self.cfg['tpl_cfg'])
# then index cards
self.app.boards_manager.index_user_cards(user.data,
self.search_engine)
user.update_last_login()
comp.call(self.app.initialization())
# Logout
if user is not None:
security.get_manager().logout()
开发者ID:gpaugam,项目名称:kansha,代码行数:27,代码来源:comp.py
示例4: invite_members
def invite_members(self, emails):
"""Invite somebody to this board,
Create token used in invitation email.
Store email in pending list.
In:
- ``emails`` -- list of emails
Return:
- javascript to reload members and hide overlay
"""
for email in set(emails):
# If user already exists add it to the board directly or invite it otherwise
invitation = forms.EmailInvitation(
self.app_title,
self.app_banner,
self.custom_css,
email,
security.get_user().data,
self.data,
self.mail_sender.application_url,
)
invitation.send_email(self.mail_sender)
return "YAHOO.kansha.reload_boarditems[%s]();" "YAHOO.kansha.app.hideOverlay();" % ajax.py2js(self.id)
开发者ID:droodle,项目名称:kansha,代码行数:25,代码来源:comp.py
示例5: _add_asset
def _add_asset(self, file_info):
user = security.get_user()
fileid = self.assets_manager.save(file_info['data'],
metadata={'filename': file_info['filename'], 'content-type': file_info['content_type']})
data = {'file': file_info['filename'], 'card': self.card.get_title()}
self.action_log.add_history(user, u'card_add_file', data)
return self.create_asset(DataAsset.add(fileid, self.card.data, user.data))
开发者ID:Net-ng,项目名称:kansha,代码行数:7,代码来源:comp.py
示例6: render_administration
def render_administration(self, h, comp, *args):
with h.div(class_='admin-page'):
if self.content() and security.get_user():
h << self.content
else:
h << comp.render(h, model='menu')
return h.root
开发者ID:droodle,项目名称:eureka-opensource,代码行数:7,代码来源:administration.py
示例7: new_title
def new_title(self, title):
cl = self.data
data = {'list': title, 'card': cl.card.title}
self.action_log.add_history(
security.get_user(),
u'card_add_list',
data)
开发者ID:nagareproject,项目名称:kansha,代码行数:7,代码来源:comp.py
示例8: render
def render(self, h, *args):
user = security.get_user() # Get the user object
if not user: # The anonymous user is ``None``
return h.i('not logged')
return ('Welcome ', h.b(user.id))
开发者ID:nagareproject,项目名称:examples,代码行数:7,代码来源:wiki10.py
示例9: initialization
def initialization(self):
""" Initialize Kansha application
Initialize user_menu with current user,
Initialize last board
Return:
- app initialized
"""
user = security.get_user()
self.home_menu['boards'] = MenuEntry(
_L(u'Boards'),
'board',
self.boards_manager
)
self.home_menu['profile'] = MenuEntry(
_L(u'Profile'),
'user',
self._services(
get_userform(
self.app_title, self.app_banner, self.theme, user.data.source
),
user.data,
)
)
self.user_menu = component.Component(user)
if user and self.content() is None:
self.select_last_board()
return self
开发者ID:nagareproject,项目名称:kansha,代码行数:29,代码来源:comp.py
示例10: select_board
def select_board(self, id_):
"""Selected a board by id
In:
- ``id_`` -- the id of the board
"""
if not id_:
return
if self.boards_manager.get_by_id(id_):
self.content.becomes(
self._services(
board.Board,
id_,
self.app_title,
self.app_banner,
self.custom_css,
self.search_engine,
on_board_archive=self.select_last_board,
on_board_leave=self.select_last_board
)
)
# if user is logged, update is last board
user = security.get_user()
if user:
user.set_last_board(self.content())
else:
raise exceptions.BoardNotFound()
开发者ID:gpaugam,项目名称:kansha,代码行数:27,代码来源:comp.py
示例11: commit
def commit(self, application_url):
""" Commit method
If email changes, send confirmation mail to user
If password changes, check passwords rules
"""
if not self.is_validated(self.fields):
return
# Test if email_to_confirm has changed
if (self.target.email_to_confirm != self.email_to_confirm() and
self.target.email != self.email_to_confirm()):
# Change target email_to_confirm (need it to send mail)
self.target.email_to_confirm = self.email_to_confirm()
confirmation = self._create_email_confirmation(application_url)
confirmation.send_email(self.mail_sender)
self.email_to_confirm.info = _(
'A confirmation email has been sent.')
# Test if password has changed
if (len(self.password()) > 0 and
not(self.old_password.error) and
not(self.password_repeat.error)):
user = security.get_user()
user.data.change_password(self.password())
user.update_password(self.password())
self.password_repeat.info = _('The password has been changed')
super(BasicUserForm, self).commit(self.fields)
开发者ID:daamien,项目名称:kansha,代码行数:26,代码来源:user_profile.py
示例12: render_Board_columns
def render_Board_columns(self, h, comp, *args):
h.head.css_url('js/fullcalendar-2.2.6/fullcalendar.min.css')
h.head.javascript_url('js/moment.js')
h.head.javascript_url('js/fullcalendar-2.2.6/fullcalendar.min.js')
lang = security.get_user().get_locale().language
if lang != 'en':
h.head.javascript_url('js/fullcalendar-2.2.6/lang/%s.js' % lang)
with h.div(id='viewport-wrapper'):
with h.div(class_='clearfix', id='viewport'):
h << h.div(id='calendar')
display_week_numbers = security.get_user().display_week_numbers
h << h.script("""YAHOO.kansha.app.create_board_calendar($('#calendar'), %s)""" % ajax.py2js(display_week_numbers))
for column in self.columns:
h << column.render(h, 'calendar')
return h.root
开发者ID:daamien,项目名称:kansha,代码行数:16,代码来源:view.py
示例13: load_user_boards
def load_user_boards(self, user=None):
if user is None:
user = security.get_user()
self.my_boards.clear()
self.guest_boards.clear()
self.archived_boards.clear()
last_modifications = {}
for board_id, in Board.get_all_board_ids(): # Comma is important
board_obj = self._services(Board, board_id, self.app_title, self.app_banner, self.theme,
self.card_extensions, self.search_engine,
load_children=False)
if security.has_permissions('manage', board_obj) or security.has_permissions('edit', board_obj):
board_comp = component.Component(board_obj)
if board_obj.archived:
self.archived_boards[board_id] = board_comp
else:
last_activity = board_obj.get_last_activity()
if last_activity is not None:
last_modifications[board_id] = (last_activity, board_comp)
if security.has_permissions('manage', board_obj):
self.my_boards[board_id] = board_comp
elif security.has_permissions('edit', board_obj):
self.guest_boards[board_id] = board_comp
last_5 = sorted(last_modifications.values(), reverse=True)[:5]
self.last_modified_boards = OrderedDict((comp().id, comp) for _modified, comp in last_5)
public, private = Board.get_templates_for(user.username, user.source)
self.templates = {'public': [(b.id, b.template_title) for b in public],
'private': [(b.id, b.template_title) for b in private]}
开发者ID:daamien,项目名称:kansha,代码行数:29,代码来源:boardsmanager.py
示例14: test_comment_label
def test_comment_label(self):
self.extension.add(u'test')
label = self.extension.comments[0]().comment_label()
self.assertEqual(label.text, u'test')
label.change_text(u'test2')
self.assertEqual(label.text, u'test2')
self.assertTrue(label.is_author(security.get_user()))
开发者ID:Net-ng,项目名称:kansha,代码行数:7,代码来源:tests.py
示例15: __init__
def __init__(self, app_title, custom_css, boards, mail_sender, assets_manager):
""" UserBoards
List of user's boards, and form to add new one board
In:
- ``boards`` -- list of user boards (BoardData instances)
"""
self.app_title = app_title
self.boards = []
self.archived_boards = []
for b in boards:
_b = board.Board(b.id, app_title, custom_css, mail_sender, assets_manager, None,
on_board_delete=lambda id_=b.id: self.delete_board(
id_),
on_board_archive=lambda id_=b.id: self.archive_board(
id_),
on_board_restore=lambda id_=b.id: self.restore_board(
id_),
on_board_leave=lambda id_=b.id: self.leave_board(
id_),
load_data=False)
if not b.archived:
self.boards.append(component.Component(_b))
elif b.has_manager(security.get_user()):
self.archived_boards.append(component.Component(_b))
self.new_board = component.Component(board.NewBoard())
开发者ID:ygravrand,项目名称:kansha,代码行数:29,代码来源:user_profile.py
示例16: update_card_position
def update_card_position(self, data):
security.check_permissions('edit', self)
data = json.loads(data)
cols = {}
for col in self.columns:
cols[col().id] = col()
orig = cols[data['orig']]
if data['orig'] != data['dest']: # Move from one column to another
dest = cols[data['dest']]
card = orig.remove_card(data['card'])
dest.insert_card(card, data['index'])
values = {'from': orig.title().text,
'to': dest.title().text,
'card': card().data.title}
notifications.add_history(self.data, card().data,
security.get_user().data,
u'card_move', values)
# reindex it in case it has been moved to the archive column
scard = fts_schema.Card.from_model(card().data)
self.search_engine.update_document(scard)
self.search_engine.commit()
else: # Reorder only
orig.move_card(data['card'], data['index'])
session.flush()
开发者ID:gpaugam,项目名称:kansha,代码行数:27,代码来源:comp.py
示例17: initialization
def initialization(self):
""" Initialize Kansha application
Initialize user_menu with current user,
Initialize last board
Return:
- app initialized
"""
self.user_menu = component.Component(security.get_user())
if security.get_user():
if self.default_board_id:
self.select_board(self.default_board_id)
else:
self.select_last_board()
return self
开发者ID:gpaugam,项目名称:kansha,代码行数:16,代码来源:comp.py
示例18: render
def render(self, h, *args):
user = security.get_user()
if not user:
return h.i('not logged')
return ('Welcome ', h.b(user.id))
开发者ID:nagareproject,项目名称:examples,代码行数:7,代码来源:wiki11.py
示例19: render
def render(self, h, comp, *args):
user = security.get_user()
if user is None:
h << h.a(self.app_title, class_="collapse", id="mainTab")
else:
app_user = get_app_user(user.username)
h << h.a(component.Component(app_user, "avatar"), self.app_title, id="mainTab")
return h.root
开发者ID:ygravrand,项目名称:kansha,代码行数:8,代码来源:view.py
示例20: commit
def commit(self):
success = False
if self.weight.error is None:
values = {'from': self.data.weight, 'to': self.weight.value, 'card': self.card.get_title()}
self.data.weight = self.weight.value
self.action_log.add_history(security.get_user(), u'card_weight', values)
success = True
return success
开发者ID:bcroq,项目名称:kansha,代码行数:8,代码来源:comp.py
注:本文中的nagare.security.get_user函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论