|
a/Allura/allura/model/auth.py |
|
b/Allura/allura/model/auth.py |
|
... |
|
... |
22 |
from ming.orm.declarative import MappedClass
|
22 |
from ming.orm.declarative import MappedClass
|
23 |
|
23 |
|
24 |
import allura.tasks.mail_tasks
|
24 |
import allura.tasks.mail_tasks
|
25 |
from allura.lib import helpers as h
|
25 |
from allura.lib import helpers as h
|
26 |
from allura.lib import plugin
|
26 |
from allura.lib import plugin
|
|
|
27 |
from allura.lib.decorators import memoize
|
27 |
|
28 |
|
28 |
from .session import main_orm_session, main_doc_session
|
29 |
from .session import main_orm_session, main_doc_session
|
29 |
from .session import project_orm_session
|
30 |
from .session import project_orm_session
|
30 |
from .timeline import ActivityNode, ActivityObject
|
31 |
from .timeline import ActivityNode, ActivityObject
|
31 |
|
32 |
|
|
... |
|
... |
270 |
g = cls.query.find_and_modify(
|
271 |
g = cls.query.find_and_modify(
|
271 |
query={}, update={'$inc':{'next_uid': 1}},
|
272 |
query={}, update={'$inc':{'next_uid': 1}},
|
272 |
new=True)
|
273 |
new=True)
|
273 |
return g.next_uid
|
274 |
return g.next_uid
|
274 |
|
275 |
|
|
|
276 |
|
275 |
class User(MappedClass, ActivityNode, ActivityObject):
|
277 |
class User(MappedClass, ActivityNode, ActivityObject):
|
276 |
SALT_LEN=8
|
278 |
SALT_LEN=8
|
277 |
class __mongometa__:
|
279 |
class __mongometa__:
|
278 |
name='user'
|
280 |
name='user'
|
279 |
session = main_orm_session
|
281 |
session = main_orm_session
|
|
... |
|
... |
307 |
return plugin.UserPreferencesProvider.get().set_pref(self, pref_name, pref_value)
|
309 |
return plugin.UserPreferencesProvider.get().set_pref(self, pref_name, pref_value)
|
308 |
|
310 |
|
309 |
def url(self):
|
311 |
def url(self):
|
310 |
return plugin.AuthenticationProvider.get(request).project_url(self)
|
312 |
return plugin.AuthenticationProvider.get(request).project_url(self)
|
311 |
|
313 |
|
|
|
314 |
@memoize
|
312 |
def icon_url(self):
|
315 |
def icon_url(self):
|
313 |
icon_url = None
|
316 |
icon_url = None
|
|
|
317 |
private_project = self.private_project()
|
314 |
if self.private_project() and self.private_project().icon:
|
318 |
if private_project and private_project.icon:
|
315 |
icon_url = self.url()+'user_icon'
|
319 |
icon_url = self.url()+'user_icon'
|
316 |
elif self.preferences.email_address:
|
320 |
elif self.preferences.email_address:
|
317 |
icon_url = g.gravatar(self.preferences.email_address)
|
321 |
icon_url = g.gravatar(self.preferences.email_address)
|
318 |
return icon_url
|
322 |
return icon_url
|
319 |
|
323 |
|