Пример #1
0
def get_groups_collection(request):

    def user_group(group):
        return group.type == 'U' and not group.name.startswith('a_')

    def get_fields():
        return group_fields(request)

    db = request.site.db
    users = Groups(db)
    labels = 'Name', 'Description', 'Administrators'
    columns = 'link', 'description', 'administrators'
    return model.GroupsCollection(
        get_fields,
        model=Group,
        controller=GroupCollectionController,
        view=GroupCollectionView,
        store=users,
        item_name='group',
        url='/admin/groups',
        filter=user_group,
        columns=columns,
        labels=labels,
        key_name='id',
        search_engine=RawSearch
    )
Пример #2
0
 def setUp(self):
     self.db = setup_test()
     self.users = Users(self.db)
     self.groups = Groups(self.db)
     zoom.system.request = zoom.utils.Bunch(
         app=zoom.utils.Bunch(name=__name__, ),
         session=zoom.utils.Bunch(),
     )
     zoom.system.site = zoom.utils.Bunch(
         url='nosite',
         db=self.db,
         groups=self.groups,
     )
     zoom.system.user = self.users.first(username='******')
Пример #3
0
def main(route, request):

    def user_group(group):
        return group.type == 'U' and not group.name.startswith('a_')

    db = request.site.db
    users = Groups(db)
    fields = group_fields(request)
    columns = 'link', 'description', 'administrators'
    return Collection(
        fields,
        model=Group,
        controller=GroupCollectionController,
        store=users,
        item_name='group',
        url='/admin/groups',
        filter=user_group,
        columns=columns,
    )(route, request)
Пример #4
0
 def __init__(self, db):
     self.db = db
     self.logger = logging.getLogger(__name__)
     self.groups = Groups(db)
Пример #5
0
def get_user_group_options(site):
    groups = Groups(site.db)
    user_groups = list(
        sorted(
            (group.link, group.key) for group in groups.find(**{'type': 'U'})))
    return user_groups
Пример #6
0
 def setUp(self):
     self.db = setup_test()
     self.groups = Groups(self.db)
Пример #7
0
 def setUp(self):
     self.db = setup_test()
     self.groups = Groups(self.db)
     zoom.system.site = zoom.sites.Site()
     zoom.system.user = zoom.system.site.users.get(1)
     zoom.system.request = Bunch(app=Bunch(name=__name__))