Example #1
0
    def get(self):
        """ post handler - wants an ak """

        the_assoc_keyurl = self.request.get('ak', '0')

        if the_assoc_keyurl == '0':
            return  # todo figure out what to do

        the_assoc_key = assoc.assoc_key_from_urlsafe(the_assoc_keyurl)
        the_assoc = the_assoc_key.get()

        # make sure we're a band admin or a superuser
        if not (self.user.is_superuser
                or assoc.get_admin_status_for_member_for_band_key(
                    self.user, the_assoc.band)):
            return self.redirect('/')

        the_band_key = the_assoc.band

        the_member_key = the_assoc.member
        assoc.delete_association_from_key(the_assoc_key)

        invites = assoc.get_inviting_assoc_keys_from_member_key(the_member_key)
        if invites is None or (len(invites) == 1
                               and invites[0] == the_assoc_key):
            logging.error('removed last invite from member; deleteing')
            member.forget_member_from_key(the_member_key)

        return self.redirect('/band_info.html?bk={0}'.format(
            the_band_key.urlsafe()))
Example #2
0
    def get(self):
        """ post handler - wants an ak """

        the_assoc_keyurl=self.request.get('ak','0')

        if the_assoc_keyurl=='0':
            return # todo figure out what to do

        the_assoc_key = assoc.assoc_key_from_urlsafe(the_assoc_keyurl)
        the_assoc = the_assoc_key.get()
        
        # make sure we're a band admin or a superuser
        if not (self.user.is_superuser or assoc.get_admin_status_for_member_for_band_key(self.user, the_assoc.band)):
            return self.redirect('/')

        the_band_key = the_assoc.band

        the_member_key = the_assoc.member
        assoc.delete_association_from_key(the_assoc_key) 

        invites = assoc.get_inviting_assoc_keys_from_member_key(the_member_key)
        if invites is None or (len(invites)==1 and invites[0]==the_assoc_key):
            logging.error('removed last invite from member; deleteing')
            forget_member_from_key(the_member_key)            
                    
        return self.redirect('/band_info.html?bk={0}'.format(the_band_key.urlsafe()))
Example #3
0
    def post(self):

        the_user = self.user

        the_assoc_keyurl = self.request.get('ak', '0')
        the_color = int(self.request.get('c', '0'))

        the_assoc_key = assoc.assoc_key_from_urlsafe(the_assoc_keyurl)
        the_assoc = the_assoc_key.get()

        if the_assoc.member == the_user.key:
            the_assoc.color = the_color
            the_assoc.put()
Example #4
0
    def post(self):

        the_user = self.user

        the_assoc_keyurl=self.request.get('ak','0')
        the_get_email= True if (self.request.get('em','0') == 'true') else False

        the_assoc_key = assoc.assoc_key_from_urlsafe(the_assoc_keyurl)
        the_assoc = the_assoc_key.get()

        if the_assoc.member == the_user.key or the_user.is_superuser:
            the_assoc.email_me= the_get_email
            the_assoc.put()
Example #5
0
    def post(self):

        the_user = self.user

        the_assoc_keyurl=self.request.get('ak','0')
        the_color=int(self.request.get('c','0'))

        the_assoc_key = assoc.assoc_key_from_urlsafe(the_assoc_keyurl)
        the_assoc = the_assoc_key.get()

        if the_assoc.member == the_user.key:
            the_assoc.color = the_color
            the_assoc.put()
Example #6
0
    def post(self):

        the_user = self.user

        the_assoc_keyurl = self.request.get('ak', '0')
        the_get_email = True if (self.request.get('em', '0')
                                 == 'true') else False

        the_assoc_key = assoc.assoc_key_from_urlsafe(the_assoc_keyurl)
        the_assoc = the_assoc_key.get()

        if the_assoc.member == the_user.key or the_user.is_superuser:
            the_assoc.email_me = the_get_email
            the_assoc.put()
Example #7
0
    def post(self):
        the_assoc_keyurl = self.request.get('ak', '0')
        the_do = self.request.get('do', None)

        if the_assoc_keyurl == '0' or the_do is None:
            raise Exception("Association not specified")

        the_hide_me = True if (the_do == 'true') else False

        the_assoc_key = assoc.assoc_key_from_urlsafe(the_assoc_keyurl)
        the_assoc = the_assoc_key.get()

        the_user = self.user
        if the_assoc.member == the_user.key or the_user.is_superuser:
            the_assoc.hide_from_schedule = the_hide_me
            the_assoc.put()
Example #8
0
    def post(self):
        the_assoc_keyurl=self.request.get('ak','0')
        the_do=self.request.get('do',None)

        if the_assoc_keyurl=='0' or the_do is None:
            raise Exception("Association not specified")

        the_hide_me= True if (the_do == 'true') else False

        the_assoc_key = assoc.assoc_key_from_urlsafe(the_assoc_keyurl)
        the_assoc = the_assoc_key.get()

        the_user = self.user
        if the_assoc.member == the_user.key or the_user.is_superuser:
            the_assoc.hide_from_schedule = the_hide_me
            the_assoc.put()
Example #9
0
    def post(self):
        """ post handler - wants a member key and a band key, and a flag """
        
        the_user = self.user

        the_assoc_keyurl=self.request.get('ak','0')
        the_do=self.request.get('do',None)

        if the_assoc_keyurl=='0' or the_do is None:
            return # todo figure out what to do

        the_assoc = assoc.assoc_key_from_urlsafe(the_assoc_keyurl).get()
        
        if is_authorized_to_edit_band(the_assoc.band,the_user) or the_user.key == the_assoc.member:
            the_assoc.is_occasional = (the_do=='true')
            the_assoc.put()
Example #10
0
    def post(self):
        """ post handler - wants a member key and a band key, and a flag """

        the_user = self.user

        the_assoc_keyurl = self.request.get('ak', '0')
        the_do = self.request.get('do', None)

        if the_assoc_keyurl == '0' or the_do is None:
            return  # todo figure out what to do

        the_assoc = assoc.assoc_key_from_urlsafe(the_assoc_keyurl).get()

        if is_authorized_to_edit_band(
                the_assoc.band, the_user) or the_user.key == the_assoc.member:
            the_assoc.is_occasional = (the_do == 'true')
            the_assoc.put()
Example #11
0
    def get(self):    
        """ deletes an assoc for a member """

        the_assoc_keyurl=self.request.get('ak','0')

        if the_assoc_keyurl == '0':
            return # todo figure out what to do
        
        the_assoc = assoc.assoc_key_from_urlsafe(the_assoc_keyurl).get()
        
        the_member_key=the_assoc.member
        the_band_key=the_assoc.band

        assoc.delete_association_from_key(the_assoc.key)
        plan.delete_plans_for_member_key_for_band_key(the_member_key, the_band_key)
        gig.reset_gigs_for_contact_key(the_member_key, the_band_key)

        # since our bands are changing, invalidate the band list in our session
        self.user.invalidate_member_bandlists(self, the_member_key)
        
        return self.redirect('/member_info.html?mk={0}'.format(the_member_key.urlsafe()))
Example #12
0
    def post(self):
        """ post handler - wants a member key and a band key, and a flag """
        
        the_user = self.user

        the_assoc_keyurl=self.request.get('ak','0')
        the_do=self.request.get('do',None)

        if the_assoc_keyurl=='0' or the_do is None:
            return # todo figure out what to do

        the_assoc = assoc.get_assoc(assoc.assoc_key_from_urlsafe(the_assoc_keyurl))

        if not is_authorized_to_edit_band(the_assoc.band,the_user):
            return                

        the_assoc.is_band_admin = (the_do=='true')
        the_assoc.put()
        
        # if the user happens to be logged in, invalidate his cached list of bands and
        # bands for which he can edit gigs
        the_assoc.member.get().invalidate_member_bandlists(self, the_assoc.member)
Example #13
0
    def get(self):
        """ deletes an assoc for a member """

        the_assoc_keyurl = self.request.get('ak', '0')

        if the_assoc_keyurl == '0':
            return  # todo figure out what to do

        the_assoc = assoc.assoc_key_from_urlsafe(the_assoc_keyurl).get()

        the_member_key = the_assoc.member
        the_band_key = the_assoc.band

        assoc.delete_association_from_key(the_assoc.key)
        plan.delete_plans_for_member_key_for_band_key(the_member_key,
                                                      the_band_key)
        gig.reset_gigs_for_contact_key(the_member_key, the_band_key)

        # since our bands are changing, invalidate the band list in our session
        self.user.invalidate_member_bandlists(self, the_member_key)

        return self.redirect('/member_info.html?mk={0}'.format(
            the_member_key.urlsafe()))
Example #14
0
    def post(self):
        """ post handler - wants a member key and a band key, and a flag """

        the_user = self.user

        the_assoc_keyurl = self.request.get('ak', '0')
        the_do = self.request.get('do', None)

        if the_assoc_keyurl == '0' or the_do is None:
            return  # todo figure out what to do

        the_assoc = assoc.get_assoc(
            assoc.assoc_key_from_urlsafe(the_assoc_keyurl))

        if not is_authorized_to_edit_band(the_assoc.band, the_user):
            return

        the_assoc.is_band_admin = (the_do == 'true')
        the_assoc.put()

        # if the user happens to be logged in, invalidate his cached list of bands and
        # bands for which he can edit gigs
        the_assoc.member.get().invalidate_member_bandlists(
            self, the_assoc.member)