def test_epi_clears_communities(self): alice = self.make_participant('alice') c = alice.create_community('test') alice.upsert_community_membership(True, c.id) bob = self.make_participant('bob') bob.upsert_community_membership(True, c.id) assert Community.from_name('test').nmembers == 2 # sanity check alice.erase_personal_information() assert Community.from_name('test').nmembers == 1
def test_epi_clears_communities(self): alice = self.make_participant('alice') c = alice.create_community('test') alice.upsert_community_membership(True, c.id) bob = self.make_participant('bob') bob.upsert_community_membership(True, c.id) assert Community.from_name('test').nmembers == 2 # sanity check alice.erase_personal_information() assert Community.from_name('test').nmembers == 1
def test_cpi_clears_communities(self): alice = self.make_participant('alice') c = alice.create_community('test') alice.update_community_status('memberships', True, c.id) bob = self.make_participant('bob') bob.update_community_status('memberships', True, c.id) assert Community.from_name('test').nmembers == 2 # sanity check with self.db.get_cursor() as cursor: alice.clear_personal_information(cursor) assert Community.from_name('test').nmembers == 1
def get_community(state, restrict=False): request, response = state['request'], state['response'] user = state['user'] name = request.path['name'] c = Community.from_name(name) if request.method in SAFE_METHODS: if not c: response.redirect('/for/new?name=' + urlquote(name)) if c.name != name: response.redirect('/for/' + c.name + request.line.uri.decoded[5 + len(name):]) elif not c: raise response.error(404) elif user.ANON: raise AuthRequired if restrict: if user.ANON: raise LoginRequired if user.id != c.creator: if user.is_admin: log_admin_request(user, c.participant, request) else: _ = state['_'] raise response.error( 403, _("You are not authorized to access this page.")) return c
def get_community(state, restrict=False): request, response = state['request'], state['response'] user = state['user'] name = request.path['name'] c = Community.from_name(name) if request.method in ('GET', 'HEAD'): if not c: response.redirect('/for/new?name=' + urlquote(name)) if c.name != name: response.redirect('/for/' + c.name + request.line.uri[5 + len(name):]) elif not c: raise response.error(404) elif user.ANON: raise AuthRequired if restrict: if user.ANON: raise LoginRequired if user.id != c.creator and not user.is_admin: _ = state['_'] raise response.error( 403, _("You are not authorized to access this page.")) return c
def get_community(state, restrict=False): request, response = state['request'], state['response'] user = state['user'] name = request.path['name'] c = Community.from_name(name) if request.method in ('GET', 'HEAD'): if not c: response.redirect('/for/new?name=' + urlquote(name)) if c.name != name: response.redirect('/for/' + c.name + request.line.uri.decoded[5+len(name):]) elif not c: raise response.error(404) elif user.ANON: raise AuthRequired if restrict: if user.ANON: raise LoginRequired if user.id != c.creator: if user.is_admin: log_admin_request(user, c.participant, request) else: _ = state['_'] raise response.error(403, _("You are not authorized to access this page.")) return c
def get_community(state, restrict=False): request, response = state['request'], state['response'] user = state['user'] name = request.path['name'] c = Community.from_name(name) if not c: raise response.error(404) if request.method in SAFE_METHODS: if c.name != name: response.redirect('/for/' + c.name + request.line.uri.decoded[5 + len(name):]) elif user.ANON: raise AuthRequired else: user.require_write_permission() is_spam = c.participant.marked_as == 'spam' if (restrict or is_spam): if user.id == c.creator: pass elif user.is_acting_as('admin'): log_admin_request(user, c.participant, request) elif restrict: if user.ANON: raise LoginRequired else: _ = state['_'] raise response.error( 403, _("You are not authorized to access this page.")) elif is_spam: raise response.render('simplates/spam-profile.spt', state) return c