def _decodeGroup(self, type, wildcard): """ Processes wildcard information in one group. @param type: Type of role; either actor, action or target @type type: C{String} @param wildcard: Wildcard string as given in the XML description (most likely a star) @type wildcard: C{String} """ from errorhandling import G4dsDependencyException retList = [] if type == 'membergroup': from communitymanager import getMemberManager if wildcard == '*': # all members - easy stuff return getMemberManager().getMemberIds() elif wildcard[0] == 'C': # here we want all the members of a certain community from communitymanager import getCommunityManager return getCommunityManager().getCommunity(wildcard).getMembers() elif wildcard[0] == 'S': # all the members of a service from servicerepository import getServiceManager return getServiceManager().getService(wildcard).getMembers() elif type == 'communitygroup': from communitymanager import getCommunityManager if wildcard == '*': # that should be all communities then return getCommunityManager().getCommunityIds() elif type == 'servicegroup': from servicerepository import getServiceManager if wildcard == '*': # all the services here return getServiceManager().getServiceIds() else: raise G4dsDependencyException('Policy error - unknown group type "%s".' %(type)) return retList
def testServiceManager(): servMan = servicerepository.getServiceManager() serv = servMan.getService('S177696') #servMan.getServiceIds()[0]) print serv serv = servicerepository.Service('S177696', 'test service 3', ksdldate = 'today') servMan.updateService(serv) print servMan.getServiceIds() print servMan print serv
targetList = self._determineIndependantTargets(targettype, target) from communitymanager import getCommunityManager for cid in getCommunityManager().getCommunityIds(): c = getCommunityManager().getCommunity(cid) try: targetList.index(cid) for mid in c.getAuthorities(): retList.append((mid, cid)) except ValueError, msg: pass # alright, this community is not in our target list return retList elif actor == 'authorities_service': # check targets as well targetList = self._determineIndependantTargets(targettype, target) from servicerepository import getServiceManager for sid in getServiceManager().getServiceIds(): s = getServiceManager().getService(sid) try: targetList.index(sid) for mid in s.getAuthorities(): retList.append((mid, sid)) except ValueError, msg: pass # alright, this service is not in our target list return retList elif actor == 'authorities_member': # each member is its own authority targetList = self._determineIndependantTargets(targettype, target) from communitymanager import getMemberManager for mid in getMemberManager().getMemberIds(): try: targetList.index(mid)