def __init__(self, tracker): self._tracker_type = tracker.type self._tracker_name = tracker.name self.id = '' self.time = 0.0 self.desc = '' self.reporter = User(name='unknown', email='unknown') self.owner = User(name='unknown', email='unknown') self.priority = '' self.priority_number = 5 # 1 - 5 self.severity = '' self.severity_number = 5 # 1 - 5 self.status = '' self.resolution = '' self.project_name = '' self.component_name = '' self.version = '' self.project_id = None self.project = None self.deadline = '' self.opendate = None self.changeddate = None self.dependson = {} self.blocked = {} self.url = '#' self.labels = []
def __init__(self, key, bug_id, status, description, tracker): self.id = bug_id self.status = status self.desc = description self.resolved = self.status in JiraFetcher.RESOLVED_STATUSES self.url = tracker.url + '/browse/{}'.format(key) self.owner = User(name='unknown')
def __init__(self, bug_id, status, description, tracker): self.id = bug_id self.status = status self.desc = description self.resolved = self.status in ('CLOSED', 'RESOLVED', 'VERIFIED') self.url = tracker.url + '/show_bug.cgi?id=%s' % bug_id self.owner = User(name='unknown')
def callback(request): code = request.params.get('code', '') try: credentials = flow.step2_exchange(code) except FlowExchangeError: raise HTTPForbidden data = requests.get(USER_INFO_URI % credentials.access_token, verify=False) google_profile = data.json email = google_profile['email'] EXTRA_EMAILS = request.registry.settings.get('GOOGLE_EXTRA_EMAILS', '').split('\n') config = ApplicationConfig.get_current_config(allow_empty=True) freelancers = config.get_freelancers() clients_emails = Client.get_emails() if email.endswith('@%s' % request.registry.settings['COMPANY_DOMAIN'] ) or email in EXTRA_EMAILS: group = 'user' elif email in freelancers: group = 'freelancer' elif email in clients_emails: group = 'client' else: WARN_LOG( u"Forbidden acccess for profile:\n%s\n client's emails:\n%s\nfreelancer's emails:\n%s" % (google_profile, clients_emails, freelancers)) return HTTPForbidden() session = request.db_session user = session.query(User).filter(User.email == email).first() if user is not None: if credentials.refresh_token: DEBUG(u'Adding refresh token %s for user %s' % ( credentials.refresh_token, user.name, )) user.refresh_token = credentials.refresh_token session.add(user) DEBUG(u'Signing in existing user %s' % (user.name, )) else: LOG(u'Creating new user with name %s and email %s, group: %s' % (google_profile['name'], google_profile['email'], group)) user = User( name=google_profile['name'], email=email, refresh_token=credentials.refresh_token or '', groups=[group], ) session.add(user) session.flush() headers = remember(request, user.id) DEBUG(u'User %s set' % user.name) if group == 'client': location = request.url_for('/scrum/sprint/list') else: location = '/' return HTTPFound( location=location, headers=headers, )
def resolve_user(self, orig_login): login = orig_login.lower() if login in self.login_mapping: return self.login_mapping[login] else: return User(name=orig_login, email=orig_login)
def _resolve_user(self, orig_login, login_mapping): return login_mapping.get( orig_login.lower(), User(name=orig_login, email=orig_login), )