Switch to unified view

a/Allura/allura/model/project.py b/Allura/allura/model/project.py
...
...
247
    @property
247
    @property
248
    def parent_project(self):
248
    def parent_project(self):
249
        if self.is_root: return None
249
        if self.is_root: return None
250
        return self.query.get(_id=self.parent_id)
250
        return self.query.get(_id=self.parent_id)
251
251
252
    @property
253
    def private(self):
254
        """Return True if this project is private, else False."""
255
        role_anon = ProjectRole.anonymous(project=self)
256
        return ACE.allow(role_anon._id, 'read') not in self.acl
257
258
    @private.setter
259
    def private(self, val):
260
        """Set whether this project is private or not."""
261
        new_val = bool(val)
262
        role_anon = ProjectRole.anonymous(project=self)
263
        ace = ACE.allow(role_anon._id, 'read')
264
        curr_val = ace not in self.acl
265
        if new_val == curr_val: return
266
        if new_val:
267
            self.acl.remove(ace)
268
        else:
269
            self.acl.append(ace)
270
252
    def private_project_of(self):
271
    def private_project_of(self):
253
        '''
272
        '''
254
        If this is a user-project, return the User, else None
273
        If this is a user-project, return the User, else None
255
        '''
274
        '''
256
        user = None
275
        user = None
...
...
576
            role_admin.roles = [ role_developer._id ]
595
            role_admin.roles = [ role_developer._id ]
577
            role_developer.roles = [ role_member._id ]
596
            role_developer.roles = [ role_member._id ]
578
            self.acl = [
597
            self.acl = [
579
                ACE.allow(role_developer._id, 'read'),
598
                ACE.allow(role_developer._id, 'read'),
580
                ACE.allow(role_member._id, 'read') ]
599
                ACE.allow(role_member._id, 'read') ]
581
            if not is_private_project:
582
                self.acl.append(ACE.allow(role_anon._id, 'read'))
583
            self.acl += [
600
            self.acl += [
584
                M.ACE.allow(role_admin._id, perm)
601
                M.ACE.allow(role_admin._id, perm)
585
                for perm in self.permissions ]
602
                for perm in self.permissions ]
603
            self.private = is_private_project
586
            for user in users:
604
            for user in users:
587
                pr = user.project_role()
605
                pr = user.project_role()
588
                pr.roles = [ role_admin._id ]
606
                pr.roles = [ role_admin._id ]
589
            session(self).flush(self)
607
            session(self).flush(self)
590
            # Setup apps
608
            # Setup apps