|
a/Allura/allura/model/auth.py |
|
b/Allura/allura/model/auth.py |
|
... |
|
... |
21 |
from ming import Field, collection
|
21 |
from ming import Field, collection
|
22 |
from ming.orm import session, state
|
22 |
from ming.orm import session, state
|
23 |
from ming.orm import FieldProperty, RelationProperty, ForeignIdProperty
|
23 |
from ming.orm import FieldProperty, RelationProperty, ForeignIdProperty
|
24 |
from ming.orm.declarative import MappedClass
|
24 |
from ming.orm.declarative import MappedClass
|
25 |
from ming.orm.ormsession import ThreadLocalORMSession
|
25 |
from ming.orm.ormsession import ThreadLocalORMSession
|
|
|
26 |
from ming.utils import LazyProperty
|
26 |
|
27 |
|
27 |
import allura.tasks.mail_tasks
|
28 |
import allura.tasks.mail_tasks
|
28 |
from allura.lib import helpers as h
|
29 |
from allura.lib import helpers as h
|
29 |
from allura.lib import plugin
|
30 |
from allura.lib import plugin
|
30 |
from allura.lib.decorators import memoize
|
31 |
from allura.lib.decorators import memoize
|
|
... |
|
... |
581 |
n = M.Neighborhood.query.get(name='Users')
|
582 |
n = M.Neighborhood.query.get(name='Users')
|
582 |
n.register_project(auth_provider.user_project_shortname(user),
|
583 |
n.register_project(auth_provider.user_project_shortname(user),
|
583 |
user=user, user_project=True)
|
584 |
user=user, user_project=True)
|
584 |
return user
|
585 |
return user
|
585 |
|
586 |
|
|
|
587 |
@LazyProperty
|
|
|
588 |
def neighborhood(self):
|
|
|
589 |
from allura import model as M
|
|
|
590 |
return M.Neighborhood.query.get(name='Users')
|
|
|
591 |
|
586 |
def private_project(self):
|
592 |
def private_project(self):
|
587 |
'''
|
593 |
'''
|
588 |
Returns the personal user-project for the user
|
594 |
Returns the personal user-project for the user
|
589 |
'''
|
595 |
'''
|
590 |
if self.disabled:
|
596 |
if self.disabled:
|
591 |
return None
|
597 |
return None
|
592 |
|
598 |
|
593 |
from allura import model as M
|
599 |
from allura import model as M
|
594 |
n = M.Neighborhood.query.get(name='Users')
|
600 |
n = self.neighborhood
|
595 |
auth_provider = plugin.AuthenticationProvider.get(request)
|
601 |
auth_provider = plugin.AuthenticationProvider.get(request)
|
596 |
project_shortname = auth_provider.user_project_shortname(self)
|
602 |
project_shortname = auth_provider.user_project_shortname(self)
|
597 |
p = M.Project.query.get(shortname=project_shortname, neighborhood_id=n._id)
|
603 |
p = M.Project.query.get(shortname=project_shortname, neighborhood_id=n._id)
|
598 |
if p and p.deleted:
|
604 |
if p and p.deleted:
|
599 |
# really delete it, since registering a new project would conflict with the "deleted" one
|
605 |
# really delete it, since registering a new project would conflict with the "deleted" one
|