liquid_feedback_frontend
view model/session.lua @ 118:93f4e465b50d
add initiator support in delegation
if a delegation is issued from the initiative view, the initiators
from that one are added to the delegation target list. this makes it easier to delegate to the author without the need to add him to the contact list.
if a delegation is issued from the initiative view, the initiators
from that one are added to the delegation target list. this makes it easier to delegate to the author without the need to add him to the contact list.
author | Daniel Poelzleithner <poelzi@poelzi.org> |
---|---|
date | Mon Sep 20 20:32:04 2010 +0200 (2010-09-20) |
parents | 3bfb2fcf7ab9 |
children | ea2449916c12 |
line source
1 Session = mondelefant.new_class()
2 Session.table = 'session'
3 Session.primary_key = { 'ident' }
5 Session:add_reference{
6 mode = 'm1',
7 to = "Member",
8 this_key = 'member_id',
9 that_key = 'id',
10 ref = 'member',
11 }
13 local function random_string()
14 return multirand.string(
15 32,
16 '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz'
17 )
18 end
20 function Session:new()
21 local session = self.prototype.new(self) -- super call
22 session.ident = random_string()
23 session.additional_secret = random_string()
24 session:save()
25 return session
26 end
28 function Session:by_ident(ident)
29 local selector = self:new_selector()
30 selector:add_where{ 'ident = ?', ident }
31 selector:optional_object_mode()
32 return selector:exec()
33 end