def call(self): categ1 = CategoryManager().getById('1') #target category here for i in xrange(1, 0 + 1): #number of conferences to create here c = categ1.newConference( AvatarHolder().getById('1')) #creator of event c.setTitle("event " + str(i)) c.setTimezone('UTC') c.setDates(nowutc() - timedelta(hours=i), nowutc() - timedelta(hours=i - 1)) for j in xrange(1, 0 + 1): #number of bookings per event c.getCSBookingManager().createBooking( "Vidyo", { "roomName": "room_" + str(i) + "_" + str(j), "roomDescription": "test", "owner": { "_type": "Avatar", "id": "1" } })
def _getParticipantsList(self, participantList): result = [] for part in participantList: partFossil = fossilize(part) # var to control if we have to show the entry in the author menu to allow add submission rights isSubmitter = False av = AvatarHolder().match({"email": part.getEmail()}, searchInAuthenticators=False, exact=True) if not av: if part.getEmail() in self._contribution.getSubmitterEmailList( ): isSubmitter = True elif (av[0] in self._contribution.getSubmitterList() or self._conf.getPendingQueuesMgr().isPendingSubmitter(part)): isSubmitter = True partFossil["showSubmitterCB"] = not isSubmitter result.append(partFossil) return result
def changeUserList(self, object, newList): # clone the list, to avoid problems allowedUsers = object.getAllowedToAccessList()[:] # user can be a user or group for user in allowedUsers: if not user.getId() in newList: object.revokeAccess(user) else: del newList[user.getId()] for elem in newList: # TODO: Change this, when DictPickler goes away if ('isGroup' in elem and elem['isGroup']) or \ ('_fossil' in elem and elem['_fossil'] == 'group'): avatar = GroupHolder().getById(elem['id']) else: avatar = AvatarHolder().getById(elem['id']) object.grantAccess(avatar)
def _process( self ): user = self._getUser() canManageRegistration = self._conf.canManageRegistration(user) if not canManageRegistration and (not self._regForm.isActivated() or not self._conf.hasEnabledSection("regForm")): p = registrationForm.WPRegFormInactive( self, self._conf ) return p.display() params = self._getRequestParams() if canManageRegistration: matchedUsers = AvatarHolder().match({"email": params["email"]}) if matchedUsers: user = matchedUsers[0] else: user = None else: if self._conf.getRegistrationForm().isFull(): self._redirect(urlHandlers.UHConfRegistrationFormDisplay.getURL(self._conf)) return elif not self._conf.getRegistrationForm().inRegistrationPeriod(): p = registrationForm.WPRegistrationFormClosed(self, self._conf) return p.display() if user is None: if self._conf.hasRegistrantByEmail(self._getRequestParams().get("email","")): raise FormValuesError("There is already a user with the email \"%s\". Please choose another one"%self._getRequestParams().get("email","--no email--")) else: if user.isRegisteredInConf(self._conf): self._redirect(urlHandlers.UHConfRegistrationForm.getURL(self._conf)) return rp = registration.Registrant() self._conf.addRegistrant(rp) rp.setValues(self._getRequestParams(), user) if user is not None: user.addRegistrant(rp) rp.setAvatar(user) #if not canManageRegistration: # avoid multiple sending in case of db conflict if not hasattr(self, "_emailsent"): self._regForm.getNotification().sendEmailNewRegistrant(self._regForm, rp) self._emailSent = True if not canManageRegistration: self._redirect(urlHandlers.UHConfRegistrationFormCreationDone.getURL(rp)) else: self._redirect(RHRegistrantListModif._uh.getURL(self._conf))
def _getAnswer(self): for user in self._userList: if user["_type"] == "Avatar": # new speaker ah = AvatarHolder() av = ah.getById(user["id"]) part = self._newParticipant(av) elif user["_type"] == "ContributionParticipation": # adding existing author to speaker part = self._contribution.getAuthorById(user["id"]) self._contribution.addSpeaker(part) if self._submissionRights and part: self._contribution.grantSubmission(part) if self._kindOfList == "prAuthor": return self._getParticipantsList(self._contribution.getPrimaryAuthorList()) elif self._kindOfList == "coAuthor": return self._getParticipantsList(self._contribution.getCoAuthorList()) elif self._kindOfList == "speaker": return self._getParticipantsList(self._contribution.getSpeakerList()) else: raise ServiceError("ERR-UK0", _("Invalid kind of list of users."))
def run(self): """Mandatory to implement for the specific queues. It runs the task of sending an email to the users in order to ask them for the creation of the account. It returns: - TRUE if the pending user has already created the account. - FALSE if not.""" ah = AvatarHolder() results=ah.match({"email":self._email}, exact=1) av=None for i in results: if i.getEmail().lower().strip()==self._email.lower().strip(): av=i break if av is not None and av.isActivated(): ph=PendingQueuesHolder() ph.grantRights(av) return True return False
def searchUsers(surName="", name="", organisation="", email="", conferenceId=None, exactMatch=True, searchExt=False): if surName != "" or name != "" or organisation != "" or email != "": # build criteria criteria = { "surName": surName, "name": name, "organisation": organisation, "email": email } # search users people = AvatarHolder().match(criteria, exact=exactMatch, forceWithoutExtAuth=(not searchExt)) # search authors if conferenceId != None: try: conference = ConferenceHolder().getById(conferenceId) authorIndex = conference.getAuthorIndex() authors = authorIndex.match(criteria, exact=exactMatch) # merge with users users = people people = [] emails = [] for user in users: people.append(user) emails.extend(user.getEmails()) for author in authors: if author.getEmail() not in emails: people.append(author) except Exception: pass return people else: return []
def user_create(grant_admin): """Creates new user""" avatar = Avatar() user_type = 'user' if not grant_admin else 'admin' print() name = prompt("First name") surname = prompt("Last name") organization = prompt("Affiliation") print() login = prompt("Enter username") email = prompt_email().encode('utf-8') if email is None: return password = prompt_pass().encode('utf-8') if password is None: return avatar.setName(name) avatar.setSurName(surname) avatar.setOrganisation(organization) avatar.setLang("en_GB") avatar.setEmail(email) print_user_info(avatar) if prompt_bool(cformat("%{yellow}Create the new {}?").format(user_type), default=True): from MaKaC.authentication import AuthenticatorMgr avatar.activateAccount() login_info = LoginInfo(login, password) auth_mgr = AuthenticatorMgr() try: user_id = auth_mgr.createIdentity(login_info, avatar, "Local") auth_mgr.add(user_id) AvatarHolder().add(avatar) if grant_admin: admin_list = HelperMaKaCInfo.getMaKaCInfoInstance().getAdminList() admin_list.grant(avatar) success("New {} created successfully with ID: {}".format(user_type, avatar.getId())) except UserError as e: error("Error: {}".format(str(e)))
def _getAnswer(self): for user in self._userList: if user["_type"] == "Avatar": # new speaker ah = AvatarHolder() av = ah.getById(user["id"]) if av is None: raise NoReportError(_("The user with email %s that you are adding does not exist anymore in the database") % user["email"]) part = self._newParticipant(av) elif user["_type"] == "ContributionParticipation": # adding existing author to speaker part = self._contribution.getAuthorById(user["id"]) self._contribution.addSpeaker(part) if self._submissionRights and part: self._contribution.grantSubmission(part) if self._kindOfList == "prAuthor": return self._getParticipantsList(self._contribution.getPrimaryAuthorList()) elif self._kindOfList == "coAuthor": return self._getParticipantsList(self._contribution.getCoAuthorList()) elif self._kindOfList == "speaker": return self._getParticipantsList(self._contribution.getSpeakerList()) else: raise ServiceError("ERR-UK0", _("Invalid kind of list of users."))
def searchUsers(surName="", name="", organisation="", email="", exactMatch=True, searchExt=False): if surName != "" or name != "" or organisation != "" or email != "": # build criteria criteria = { "surName": surName, "name": name, "organisation": organisation, "email": email } # search users people = AvatarHolder().match(criteria, exact=exactMatch, searchInAuthenticators=searchExt) return people else: return []
def convertLinkedTo(dbi, withRBDB, prevVersion): """Convert Avatar.linkedTo structure to use OOTreeSets and import linkedTo information into Redis (if enabled)""" print 'Note: Some links might point to broken objects which will be skipped automatically.' use_redis = Config.getInstance().getRedisConnectionURL() if use_redis: pipe = redis_client.pipeline(transaction=False) for i, avatar in enumerate(AvatarHolder()._getIdx().itervalues()): avatar.updateLinkedTo( ) # just in case some avatars do not have all fields linkedTo = avatar.linkedTo avatar.resetLinkedTo() # nuke old links for field, data in avatar.linkedToMap.iteritems(): for role in data['roles']: if not linkedTo[field][role]: continue todo = set(linkedTo[field][role]) # We have broken objects in the database which will fail in the getConference() call. If the current # object type has such a method call it on each object and skip it in case it raises an AttributeError if hasattr(linkedTo[field][role][0], 'getConference'): for obj in linkedTo[field][role]: try: obj.getConference() except AttributeError, e: print ' \tSkipping broken object in %s/%s/%s: %r' % ( avatar.getId(), field, role, obj) todo.remove(obj) avatar.linkedTo[field][role].update(todo) if use_redis: avatar_links.init_links(avatar, client=pipe) if i % 1000 == 0: if use_redis: pipe.execute() dbi.commit() print '\r %d' % i, sys.stdout.flush()
def _getAnswer(self): if self._action == "grant": self._contribution.grantSubmission(self._participant) elif self._action == "remove": av = AvatarHolder().match({"email": self._participant.getEmail()}, exact=True, searchInAuthenticators=False) if not av: self._contribution.revokeSubmissionEmail( self._participant.getEmail()) else: self._contribution.revokeSubmission(av[0]) if self._eventType == "conference": return [ self._getParticipantsList( self._contribution.getPrimaryAuthorList()), self._getParticipantsList( self._contribution.getCoAuthorList()), self._getParticipantsList(self._contribution.getSpeakerList()) ] else: return self._getParticipantsList( self._contribution.getSpeakerList())
def _process(self): av = AvatarHolder().getById(self._userId) if av.isActivated(): p = signIn.WPAccountAlreadyActivated(self, av) return p.display() #return "your account is already activated" if av.isDisabled(): p = signIn.WPAccountDisabled(self, av) return p.display() #return "your account is disabled. please, ask to enable it" elif self._key == av.getKey(): av.activateAccount() #----Grant any kind of rights if anything ph = pendingQueues.PendingQueuesHolder() ph.grantRights(av) #----- p = signIn.WPAccountActivated(self, av) return p.display() #return "Your account is activate now" else: return "Wrong key. Please, ask for a new one" pass
def _process(self): canManageRegistration = self._conf.canManageRegistration( self._getUser()) if not canManageRegistration and not self._regForm.isActivated(): p = registrationForm.WPRegFormInactive(self, self._conf) return p.display() params = self._getRequestParams() email = self._regForm.getPersonalData().getValueFromParams( params, 'email') if email is None: raise FormValuesError( _("An email address has to be set in order to make the registration in the event." )) elif not validMail(email, False): raise FormValuesError(_("The given email address is not valid.")) matchedUsers = AvatarHolder().match({"email": email}, exact=1) if matchedUsers: user = matchedUsers[0] else: user = None # Check if the user can register if not canManageRegistration: # normal user registering. Managers can. if self._conf.getRegistrationForm().isFull(): self._redirect( urlHandlers.UHConfRegistrationFormDisplay.getURL( self._conf)) return elif not self._conf.getRegistrationForm().inRegistrationPeriod(): p = registrationForm.WPRegistrationFormClosed(self, self._conf) return p.display() if user is None: if self._conf.hasRegistrantByEmail(email): raise FormValuesError( "There is already a user with the email \"%s\". Please choose another one" % email) else: if user.isRegisteredInConf(self._conf): self._redirect( urlHandlers.UHConfRegistrationForm.getURL(self._conf)) return if self._conf.hasRegistrantByEmail(email): if canManageRegistration: raise FormValuesError( "There is already a user with the email \"%s\". Please choose another one" % email) else: raise FormValuesError( "You have already registered with the email address \"%s\". If you need to modify your registration, please contact the managers of the conference." % email) rp = registration.Registrant() self._conf.addRegistrant(rp, user) rp.setValues(self._getRequestParams(), user) rp.setSessionBillingEnabled( self._regForm.getSessionsForm().getType() != "2priorities") if user is not None: user.addRegistrant(rp) rp.setAvatar(user) # avoid multiple sending in case of db conflict email = self._regForm.getNotification().createEmailNewRegistrant( self._regForm, rp) if email: GenericMailer.send(email) if not canManageRegistration: self._redirect( urlHandlers.UHConfRegistrationFormCreationDone.getURL(rp)) else: self._redirect(RHRegistrantListModif._uh.getURL(self._conf))
def created_by_user(self): return AvatarHolder().getById(self.created_by_id)
def booked_for_user(self): return AvatarHolder().getById( self.booked_for_id) if self.booked_for_id else None
def _process(self): av = AvatarHolder().getById(self._userId) p = signIn.WPUnactivatedAccount(self, av) return p.display()
def _process(self): av = AvatarHolder().getById(self._userId) p = signIn.WPAccountDisabled(self, av) return p.display()
def _process(self): av = AvatarHolder().getById(self._userId) sm = mail.sendConfirmationRequest(av) sm.send() self._redirect(urlHandlers.UHSignIn.getURL())
## License, or (at your option) any later version. ## ## Indico is distributed in the hope that it will be useful, but ## WITHOUT ANY WARRANTY; without even the implied warranty of ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ## General Public License for more details. ## ## You should have received a copy of the GNU General Public License ## along with Indico;if not, see <http://www.gnu.org/licenses/>. from MaKaC.common import DBMgr from MaKaC.user import AvatarHolder, Avatar, GroupHolder from MaKaC.conference import CategoryManager, ConferenceHolder ch = ConferenceHolder() ah = AvatarHolder() gh = GroupHolder() print "Cleaning index..." userIds = [] DBMgr.getInstance().startRequest() for av in ah.getList(): userIds.append(av.getId()) DBMgr.getInstance().endRequest() i = 0 total = len(userIds) for id in userIds:
def insert(self): """ Inserts room into database (SQL: INSERT). """ AvatarHolder().invalidateRoomManagerIdList() self.checkIntegrity()
def _process(self): canManageRegistration = self._conf.canManageRegistration( self._getUser()) if not canManageRegistration and not self._regForm.isActivated(): p = registrationForm.WPRegFormInactive(self, self._conf) return p.display() params = self._getRequestParams() email = self._regForm.getPersonalData().getValueFromParams( params, 'email') if email is None: raise FormValuesError( _("An email address has to be set in order to make the registration in the event." )) elif not validMail(email, False): raise FormValuesError(_("The given email address is not valid.")) matchedUsers = AvatarHolder().match({"email": email}, exact=1) if matchedUsers: user = matchedUsers[0] else: user = None # Check if the user can register if not canManageRegistration: # normal user registering. Managers can. if self._conf.getRegistrationForm().isFull(): self._redirect( urlHandlers.UHConfRegistrationFormDisplay.getURL( self._conf)) return elif not self._conf.getRegistrationForm().inRegistrationPeriod(): p = registrationForm.WPRegistrationFormClosed(self, self._conf) return p.display() if user is None: if self._conf.hasRegistrantByEmail(email): raise FormValuesError( "There is already a user with the email \"%s\". Please choose another one" % email) else: if user.isRegisteredInConf( self._conf) or self._conf.hasRegistrantByEmail(email): if canManageRegistration: raise FormValuesError( "There is already a user with the email \"%s\". Please choose another one" % email) else: raise FormValuesError( "You have already registered with the email address \"%s\". If you need to modify your registration, please contact the managers of the conference." % email) rp = registration.Registrant() self._conf.addRegistrant(rp, user) rp.setValues(self._getRequestParams(), user) if user is not None: user.addRegistrant(rp) rp.setAvatar(user) # This creates the email to the new registrant and SENDS the email to the organizers if necessary... WTF. email = self._regForm.getNotification().createEmailNewRegistrant( self._regForm, rp) if self._regForm.isSendRegEmail() and rp.getEmail().strip(): modEticket = self._conf.getRegistrationForm().getETicket() if modEticket.isEnabled() and modEticket.isAttachedToEmail(): attachment = { 'name': "{0}-Ticket.pdf".format(self._target.getTitle()), 'binary': TicketToPDF(self._target, rp).getPDFBin(), } email["attachments"] = [attachment] GenericMailer.send(email) if canManageRegistration and user != self._getUser(): self._redirect(RHRegistrantListModif._uh.getURL(self._conf)) else: self._redirect( urlHandlers.UHConfRegistrationFormCreationDone.getURL(rp))
def retrieveAvatar(self, rh): """ Login using Shibbolet. """ from MaKaC.user import AvatarHolder, Avatar config = Config.getInstance().getAuthenticatorConfigById(self.id).get( "SSOMapping", {}) if config.get('email', 'ADFS_EMAIL') in request.environ: email = request.environ[config.get("email", "ADFS_EMAIL")] login = request.environ.get(config.get("login", "ADFS_LOGIN")) personId = request.environ.get( config.get("personId", "ADFS_PERSONID")) phone = request.environ.get( config.get("phone", "ADFS_PHONENUMBER"), "") fax = request.environ.get(config.get("fax", "ADFS_FAXNUMBER"), "") lastname = request.environ.get( config.get("lastname", "ADFS_LASTNAME"), "") firstname = request.environ.get( config.get("firstname", "ADFS_FIRSTNAME"), "") institute = request.environ.get( config.get("institute", "ADFS_HOMEINSTITUTE"), "") if personId == '-1': personId = None ah = AvatarHolder() av = ah.match({"email": email}, exact=1, onlyActivated=False, searchInAuthenticators=False) if av: av = av[0] # don't allow disabled accounts if av.isDisabled(): return None elif not av.isActivated(): av.activateAccount() av.clearAuthenticatorPersonalData() av.setAuthenticatorPersonalData('phone', phone) av.setAuthenticatorPersonalData('fax', fax) av.setAuthenticatorPersonalData('surName', lastname) av.setAuthenticatorPersonalData('firstName', firstname) av.setAuthenticatorPersonalData('affiliation', institute) if personId != None and personId != av.getPersonId(): av.setPersonId(personId) else: avDict = { "email": email, "name": firstname, "surName": lastname, "organisation": institute, "telephone": phone, "login": login } av = Avatar(avDict) ah.add(av) av.setPersonId(personId) av.activateAccount() self._postLogin(login, av, True) return av return None
def split_avatars(file): """Step 2: Split the merged avatars - run this on the POST-MERGE database""" data = json.load(file) if len(data) != 2: echo('Invalid data: Expected two items, found {}'.format(len(data))) raise click.Abort() avatars = [AvatarHolder().getById(x['id']) for x in data] if avatars.count(None) != 1: echo( 'Expected exactly one unreferenced avatar, got {}'.format(avatars)) raise click.Abort() if avatars[0] is None: orig = avatars[1] orig_data = data[1] merged_data = data[0] else: orig = avatars[0] orig_data = data[0] merged_data = data[1] merged = [av for av in orig._mergeFrom if av.getId() == merged_data['id']] if len(merged) != 1: echo("Avatars don't seem to be merged into each other") raise click.Abort() merged = merged[0] if merged not in orig._mergeFrom or merged._mergeTo != orig: echo("Avatars don't seem to be merged into each other") raise click.Abort() # Remove merge references orig._mergeFrom.remove(merged) merged._mergeTo = None # Clean secondary emails orig.setSecondaryEmails(orig_data['secondary_emails']) merged.setSecondaryEmails(merged_data['secondary_emails']) # Clean identities for identity in merged.getIdentityList(create_identities=True): orig.removeIdentity(identity) identity.setUser(merged) # Re-index the avatars # noinspection PyCallByClass ObjectHolder.add(AvatarHolder(), merged) for index in {'organisation', 'email', 'name', 'surName', 'status'}: IndexesHolder().getById(index).unindexUser(orig) IndexesHolder().getById(index).indexUser(orig) IndexesHolder().getById(index).indexUser(merged) # Restore links for the merged avatar for key, links in merged_data['links'].iteritems(): objtype, role = key.split('.') for link in links: # TODO: Add extra items here as necessary (use show_links to check if anything is missing)! if objtype == 'conference': event = ConferenceHolder().getById(link, quiet=True) if event is None: echo('Event not found: {}'.format(link)) continue if event not in set(orig.linkedTo[objtype][role]): echo('{!r} not linked to avatar via {}'.format(event, key)) continue if role == 'access': event.revokeAccess(orig) event.grantAccess(merged) else: echo('Unexpected link type: {}'.format(key)) raise click.Abort() # print 'Updated {} - {!r}'.format(key, event) elif objtype == 'contribution': event_id, contrib_id = link event = ConferenceHolder().getById(event_id) if event is None: echo('Event not found: {}'.format(event_id)) continue contrib = event.getContributionById(contrib_id) if contrib is None: echo('Contrib not found: {}.{}'.format( event_id, contrib_id)) continue if contrib not in set(orig.linkedTo[objtype][role]): echo('{} not linked to avatar via {}'.format(contrib, key)) continue if role == 'submission': contrib.revokeSubmission(orig) contrib.grantSubmission(merged) elif role == 'manager': contrib.revokeModification(orig) contrib.grantModification(merged) else: echo('Unexpected link type: {}'.format(key)) raise click.Abort() # print 'Updated {} - {}'.format(key, contrib) else: # This results in inconsistent data in redis, but since we flush the redis # links after a successful merge, that's not an issue. Also, we only reach # this branch if someone is using different versions of this script... echo('Unexpected link type: {}'.format(key)) raise click.Abort() if not click.confirm('Do you want to commit the changes now?'): transaction.abort( ) # not really necessary, but let's stay on the safe side raise click.Abort() transaction.commit() # Refresh redis links avatar_links.delete_avatar(orig) avatar_links.delete_avatar(merged) avatar_links.init_links(orig) avatar_links.init_links(merged) # Delete suggestions suggestions.delete_avatar(orig) suggestions.delete_avatar(merged)
def __init__(self): Index.__init__(self) from MaKaC.user import AvatarHolder ah = AvatarHolder() for av in ah.getList(): self.indexUser(av)
def entity(self): if self.entity_type == 'Avatar': return AvatarHolder().getById(self.entity_id) else: # Group, LDAPGroup return GroupHolder().getById(self.entity_id)
def _addMaterialType(self, text, user): from MaKaC.common.fossilize import fossilize from MaKaC.fossils.conference import ILocalFileExtendedFossil, ILinkFossil Logger.get('requestHandler').debug('Adding %s - request %s' % (self._uploadType, request)) mat, newlyCreated = self._getMaterial() # if the material still doesn't exist, create it if newlyCreated: protectedAtResourceLevel = False else: protectedAtResourceLevel = True resources = [] if self._uploadType in ['file', 'link']: if self._uploadType == "file": for fileEntry in self._files: resource = LocalFile() resource.setFileName(fileEntry["fileName"]) resource.setFilePath(fileEntry["filePath"]) resource.setDescription(self._description) if self._displayName == "": resource.setName(resource.getFileName()) else: resource.setName(self._displayName) if not type(self._target) is Category: log_info = { "subject": "Added file %s%s" % (fileEntry["fileName"], text) } self._target.getConference().getLogHandler().logAction( log_info, log.ModuleNames.MATERIAL) resources.append(resource) # in case of db conflict we do not want to send the file to conversion again, nor re-store the file elif self._uploadType == "link": for link in self._links: resource = Link() resource.setURL(link["url"]) resource.setDescription(self._description) if self._displayName == "": resource.setName(resource.getURL()) else: resource.setName(self._displayName) if not type(self._target) is Category: log_info = { "subject": "Added link %s%s" % (resource.getURL(), text) } self._target.getConference().getLogHandler().logAction( log_info, log.ModuleNames.MATERIAL) resources.append(resource) status = "OK" info = resources else: status = "ERROR" info = "Unknown upload type" return mat, status, info # forcedFileId - in case there is a conflict, use the file that is # already stored repoIDs = [] for i, resource in enumerate(resources): if self._repositoryIds: mat.addResource(resource, forcedFileId=self._repositoryIds[i]) else: mat.addResource(resource, forcedFileId=None) #apply conversion if self._topdf and not isinstance(resource, Link): file_ext = os.path.splitext( resource.getFileName())[1].strip().lower() if fileConverter.CDSConvFileConverter.hasAvailableConversionsFor( file_ext): # Logger.get('conv').debug('Queueing %s for conversion' % resource.getFilePath()) fileConverter.CDSConvFileConverter.convert( resource.getFilePath(), 'pdf', mat) resource.setPDFConversionRequestDate(nowutc()) # store the repo id, for files if isinstance(resource, LocalFile) and self._repositoryIds is None: repoIDs.append(resource.getRepositoryId()) if protectedAtResourceLevel: protectedObject = resource else: protectedObject = mat mat.setHidden(self._visibility) mat.setAccessKey(self._password) protectedObject.setProtection(self._statusSelection) for userElement in self._userList: if 'isGroup' in userElement and userElement['isGroup']: avatar = GroupHolder().getById(userElement['id']) else: avatar = AvatarHolder().getById(userElement['id']) protectedObject.grantAccess(avatar) self._topdf = False if self._repositoryIds is None: self._repositoryIds = repoIDs return mat, status, fossilize( info, { "MaKaC.conference.Link": ILinkFossil, "MaKaC.conference.LocalFile": ILocalFileExtendedFossil })
log(i) defTZ = raw_input("Enter the timezone of the server:") log("set default server timezone: %s" % defTZ) info.HelperMaKaCInfo.getMaKaCInfoInstance().setTimezone(defTZ) log("start: %s" % str(datetime.now())) execute = [ 1, 2, 3, 4, 5, 6, 7 ] #execute = [ 1, 3, 4, 5, 6, 7 ] #execute = [ 6, 7 ] # update all users defaults if 1 in execute: log("step 1/7: update users") for us in AvatarHolder().getList(): updateUserDef( us ) DBMgr.getInstance().commit() # update all event dates if 3 in execute: ## log("step 3/7: update all events") ## events = ConferenceHolder().getList() ## totnum = len(events) ## curnum = 0 ## curper = 0 ## for ev in events: ## #if not ev.startDate.tzinfo: ## updateEvent(ev) ## DBMgr.getInstance().commit() ## curnum += 1
def _getCreatedByUser(self): if self._createdBy is None: return None return AvatarHolder().getById(self._createdBy)
def user(self): avatarId = self.get('_avatarId') if not avatarId: return None return AvatarHolder().getById(avatarId)