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
|
if data.organization_id
|
||||||
data.organization = App.Organization.find(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 )
|
user.activity_stream_log( 'session started', user.id, true )
|
||||||
|
|
||||||
# auto population of default collections
|
# auto population of default collections
|
||||||
collections = SessionHelper::default_collections(user)
|
collections, assets = SessionHelper::default_collections(user)
|
||||||
|
|
||||||
# set session user_id
|
assets = user.assets(assets)
|
||||||
user = User.find_fulldata(user.id)
|
|
||||||
|
|
||||||
# check logon session
|
# check logon session
|
||||||
logon_session_key = nil
|
logon_session_key = nil
|
||||||
|
@ -52,6 +51,7 @@ class SessionsController < ApplicationController
|
||||||
render :json => {
|
render :json => {
|
||||||
:session => user,
|
:session => user,
|
||||||
:collections => collections,
|
:collections => collections,
|
||||||
|
:assets => assets,
|
||||||
:logon_session => logon_session_key,
|
:logon_session => logon_session_key,
|
||||||
},
|
},
|
||||||
:status => :created
|
:status => :created
|
||||||
|
@ -84,15 +84,18 @@ class SessionsController < ApplicationController
|
||||||
|
|
||||||
# Save the user ID in the session so it can be used in
|
# Save the user ID in the session so it can be used in
|
||||||
# subsequent requests
|
# subsequent requests
|
||||||
user = User.user_data_full( user_id )
|
user = User.find( user_id )
|
||||||
|
|
||||||
# auto population of default collections
|
# 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
|
# return current session
|
||||||
render :json => {
|
render :json => {
|
||||||
:session => user,
|
:session => user,
|
||||||
:collections => collections,
|
:collections => collections,
|
||||||
|
:assets => assets,
|
||||||
:config => config_frontend,
|
:config => config_frontend,
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
|
@ -3,31 +3,17 @@ module SessionHelper
|
||||||
|
|
||||||
# auto population collections, store all here
|
# auto population collections, store all here
|
||||||
default_collection = {}
|
default_collection = {}
|
||||||
|
assets = {}
|
||||||
|
|
||||||
# load collections to deliver from external files
|
# load collections to deliver from external files
|
||||||
dir = File.expand_path('../../', __FILE__)
|
dir = File.expand_path('../../', __FILE__)
|
||||||
files = Dir.glob( "#{dir}/app/controllers/sessions/collection_*.rb" )
|
files = Dir.glob( "#{dir}/app/controllers/sessions/collection_*.rb" )
|
||||||
for file in files
|
for file in files
|
||||||
load file
|
load file
|
||||||
ExtraCollection.session( default_collection, user )
|
ExtraCollection.session( default_collection, assets, user )
|
||||||
end
|
end
|
||||||
|
|
||||||
return default_collection
|
return default_collection, assets
|
||||||
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
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def self.cleanup_expired
|
def self.cleanup_expired
|
||||||
|
|
Loading…
Reference in a new issue