Example #1
0
    def __init__(self):
        self.template = Template()
        self.template.add_version("2010-09-09")
        self.template.add_description(
            "Create IAM users, groups and policies for environments")

        parameters = Parameters()
        for param in parameters.values():
            self.template.add_parameter(param)

        groups = Groups(parameters=parameters)
        for res in groups.values():
            self.template.add_resource(res)

        roles = RolesAndPolicies(parameters=parameters, groups=groups)
        for res in roles.values():
            self.template.add_resource(res)

        users = Users(parameters=parameters, groups=groups, roles=roles)
        for res in users.values():
            self.template.add_resource(res)

        outputs = Outputs(groups=groups, roles=roles, users=users)
        for res in outputs.values():
            self.template.add_output(res)
Example #2
0
 def __init__(self, access_token=''):
     self.Account = Account(access_token=access_token)
     self.Apps = Apps(access_token=access_token)
     self.Audio = Audio(access_token=access_token)
     self.Auth = Auth(access_token=access_token)
     self.Board = Board(access_token=access_token)
     self.Database = Database(access_token=access_token)
     self.Docs = Docs(access_token=access_token)
     self.Other = Other(access_token=access_token)
     self.Fave = Fave(access_token=access_token)
     self.Friends = Friends(access_token=access_token)
     self.Gifts = Gifts(access_token=access_token)
     self.Groups = Groups(access_token=access_token)
     self.Likes = Likes(access_token=access_token)
     self.Market = Market(access_token=access_token)
     self.Messages = Messages(access_token=access_token)
     self.Newsfeed = Newsfeed(access_token=access_token)
     self.Notes = Notes(access_token=access_token)
     self.Notifications = Notifications(access_token=access_token)
     self.Pages = Pages(access_token=access_token)
     self.Photos = Photos(access_token=access_token)
     self.Places = Places(access_token=access_token)
     self.Polls = Polls(access_token=access_token)
     self.Search = Search(access_token=access_token)
     self.Stats = Stats(access_token=access_token)
     self.Status = Status(access_token=access_token)
     self.Storage = Storage(access_token=access_token)
     self.Users = Users(access_token=access_token)
     self.Utils = Utils(access_token=access_token)
     self.Video = Video(access_token=access_token)
     self.Wall = Wall(access_token=access_token)
     self.Widgets = Widgets(access_token=access_token)
Example #3
0
    def __init__(self, platform_name, nodes):
        self.system_settings = nodes.system_settings
        self._nodes = nodes

        if platform_name in PLATFORM_NAMING_CONVENTIONS:
            name = PLATFORM_NAMING_CONVENTIONS[platform_name]
        else:
            name = str(platform_name) + ' Platform'

        super(Platform, self).__init__(name, platform_name, 'platforms')

        groups_db_file = None
        error_db_file = None
        if platform_name != 'virgins':
            db_path = os.path.join('platforms', platform_name)
            groups_db_file = os.path.join(db_path, 'groups.db')
            error_db_file = os.path.join(db_path, 'default_error.db')

        LOGGER.debug("Creating Default Groups")

        default_groups = OrderedDict()
        default_groups['inactive_group'] = Group('Inactive Group',
                                                 platform_name, self._nodes)

        self.groups = Groups(self._nodes,
                             platform_name,
                             db_file=groups_db_file,
                             defaults=default_groups)

        self.error = NodeError(system_settings=self.system_settings,
                               db_file=error_db_file)
Example #4
0
    def __init__(self, username=None, password=None):
        self.general = General(self)
        self.model = Model(self)
        self.actions = Actions(self)
        self.groups = Groups(self)
        self.customers = Customers(self)
        self.segments = Segments(self)
        self.integrations = Integrations(self)

        if username and password:
            self.general.login(username, password)
Example #5
0
 def post(self, *args):
     try:
         if len(args) > 0:
             name = args[0]
             group = Groups(name)
             for key, value in self.request.arguments.iteritems():
                 if key in ("repo_addr", "repo_user", "repo_passwd"):
                     setattr(group, key, value[0])
             group.save()
         else:
             group = Groups(self.get_argument('name'))
             group.repo_addr = self.get_argument('repo_addr')
             group.repo_user = self.get_argument('repo_user')
             group.repo_passwd = self.get_argument('repo_passwd')
             group.save()
         self.write(cyclone.escape.json_encode({'status': 'ok'}))
     except Exception, e:
         self.write(
             cyclone.escape.json_encode({
                 'status': 'fail',
                 'error': str(e)
             }))
Example #6
0
 def get(self, *args):
     if len(args) > 1:
         name = args[0]
         groups = [Groups(name)]
     else:
         groups = Groups.get_all()
     groups_json = []
     for group in groups:
         group_json = {}
         for attr in ('name', 'repo_addr', 'repo_user', 'repo_passwd'):
             group_json.update({attr: getattr(group, attr)})
         groups_json.append(group_json)
     self.write(cyclone.escape.json_encode(groups_json))
Example #7
0
def execute(cfg):
    users = Users(cfg).run()
    base.storage('users', users)

    groups = Groups(cfg).run()
    base.storage('groups', groups)

    members = GroupsMembers(cfg, users, groups).run()
    base.storage('groups-members', members)

    projects = Projects(cfg, users['target'], groups['target']).run()
    base.storage('projects', projects)

    Repositories(cfg, projects['source']).run()
Example #8
0
    def __init__(self,
                 username=None,
                 password=None,
                 timeout=TIMEOUT,
                 url=DEFAULT_URL):
        self.general = General(self)
        self.model = Model(self)
        self.actions = Actions(self)
        self.groups = Groups(self)
        self.customers = Customers(self)
        self.segments = Segments(self)
        self.integrations = Integrations(self)
        self.timeout = timeout
        self._url = url

        if username and password:
            self.general.login(username, password)
Example #9
0
def execute(cfg):
    # cachepath = os.path.join(os.path.dirname(os.path.dirname(os.path.abspath(__file__))),'cache')

    users = Users(cfg).run()
    #with open(cachepath + '/users.json','r') as f:
    #	users = json.load(f)

    groups = Groups(cfg).run()
    #with open( cachepath + '/groups.json','r') as f:
    #	groups = json.load(f)

    members = GroupsMembers(cfg, users, groups).run()

    projects = Projects(cfg, users, groups).run()
    # with open( cachepath + '/projects.json','r') as f:
    # 	projects = json.load(f)

    Repositories(cfg, projects).run()
Example #10
0
 def __init__(self):
     self._people = People()
     self._groups = Groups()
     self._members = Members(self._people, self._groups)
Example #11
0
 def get(self, request, username, password, fromDate, toDate, node):
     self.tableStart("GetGroupSummary", username, password)
     data = Groups().summary(username, node)
     return self.tableEnd(request, data)
Example #12
0
 def clickGroups(self):
     self.find_elements_by_locator(locators['groups']).click()
     return Groups(self.driver)
Example #13
0
    settings = json.load(
        open("json/settings.json", "r", encoding='utf-8', errors='ignore'))
except FileNotFoundError:
    raise FileNotFoundError('No such file as settings.json')
messages = settings['messages']
replies_commands = list(settings['messages'].keys())
images_base_dir = settings['images_base_dir']

# This will parse the AllSides JSON for now
allsides_json = json.load(open('json/allsides.json', 'r'))

# parse bias json
side_dict = json.load(open('json/bias.json', 'r', errors='ignore'))

# parse groups json
groups = Groups('json/groups.json')

# Initializes the Telegram Bot
bot = telebot.TeleBot(bot_token)

# /start and /help commands
# This is the starting message (which comes from settings.json)
# This also outputs the commands if someone types /help
# If we don't have a reply set, do nothing.


@bot.message_handler(commands=['help', 'start'])  # list of commands to handle
def send_welcome(message):
    """
        This function handles a list of commands in settings.json and returns a string.
    """
Example #14
0
 def repository(self):
     group = Groups(self.group_name)
     res = []
     for attr in ('repo_addr', 'repo_user', 'repo_passwd'):
         res.append(getattr(group, attr))
     return res
Example #15
0
def list_s():
	print(students)

#prints list with the youngest students in each group
def filtr():
	print("\nsid\tgid\tage\tname\n------------------------------------------")
	for gid in groups.get_gid_list():
		for stud in students.youngest(gid):
			print(stud)

#reading from files
try:
	with open("groups.obj","rb") as gfile:
		groups = pickle.load(gfile)
except IOError:
	groups = Groups()

try:
	with open("students.obj","rb") as sfile:
		students = pickle.load(sfile)
except IOError:
	 students = Students()


#UI realisation
commands = {11: add_g, 12: add_s, 21: remove_g, 22: remove_s, 31: list_g, 32: list_s, 4: filtr}
while True:
	try:
		comm = str(input("\n1. Add\n2. Remove\n3. List\n4. Filter\n0. Done\nEnter command: "))
		if comm == '1' or comm == '2':
			comm += str(input("\n1. Group\n2. Student\n0. Back\nEnter command: "))
Example #16
0
 def get(self, request, username, password, fromDate, toDate, node):
     self.tableStart("GetGroupDetails", username, password)
     data = Groups().details(username, node)
     return self.tableEnd(request, data)
Example #17
0
class ResourceApi:
    # course = Courses()
    groups = Groups()
    users = Users()
    courses = Courses()
Example #18
0
from bindings import Keys, Mouses
from groups import Groups
from scratchpad import Scratchpad, DropDown_Keys
from rules import Rules
from screens import Screens
from aesthetics import Layout_Aesthetics, Widget_Aesthetics, Extension_Aesthetics

##### INIT #####

if __name__ in ["config", "__main__"]:

    # Init objects
    obj_keys = Keys()
    obj_mouse_touch = Mouses()
    obj_groups = Groups()
    obj_rules = Rules()
    obj_screens = Screens()

    obj_scratchpad = Scratchpad()
    obj_dd_keys = DropDown_Keys()

    obj_widget_aesthetics = Widget_Aesthetics()
    obj_layout_aesthetics = Layout_Aesthetics()
    obj_extension_aesthetics = Extension_Aesthetics()

    # Init qtile variables
    keys = obj_keys.init_keys()
    mouse = obj_mouse_touch.init_mouse()

    floating_layout = obj_layout_aesthetics.floating_layout
Example #19
0
    def testgroups(self):
        group_page = Groups(self.driver).open()

        group_page.createGroup('Ali')

        common.check_error(self)
Example #20
0
	opts = dict(getopt.getopt(sys.argv[1:], 'hs:d:g:')[0])
except getopt.GetoptError:
	usage()

if '-h' in opts:
	usage()

try:
	srcSys = opts['-s']
	dstSys = opts['-d']
	grpNam = opts['-g']
except KeyError:
	usage()

# create a group itself	
grp = Groups()
try:
	srcGid = grp.by_name(srcSys, grpNam)['id']
except KeyError:
	usage("Group with name '%s' doesn't exist in the source system" % grpNam)
dstGid = grp.add(dstSys, grpNam)['id']

# add members to the group
add_members(grp, srcGid, dstGid)

# copy projects with their members from the source group to the destination one
prj = Projects()
for p in prj.by_namespace(srcSys, srcGid):
	add_members(prj, p['id'], prj.add(dstSys, p['name'], namespace_id = dstGid, **filter_dict(p, 
		'description',
		'issues_enabled',
Example #21
0
        def cayley_graph(self,
                         side="right",
                         simple=False,
                         elements=None,
                         generators=None,
                         connecting_set=None):
            r"""
            Return the Cayley graph for this finite semigroup.

            INPUT:

            - ``side`` -- "left", "right", or "twosided":
              the side on which the generators act (default:"right")
            - ``simple`` -- boolean (default:False):
              if True, returns a simple graph (no loops, no labels,
              no multiple edges)
            - ``generators`` -- a list, tuple, or family of elements
              of ``self`` (default: ``self.semigroup_generators()``)
            - ``connecting_set`` -- alias for ``generators``; deprecated
            - ``elements`` -- a list (or iterable) of elements of ``self``

            OUTPUT:

            - :class:`DiGraph`

            EXAMPLES:

            We start with the (right) Cayley graphs of some classical groups::

                sage: D4 = DihedralGroup(4); D4
                Dihedral group of order 8 as a permutation group
                sage: G = D4.cayley_graph()
                sage: show(G, color_by_label=True, edge_labels=True)
                sage: A5 = AlternatingGroup(5); A5
                Alternating group of order 5!/2 as a permutation group
                sage: G = A5.cayley_graph()
                sage: G.show3d(color_by_label=True, edge_size=0.01, edge_size2=0.02, vertex_size=0.03)
                sage: G.show3d(vertex_size=0.03, edge_size=0.01, edge_size2=0.02, vertex_colors={(1,1,1):G.vertices()}, bgcolor=(0,0,0), color_by_label=True, xres=700, yres=700, iterations=200) # long time (less than a minute)
                sage: G.num_edges()
                120

                sage: w = WeylGroup(['A',3])
                sage: d = w.cayley_graph(); d
                Digraph on 24 vertices
                sage: d.show3d(color_by_label=True, edge_size=0.01, vertex_size=0.03)

            Alternative generators may be specified::

                sage: G = A5.cayley_graph(generators=[A5.gens()[0]])
                sage: G.num_edges()
                60
                sage: g=PermutationGroup([(i+1,j+1) for i in range(5) for j in range(5) if j!=i])
                sage: g.cayley_graph(generators=[(1,2),(2,3)])
                Digraph on 120 vertices

            If ``elements`` is specified, then only the subgraph
            induced and those elements is returned. Here we use it to
            display the Cayley graph of the free monoid truncated on
            the elements of length at most 3::

                sage: M = Monoids().example(); M
                An example of a monoid: the free monoid generated by ('a', 'b', 'c', 'd')
                sage: elements = [ M.prod(w) for w in sum((list(Words(M.semigroup_generators(),k)) for k in range(4)),[]) ]
                sage: G = M.cayley_graph(elements = elements)
                sage: G.num_verts(), G.num_edges()
                (85, 84)
                sage: G.show3d(color_by_label=True, edge_size=0.001, vertex_size=0.01)

            We now illustrate the ``side`` and ``simple`` options on
            a semigroup::

                sage: S = FiniteSemigroups().example(alphabet=('a','b'))
                sage: g = S.cayley_graph(simple=True)
                sage: g.vertices()
                ['a', 'ab', 'b', 'ba']
                sage: g.edges()
                [('a', 'ab', None), ('b', 'ba', None)]

            ::

                sage: g = S.cayley_graph(side="left", simple=True)
                sage: g.vertices()
                ['a', 'ab', 'b', 'ba']
                sage: g.edges()
                [('a', 'ba', None), ('ab', 'ba', None), ('b', 'ab', None),
                ('ba', 'ab', None)]

            ::

                sage: g = S.cayley_graph(side="twosided", simple=True)
                sage: g.vertices()
                ['a', 'ab', 'b', 'ba']
                sage: g.edges()
                [('a', 'ab', None), ('a', 'ba', None), ('ab', 'ba', None),
                ('b', 'ab', None), ('b', 'ba', None), ('ba', 'ab', None)]

            ::

                sage: g = S.cayley_graph(side="twosided")
                sage: g.vertices()
                ['a', 'ab', 'b', 'ba']
                sage: g.edges()
                [('a', 'a', (0, 'left')), ('a', 'a', (0, 'right')), ('a', 'ab', (1, 'right')), ('a', 'ba', (1, 'left')), ('ab', 'ab', (0, 'left')), ('ab', 'ab', (0, 'right')), ('ab', 'ab', (1, 'right')), ('ab', 'ba', (1, 'left')), ('b', 'ab', (0, 'left')), ('b', 'b', (1, 'left')), ('b', 'b', (1, 'right')), ('b', 'ba', (0, 'right')), ('ba', 'ab', (0, 'left')), ('ba', 'ba', (0, 'right')), ('ba', 'ba', (1, 'left')), ('ba', 'ba', (1, 'right'))]

            ::

                sage: s1 = SymmetricGroup(1); s = s1.cayley_graph(); s.vertices()
                [()]

            TESTS::

                sage: SymmetricGroup(2).cayley_graph(side="both")
                Traceback (most recent call last):
                ...
                ValueError: option 'side' must be 'left', 'right' or 'twosided'

            .. TODO::

                - Add more options for constructing subgraphs of the
                  Cayley graph, handling the standard use cases when
                  exploring large/infinite semigroups (a predicate,
                  generators of an ideal, a maximal length in term of the
                  generators)

                - Specify good default layout/plot/latex options in the graph

                - Generalize to combinatorial modules with module generators / operators

            AUTHORS:

            - Bobby Moretti (2007-08-10)
            - Robert Miller (2008-05-01): editing
            - Nicolas M. Thiery (2008-12): extension to semigroups,
              ``side``, ``simple``, and ``elements`` options, ...
            """
            from sage.graphs.digraph import DiGraph
            from monoids import Monoids
            from groups import Groups
            if not side in ["left", "right", "twosided"]:
                raise ValueError(
                    "option 'side' must be 'left', 'right' or 'twosided'")
            if elements is None:
                assert self.is_finite(
                ), "elements should be specified for infinite semigroups"
                elements = self
            else:
                elements = set(elements)
            if simple or self in Groups():
                result = DiGraph()
            else:
                result = DiGraph(multiedges=True, loops=True)
            result.add_vertices(elements)

            if connecting_set is not None:
                generators = connecting_set
            if generators is None:
                if self in Monoids and hasattr(self, "monoid_generators"):
                    generators = self.monoid_generators()
                else:
                    generators = self.semigroup_generators()
            if isinstance(generators, (list, tuple)):
                generators = dict((self(g), self(g)) for g in generators)
            left = (side == "left" or side == "twosided")
            right = (side == "right" or side == "twosided")

            def add_edge(source, target, label, side_label):
                """
                Skips edges whose targets are not in elements
                Return an appropriate edge given the options
                """
                if (elements is not self and target not in elements):
                    return
                if simple:
                    result.add_edge([source, target])
                elif side == "twosided":
                    result.add_edge([source, target, (label, side_label)])
                else:
                    result.add_edge([source, target, label])

            for x in elements:
                for i in generators.keys():
                    if left:
                        add_edge(x, generators[i] * x, i, "left")
                    if right:
                        add_edge(x, x * generators[i], i, "right")
            return result
Example #22
0
class GitlabManager:
    #"""This is the main Class"""
    print('starting now to auth')
    auth = Auth(username=logindetails.user, token=logindetails.token)
    activeGitlab = auth.authorizeUser()

    #create a Project object called project
    project = Project(projects=activeGitlab.projects,
                      namespaces=activeGitlab.namespaces)
    projpaths = project.listProjectsPaths()
    print('These are your Projects')
    for p in projpaths:
        print(p)
        #comment

    for key in ProjectList:
        projectname = key
        #print(projectname)
        projectnamespace = ProjectList[key]
        #print(projectnamespace)
        pathname = (projectnamespace + '/' + projectname)
        pathnamelower = pathname.lower()
        #print(pathnamelower)

        #check if the projects on ProjectList exist on Gitlab - If not add them to Gitlab - If exists then write the standard pushrules
        project_in_Gitlab = project.checkifprojectexistonGitlab(pathnamelower)
        if project_in_Gitlab is None:
            print('creating a new project called ' + pathnamelower)
            newproj = project.createProject(namespace=projectnamespace,
                                            name=projectname)
            print(newproj.pushrules.get())
            print(newproj.attributes)
        else:
            project.updateProjectpushrules(project_in_Gitlab)
            print(
                'The project ' + pathnamelower +
                ' already exists - no new project created - Push rules updated'
            )

    #check if the projects on Gitlab still remain on the ProjectList - if not remove them from Gitlab
    for p in projpaths:
        print(p['name'])
        project_on_list = False
        for key in ProjectList:
            projectnameonlist = key
            #print(projectnameonlist)
            projectnamespaceonlist = ProjectList[key]
            #print(projectnamespaceonlist)
            pathname = (projectnamespaceonlist + '/' + projectnameonlist)
            pathnamelower = pathname.lower()
            #print(pathnamelower)
            #check if the project on Gitlab exists on ProjectList - If not remove from Gitlab
            if (p['name'] == pathnamelower):
                project_on_list = True
                print(
                    'setting Gitlab project on list to True-No action required'
                )
                break

        if not (project_on_list):
            print(
                'removing the following project from Gitlab no longer on list '
                + p['name'].lower())
            project.deleteProject(p['id'])

    # create a Namespaces object called namespaces
    namespaces = Namespaces(activeGitlab.namespaces)
    namespaceList = namespaces.listNamespaces()

    print('These are all the namespaces')
    for n in namespaceList:
        print(n)

    # create a Groups object called groups
    groups = Groups(activeGitlab.groups)
    groupList = groups.listGroups()

    print('These are all the groups')
    for g in groupList:
        print(g)

    print('These are all the Members in the Group TestGitLabManage')
    members = groups.listGroupMembers('TestGitLabManage')
    for m in members:
        print(m)