liquid_feedback_frontend
diff app/main/membership/_action/update.lua @ 1045:701a5cf6b067
Imported LiquidFeedback Frontend 3.0 branch
author | bsw |
---|---|
date | Thu Jul 10 01:19:48 2014 +0200 (2014-07-10) |
parents | b77e6a17ca77 |
children |
line diff
1.1 --- a/app/main/membership/_action/update.lua Thu Jul 10 01:02:43 2014 +0200 1.2 +++ b/app/main/membership/_action/update.lua Thu Jul 10 01:19:48 2014 +0200 1.3 @@ -1,26 +1,26 @@ 1.4 local area_id = assert(param.get("area_id", atom.integer), "no area id given") 1.5 local membership = Membership:by_pk(area_id, app.session.member.id) 1.6 1.7 +local area = Area:by_id(area_id) 1.8 if param.get("delete", atom.boolean) then 1.9 if membership then 1.10 membership:destroy() 1.11 - --slot.put_into("notice", _"Membership removed") 1.12 + slot.put_into("notice", _"Subscription removed") 1.13 else 1.14 - --slot.put_into("notice", _"Membership not existent") 1.15 + slot.put_into("notice", _"Subscription already removed") 1.16 end 1.17 return 1.18 end 1.19 1.20 +if not app.session.member:has_voting_right_for_unit_id(area.unit_id) then 1.21 + slot.put_into("error", _"You are not eligible to participate") 1.22 + return false 1.23 +end 1.24 + 1.25 if not membership then 1.26 - local area = Area:by_id(area_id) 1.27 - if not app.session.member:has_voting_right_for_unit_id(area.unit_id) then 1.28 - error("access denied") 1.29 - end 1.30 membership = Membership:new() 1.31 membership.area_id = area_id 1.32 membership.member_id = app.session.member_id 1.33 + membership:save() 1.34 + slot.put_into("notice", _"Subject area subscribed") 1.35 end 1.36 - 1.37 -membership:save() 1.38 - 1.39 ---slot.put_into("notice", _"Membership updated")