|
a/Allura/allura/model/auth.py |
|
b/Allura/allura/model/auth.py |
|
... |
|
... |
474 |
if include_past_periods or newdict['end_date'] > datetime.today():
|
474 |
if include_past_periods or newdict['end_date'] > datetime.today():
|
475 |
retval.append(newdict)
|
475 |
retval.append(newdict)
|
476 |
return retval
|
476 |
return retval
|
477 |
|
477 |
|
478 |
def url(self):
|
478 |
def url(self):
|
479 |
return plugin.AuthenticationProvider.get(request).project_url(self)
|
479 |
return '/%s/' % plugin.AuthenticationProvider.get(request).user_project_shortname(self)
|
480 |
|
480 |
|
481 |
@memoize
|
481 |
@memoize
|
482 |
def icon_url(self):
|
482 |
def icon_url(self):
|
483 |
icon_url = None
|
483 |
icon_url = None
|
484 |
private_project = self.private_project()
|
484 |
private_project = self.private_project()
|
|
... |
|
... |
566 |
addr.confirmed = True
|
566 |
addr.confirmed = True
|
567 |
|
567 |
|
568 |
@classmethod
|
568 |
@classmethod
|
569 |
def register(cls, doc, make_project=True):
|
569 |
def register(cls, doc, make_project=True):
|
570 |
from allura import model as M
|
570 |
from allura import model as M
|
571 |
from forgewiki import model as WM
|
|
|
572 |
user = plugin.AuthenticationProvider.get(request).register_user(doc)
|
571 |
auth_provider = plugin.AuthenticationProvider.get(request)
|
|
|
572 |
user = auth_provider.register_user(doc)
|
573 |
if user and 'display_name' in doc:
|
573 |
if user and 'display_name' in doc:
|
574 |
user.set_pref('display_name', doc['display_name'])
|
574 |
user.set_pref('display_name', doc['display_name'])
|
575 |
if user and make_project:
|
575 |
if user and make_project:
|
576 |
n = M.Neighborhood.query.get(name='Users')
|
576 |
n = M.Neighborhood.query.get(name='Users')
|
577 |
p = n.register_project('u/' + user.username, user=user, user_project=True)
|
577 |
n.register_project(auth_provider.user_project_shortname(user),
|
|
|
578 |
user=user, user_project=True)
|
578 |
return user
|
579 |
return user
|
579 |
|
580 |
|
580 |
def private_project(self):
|
581 |
def private_project(self):
|
581 |
'''
|
582 |
'''
|
582 |
Returns the personal user-project for the user
|
583 |
Returns the personal user-project for the user
|
583 |
'''
|
584 |
'''
|
584 |
from .project import Project
|
585 |
from .project import Project
|
|
|
586 |
auth_provider = plugin.AuthenticationProvider.get(request)
|
|
|
587 |
project_shortname = auth_provider.user_project_shortname(self)
|
585 |
p = Project.query.get(shortname='u/%s' % self.username, deleted=False)
|
588 |
p = Project.query.get(shortname=project_shortname, deleted=False)
|
586 |
if not p and self != User.anonymous():
|
589 |
if not p and self != User.anonymous():
|
587 |
# create user-project on demand if it is missing
|
590 |
# create user-project on demand if it is missing
|
588 |
from allura import model as M
|
591 |
from allura import model as M
|
589 |
n = M.Neighborhood.query.get(name='Users')
|
592 |
n = M.Neighborhood.query.get(name='Users')
|
590 |
p = n.register_project('u/' + self.username, user=self, user_project=True)
|
593 |
p = n.register_project(project_shortname, user=self, user_project=True)
|
591 |
return p
|
594 |
return p
|
592 |
|
595 |
|
593 |
@property
|
596 |
@property
|
594 |
def script_name(self):
|
597 |
def script_name(self):
|
595 |
return '/u/' + self.username + '/'
|
598 |
return '/u/' + self.username + '/'
|