Exemplo n.º 1
0
def get_groups_owned_by(uwnetid):
    settings_path = os.path.join(os.path.abspath(os.path.dirname(__file__)),
                                 'settings.cfg')
    use_configparser_backend(settings_path, 'GWS')

    from uw_gws import GWS

    client = GWS()
    for group in client.search_groups(owner=uwnetid):
        print(group)
Exemplo n.º 2
0
    def test_group_search(self):
        gws = GWS()
        groups = gws.search_groups(member="javerage")
        self.assertEquals(len(groups), 15)

        groups = gws.search_groups(member="JAVERAGE")
        self.assertEquals(len(groups), 15)

        groups = gws.search_groups(member="javerage", type="effective")
        self.assertEquals(len(groups), 7)

        groups = gws.search_groups(stem='cal_sea')
        self.assertEquals(len(groups), 5)
        self.assertEqual(groups[0].json_data(),
                         {'displayName': 'cal_sea parent group',
                          'id': 'cal_sea',
                          'regid': 'baf5f1c40d6c4fbc80df6c8f2deeed5d',
                          'url': None})
        self.assertIsNotNone(str(groups[0]))
Exemplo n.º 3
0
def search_groups(act_as, **kwargs):
    if not kwargs.get('scope'):
        kwargs['scope'] = 'all'

    if kwargs.get('name') and not kwargs['name'].endswith('*'):
        kwargs['name'] += '*'

    groups = []
    gws = GWS(config={'actas': act_as})
    for group in gws.search_groups(**kwargs):
        try:
            valid_group_id(group.name)
            groups.append({'name': group.name, 'title': group.display_name})
        except GroupPolicyException:
            pass

    return groups