# Class: Session

Session Structure

# Public Instance Methods

### getcurgroup ()

Get group of current user and return instance.

Show source...

        # File bbs/lib/dbmodels/session.rb, line 97
    97:   def getcurgroup
    98:     $db[:groups].where(:id => $session.group_id).first
    99:   end

### getcuruser ()

Get current user by login name and return instance.

Show source...

        # File bbs/lib/dbmodels/session.rb, line 92
    92:   def getcuruser
    93:     $db[:users].where(:id => $session.user_id).first
    94:   end

### is_valid? ()

Check if the session is valid.

Show source...

         # File bbs/lib/dbmodels/session.rb, line 116
    116:   def is_valid?
    117:     if $session && $session.expires >= Time.now || self.timeremain >= 0
    118:       return true
    119:     end
    120:   end

### setexpiration ()

Set the session expiration time. This is determined Based on the amount of user‘s daily alloted time, substracted by the amount of time used so far today, then compared to the current time to create a time value of when the expiration will occur.

Show source...

         # File bbs/lib/dbmodels/session.rb, line 106
    106:   def setexpiration
    107:     return -1
    108:   end

### timeremain ()

Returns value of session‘s remaining time in minutes

Show source...

         # File bbs/lib/dbmodels/session.rb, line 111
    111:   def timeremain
    112:     return ($session.expires - Time.now).to_i.sec_to_min
    113:   end