Moved to asset support for initial page load.
This commit is contained in:
parent
f49f6767e7
commit
44590eb9b2
3 changed files with 25 additions and 23 deletions
|
@ -49,5 +49,18 @@ class App.User extends App.Model
|
|||
if data.organization_id
|
||||
data.organization = App.Organization.find(data.organization_id)
|
||||
|
||||
data
|
||||
if data['role_ids']
|
||||
data['roles'] = []
|
||||
for role_id in data['role_ids']
|
||||
if App.Role.exists( role_id )
|
||||
role = App.Role.find( role_id )
|
||||
data['roles'].push role
|
||||
|
||||
if data['group_ids']
|
||||
data['groups'] = []
|
||||
for group_id in data['group_ids']
|
||||
if App.Group.exists( group_id )
|
||||
group = App.Group.find( group_id )
|
||||
data['groups'].push group
|
||||
|
||||
data
|
|
@ -31,10 +31,9 @@ class SessionsController < ApplicationController
|
|||
user.activity_stream_log( 'session started', user.id, true )
|
||||
|
||||
# auto population of default collections
|
||||
collections = SessionHelper::default_collections(user)
|
||||
collections, assets = SessionHelper::default_collections(user)
|
||||
|
||||
# set session user_id
|
||||
user = User.find_fulldata(user.id)
|
||||
assets = user.assets(assets)
|
||||
|
||||
# check logon session
|
||||
logon_session_key = nil
|
||||
|
@ -52,6 +51,7 @@ class SessionsController < ApplicationController
|
|||
render :json => {
|
||||
:session => user,
|
||||
:collections => collections,
|
||||
:assets => assets,
|
||||
:logon_session => logon_session_key,
|
||||
},
|
||||
:status => :created
|
||||
|
@ -84,15 +84,18 @@ class SessionsController < ApplicationController
|
|||
|
||||
# Save the user ID in the session so it can be used in
|
||||
# subsequent requests
|
||||
user = User.user_data_full( user_id )
|
||||
user = User.find( user_id )
|
||||
|
||||
# auto population of default collections
|
||||
collections = SessionHelper::default_collections( User.find(user_id) )
|
||||
collections, assets = SessionHelper::default_collections(user)
|
||||
|
||||
assets = user.assets(assets)
|
||||
|
||||
# return current session
|
||||
render :json => {
|
||||
:session => user,
|
||||
:collections => collections,
|
||||
:assets => assets,
|
||||
:config => config_frontend,
|
||||
}
|
||||
end
|
||||
|
|
|
@ -3,31 +3,17 @@ module SessionHelper
|
|||
|
||||
# auto population collections, store all here
|
||||
default_collection = {}
|
||||
assets = {}
|
||||
|
||||
# load collections to deliver from external files
|
||||
dir = File.expand_path('../../', __FILE__)
|
||||
files = Dir.glob( "#{dir}/app/controllers/sessions/collection_*.rb" )
|
||||
for file in files
|
||||
load file
|
||||
ExtraCollection.session( default_collection, user )
|
||||
ExtraCollection.session( default_collection, assets, user )
|
||||
end
|
||||
|
||||
return default_collection
|
||||
end
|
||||
def self.push_collections(user)
|
||||
|
||||
# auto population collections, store all here
|
||||
push_collections = {}
|
||||
|
||||
# load collections to deliver from external files
|
||||
dir = File.expand_path('../../', __FILE__)
|
||||
files = Dir.glob( "#{dir}/app/controllers/sessions/collection_*.rb" )
|
||||
for file in files
|
||||
load file
|
||||
ExtraCollection.push( push_collections, user )
|
||||
end
|
||||
|
||||
return push_collections
|
||||
return default_collection, assets
|
||||
end
|
||||
|
||||
def self.cleanup_expired
|
||||
|
|
Loading…
Reference in a new issue