Switch to unified view

a/Allura/allura/model/project.py b/Allura/allura/model/project.py
...
...
17
from allura.lib import helpers as h
17
from allura.lib import helpers as h
18
from allura.lib import plugin
18
from allura.lib import plugin
19
from allura.lib import exceptions
19
from allura.lib import exceptions
20
from allura.lib import security
20
from allura.lib import security
21
from allura.lib.security import has_access
21
from allura.lib.security import has_access
22
23
try:
24
    from forgewiki import ForgeWikiApp
25
except ImportError:
26
    ForgeWikiApp = None
22
27
23
from .session import main_orm_session
28
from .session import main_orm_session
24
from .session import project_doc_session, project_orm_session
29
from .session import project_doc_session, project_orm_session
25
from .neighborhood import Neighborhood
30
from .neighborhood import Neighborhood
26
from .auth import ProjectRole
31
from .auth import ProjectRole
...
...
511
        is_private_project=False):
516
        is_private_project=False):
512
        from allura import model as M
517
        from allura import model as M
513
        if users is None: users = [ c.user ]
518
        if users is None: users = [ c.user ]
514
        if apps is None:
519
        if apps is None:
515
            if is_user_project:
520
            if is_user_project:
516
                apps = [('profile', 'profile'),
521
                apps = [('profile', 'profile', 'Profile'),
517
                        ('admin', 'admin'),
522
                        ('admin', 'admin', 'Admin'),
518
                        ('search', 'search')]
523
                        ('search', 'search', 'Search')]
519
            else:
524
            else:
520
                apps = [('home', 'home'),
525
                apps = [('Wiki', 'home', 'Home'),
521
                        ('admin', 'admin'),
526
                        ('admin', 'admin', 'Admin'),
522
                        ('search', 'search')]
527
                        ('search', 'search', 'Search')]
523
        with h.push_config(c, project=self, user=users[0]):
528
        with h.push_config(c, project=self, user=users[0]):
524
            # Install default named roles (#78)
529
            # Install default named roles (#78)
525
            root_project_id=self.root_project._id
530
            root_project_id=self.root_project._id
526
            role_admin = M.ProjectRole.upsert(name='Admin', project_id=root_project_id)
531
            role_admin = M.ProjectRole.upsert(name='Admin', project_id=root_project_id)
527
            role_developer = M.ProjectRole.upsert(name='Developer', project_id=root_project_id)
532
            role_developer = M.ProjectRole.upsert(name='Developer', project_id=root_project_id)
...
...
541
                for perm in self.permissions ]
546
                for perm in self.permissions ]
542
            for user in users:
547
            for user in users:
543
                pr = user.project_role()
548
                pr = user.project_role()
544
                pr.roles = [ role_admin._id, role_developer._id, role_member._id ]
549
                pr.roles = [ role_admin._id, role_developer._id, role_member._id ]
545
            # Setup apps
550
            # Setup apps
546
            for ep_name, mount_point in apps:
551
            for ep_name, mount_point, label in apps:
547
                self.install_app(ep_name, mount_point)
552
                self.install_app(ep_name, mount_point, label)
553
            if ForgeWikiApp is not None:
554
                home_app = self.app_instance('home')
555
                if isinstance(home_app, ForgeWikiApp):
556
                    home_app.show_discussion = False
557
                    home_app.show_left_bar = False
548
            self.database_configured = True
558
            self.database_configured = True
549
            ThreadLocalORMSession.flush_all()
559
            ThreadLocalORMSession.flush_all()
550
560
551
    def add_user(self, user, role_names):
561
    def add_user(self, user, role_names):
552
        'Convenience method to add member with the given role(s).'
562
        'Convenience method to add member with the given role(s).'