class AgendaItem(BasicModel):
	title = ndb.StringProperty(required=True)
	start_datetime = ndb.DateTimeProperty()
	end_datetime = ndb.DateTimeProperty()
	active = ndb.BooleanProperty()
	#----------------------------------------
	speakers = ndb.LocalStructuredProperty( Speaker , repeated=True )
Пример #2
0
class SpeakerQuestion(BasicModel):
	question_id = ndb.StringProperty(required=True)
	sender_name = ndb.StringProperty()
	sender_email = ndb.StringProperty()
	sender_question = ndb.StringProperty()
	sender_university = ndb.LocalStructuredProperty( University )
	has_been_revised = ndb.BooleanProperty(default=False)
Пример #3
0
class GeneralEvent(BasicModel):
	event_id = ndb.IntegerProperty(required=True)
	keyname = ndb.StringProperty(required=True)
	name = ndb.StringProperty()
	privacy = ndb.StringProperty( choices=( 'Private','Public','Secret' ) )
	picture =  ndb.StringProperty()
	start_datetime = ndb.DateTimeProperty()
	end_datetime = ndb.DateTimeProperty()
	languages = ndb.StringProperty( choices=( 'English','Spanish','Portugese' ) )
	location = ndb.StringProperty()
	active = ndb.BooleanProperty()

	#agenda_items = ndb.LocalStructuredProperty( AgendaItem , repeated=True )
	#participants = ndb.StructuredProperty( Participant , repeated=True )
	#anchors = ndb.StructuredProperty( Anchor , repeated=True )

	description = StringTranslationProperty()
	title = ChoiceTranslationProperty( choices= {
		'choice1': {
			'spanish': 'mango',
			'english': 'mangon',  
		},
		'choice2': {
			'spanish': 'tomate',
			'english': 'tomato',  
		},
		'choice3': {
			'spanish': 'pollo',
			'english': 'chicken',  
		}
	})
Пример #4
0
class Account(BasicModel):
    first_name = ndb.StringProperty(indexed=True)
    last_name = ndb.StringProperty(indexed=True)
    email = ndb.StringProperty(indexed=True)
    password = ndb.StringProperty(indexed=False)
    is_seller = ndb.BooleanProperty(indexed=False, default=False)

    def __repr__(self):
        return '%s %s' % (self.first_name, self.last_name)

    @classmethod
    def list_all(cls):
        return cls.query()

    @classmethod
    def create(cls, params):
        item = cls()
        item.populate(**params)
        item.put()
        return item

    @classmethod
    def remove(cls):
        ndb.delete_multi(
            Account.query().fetch(keys_only=True)
        )

    @classmethod
    def get(cls, key_name=None):
        if key_name:
            return cls.find_by_email(key_name)
        else:
            return None

    @staticmethod
    def transform_message(entity):
        return EventMessage(
            key=entity.key.urlsafe(),
            first_name=entity.first_name,
            last_name=entity.last_name,
            email=entity.email
        )
Пример #5
0
class DeprovisionedAccount(BasicModel):
    status = ndb.BooleanProperty()
    email = ndb.StringProperty()

    @classmethod
    def list_all(cls):
        return cls.query()

    @classmethod
    def create(cls, params):
        item = cls()
        item.populate(**params)
        item.put()
        return item

    @classmethod
    def remove(cls):
        ndb.delete_multi(DeprovisionedAccount.query().fetch(keys_only=True))

    @staticmethod
    def remove_owner_failed_notification(selectedEmail, event_summary,
                                         event_link):

        subject = "Arista Inc. - An attempt to remove an Owner of a Calendar Event has failed. "
        body = """
         Hello,

            This notice is to let you know that user "%s", the owner of the "%s" event, has failed to be removed due to having participants on the event.
            Please review this event and make different plans if necessary.

            %s

        Thanks,
        Arista IT
        """ % (selectedEmail, event_summary, event_link)

        mail.send_mail(oauth_config['default_user'],
                       notifications_recipient['email'], subject, body)

    @staticmethod
    def remove_owner_success_notification(selectedEmail, event_summary,
                                          event_link):

        subject = "Arista Inc. - Owner of a calendar event has been successfully removed."
        body = """
         Hello,

            This notice is to let you know that "%s" the owner of the "%s" has been removed from our systems.
            Please review this event and make different plans if necessary.

            %s

        Thanks,
        Arista IT
        """ % (selectedEmail, event_summary, event_link)

        mail.send_mail(oauth_config['default_user'],
                       notifications_recipient['email'], subject, body)

    @staticmethod
    def deprovision_success_notification(selectedEmail):

        subject = "Arista Inc. - %s has been successfully removed." % selectedEmail
        body = """
         Hello,

            This notice is to let you know that "%s" has been removed from our systems.

        Thanks,
        Arista IT
        """ % selectedEmail

        mail.send_mail(oauth_config['default_user'],
                       notifications_recipient['email'], subject, body)
Пример #6
0
class Ticket(BasicModel):
    event = ndb.KeyProperty(kind='Event', indexed=True)
    scalper_name = ndb.KeyProperty(kind='Account', indexed=True)
    ticket_img = ndb.BlobKeyProperty()
    ticket_url = ndb.StringProperty(indexed=True)
    section = ndb.StringProperty(indexed=True)
    quantity = ndb.IntegerProperty(indexed=True)
    price = ndb.FloatProperty(indexed=True)
    sold = ndb.BooleanProperty(default=False, indexed=True)

    @classmethod
    def list_all(cls):
        return cls.query(cls.sold == False).order(cls.price)

    @classmethod
    def list_per_user(cls, key):
        csas = cls.query(cls.scalper_name == key).order(cls.price)
        tickets = [cls.buildTicket(ticket) for ticket in csas]
        return CompletedTickets(tickets=tickets)

    @classmethod
    def create(cls, params):
        params['event'] = ndb.Key(urlsafe=params['event'])
        # params['ticket_number'] = IdTracker.generate_number('ticket')
        item = cls()
        item.populate(**params)
        item.put()
        return item

    @classmethod
    def remove(cls):
        ndb.delete_multi(
            Ticket.query().fetch(keys_only=True)
        )

    @classmethod
    def find_tickets(cls, key):
        csas = cls.find_all_by_event(key).filter(cls.sold == False).order(cls.price)
        tickets = [cls.buildTicket(ticket) for ticket in csas]
        return CompletedTickets(tickets=tickets)

    @classmethod
    def to_message(cls, entity):
        tickets = [cls.buildTicket(entity)]
        return CompletedTickets(tickets=tickets)

    @classmethod
    def buildTicket(cls, ticket):
        return TicketMessage(
            key=ticket.key.urlsafe(),
            section=ticket.section,
            quantity=ticket.quantity,
            price=ticket.price,
            scalper_name=cls.buildScalpers(ticket.scalper_name.get()),
            sold=ticket.sold,
            event=Event.buildEvent(ticket.event.get())
        )

    @classmethod
    def buildScalpers(cls, name):
        return ScalperMessage(
            key=name.key.urlsafe(),
            first_name=name.first_name,
            last_name=name.last_name,
            email=name.email
        )
Пример #7
0
class SocialLogin(SettingsModel):
    _name = 'SocialLogin'
    _settings_key = 'oauth2'
    _description = """
    Control use of social login
    """
    enable_login = ndb.BooleanProperty(indexed=False, default=True)
    fb_api_key = ndb.StringProperty(indexed=False)
    fb_secret = ndb.StringProperty(indexed=False)


# # This gets used in emails
# settings['app_name'] = {'APP_NAME'}
# 
# settings['app_config'] = {
#     'webapp2_extras.sessions': {
#         # WebApp2 encrypted cookie key
#         # You can use a UUID generator like http://www.famkruithof.net/uuid/uuidgen
#         'secret_key': '_PUT_KEY_HERE_YOUR_SECRET_KEY_',
#     },
#     'webapp2_extras.auth': {
#         'user_model': 'plugins.custom_auth.models.user.User',
#         'user_attributes': ['email'],
#     }
# }
# 
# # Password AES Encryption Parameters
# # aes_key must be only 16 (*AES-128*), 24 (*AES-192*), or 32 (*AES-256*) bytes (characters) long.
# settings['aes_key'] = "12_24_32_BYTES_KEY_FOR_PASSWORDS"
# settings['salt'] = "_PUT_SALT_HERE_TO_SHA512_PASSWORDS_"
# 
# # get your own consumer key and consumer secret by registering at https://dev.twitter.com/apps
# # callback url must be: http://[YOUR DOMAIN]/login/twitter/complete
# settings['twitter_consumer_key'] = 'TWITTER_CONSUMER_KEY'
# settings['twitter_consumer_secret'] = 'TWITTER_CONSUMER_SECRET'
# 
# #Facebook Login
# # get your own consumer key and consumer secret by registering at https://developers.facebook.com/apps
# #Very Important: set the site_url= your domain in the application settings in the facebook app settings page
# # callback url must be: http://[YOUR DOMAIN]/login/facebook/complete
# settings['fb_api_key'] = 'FACEBOOK_API_KEY'
# settings['fb_secret'] = 'FACEBOOK_SECRET'
# 
# #Linkedin Login
# #Get you own api key and secret from https://www.linkedin.com/secure/developer
# settings['linkedin_api'] = 'LINKEDIN_API'
# settings['linkedin_secret'] = 'LINKEDIN_SECRET'
# 
# # Github login
# # Register apps here: https://github.com/settings/applications/new
# settings['github_server'] = 'github.com'
# settings['github_redirect_uri'] = 'http://www.example.com/social_login/github/complete',
# settings['github_client_id'] = 'GITHUB_CLIENT_ID'
# settings['github_client_secret'] = 'GITHUB_CLIENT_SECRET'
# 
# # Enable Federated login (OpenID and OAuth)
# # Google App Engine Settings must be set to Authentication Options: Federated Login
# settings['enable_federated_login'] = True
# 
# # List of social login providers
# # uri is for OpenID only (not OAuth)
# settings['social_providers'] = { 
#         'google': {'name': 'google', 'label': 'Google', 'uri': 'gmail.com'},
#         'github': {'name': 'github', 'label': 'Github', 'uri': ''},
#         'facebook': {'name': 'facebook', 'label': 'Facebook', 'uri': ''},
#         'linkedin': {'name': 'linkedin', 'label': 'LinkedIn', 'uri': ''},
#         #'myopenid': {'name': 'myopenid', 'label': 'MyOpenid', 'uri': 'myopenid.com'},
#         'twitter': {'name': 'twitter', 'label': 'Twitter', 'uri': ''},
#         'yahoo': {'name': 'yahoo', 'label': 'Yahoo!', 'uri': 'yahoo.com'},
#     }
# 
# # If true, it will write in datastore a log of every email sent
# settings['log_email'] = False
# 
# # If true, it will write in datastore a log of every visit
# settings['log_visit'] = False
Пример #8
0
class ExternalEvent(GeneralEvent):
	is_all_day_event = ndb.BooleanProperty(default=False)
	subtitles = ndb.StringProperty( choices=('Spanish','English','Portuguese') )
Пример #9
0
class VideoCastEvent(GeneralEvent):
	live_event_type = ndb.StringProperty( choices=('Speciality','Mega', 'Regional') )
	is_on_testing_mode = ndb.BooleanProperty(default=False)
	has_all_confirmed_speakers = ndb.BooleanProperty(default=False)
	agenda_url = ndb.StringProperty()
	subtitles = ndb.StringProperty( choices=('Spanish','English','Portuguese') )