|
67 | 67 |
|
68 | 68 | // Use this for checking the session, to bypass login screen |
69 | 69 | bypassLoginCheck: function(args) { //before login screen |
70 | | - g_mySession = $.cookie("JSESSIONID"); |
71 | | - g_sessionKey = $.cookie("sessionKey"); |
72 | | - g_role = $.cookie("role"); |
73 | | - g_username = $.cookie("username"); |
74 | | - g_account = $.cookie("account"); |
75 | | - g_domainid = $.cookie("domainid"); |
76 | | - g_timezone = $.cookie("timezone"); |
77 | | - g_userPublicTemplateEnabled = $.cookie("userpublictemplateenabled"); |
78 | | - g_userfullname = $.cookie('userfullname'); |
79 | | - g_userid = $.cookie('userid'); |
80 | | - |
81 | | - if($.cookie("timezoneoffset") != null) |
82 | | - g_timezoneoffset = isNaN($.cookie("timezoneoffset"))?null: parseFloat($.cookie("timezoneoffset")); |
83 | | - else |
84 | | - g_timezoneoffset = null; |
85 | | - |
86 | | - if (g_userPublicTemplateEnabled == null || g_userPublicTemplateEnabled.length == 0) |
87 | | - g_userPublicTemplateEnabled = "true"; |
88 | | - |
89 | | - if(g_supportELB == null) |
90 | | - g_supportELB = $.cookie("supportELB"); |
91 | | - |
| 70 | + if (g_loginResponse == null) { //not single-sign-on |
| 71 | + g_mySession = $.cookie('JSESSIONID'); |
| 72 | + g_sessionKey = $.cookie('sessionKey'); |
| 73 | + g_role = $.cookie('role'); |
| 74 | + g_username = $.cookie('username'); |
| 75 | + g_userid = $.cookie('userid'); |
| 76 | + g_account = $.cookie('account'); |
| 77 | + g_domainid = $.cookie('domainid'); |
| 78 | + g_userfullname = $.cookie('userfullname'); |
| 79 | + g_timezone = $.cookie('timezone'); |
| 80 | + if($.cookie('timezoneoffset') != null) |
| 81 | + g_timezoneoffset = isNaN($.cookie('timezoneoffset'))? null: parseFloat($.cookie('timezoneoffset')); |
| 82 | + else |
| 83 | + g_timezoneoffset = null; |
| 84 | + } |
| 85 | + else { //single-sign-on |
| 86 | + g_mySession = $.cookie('JSESSIONID'); |
| 87 | + g_sessionKey = encodeURIComponent(g_loginResponse.sessionkey); |
| 88 | + g_role = g_loginResponse.type; |
| 89 | + g_username = g_loginResponse.username; |
| 90 | + g_userid = g_loginResponse.userid; |
| 91 | + g_account = g_loginResponse.account; |
| 92 | + g_domainid = g_loginResponse.domainid; |
| 93 | + g_userfullname = g_loginResponse.firstname + ' ' + g_loginResponse.lastname; |
| 94 | + g_timezone = g_loginResponse.timezone; |
| 95 | + if(g_loginResponse.timezoneoffset != null) |
| 96 | + g_timezoneoffset = isNaN(g_loginResponse.timezoneoffset)? null: parseFloat(g_loginResponse.timezoneoffset); |
| 97 | + else |
| 98 | + g_timezoneoffset = null; |
| 99 | + } |
| 100 | + |
92 | 101 | var userValid = false; |
93 | | - |
94 | 102 | $.ajax({ |
95 | 103 | url: createURL("listCapabilities"), |
96 | 104 | dataType: "json", |
97 | 105 | async: false, |
98 | 106 | success: function(json) { |
99 | 107 | g_capabilities = json.listcapabilitiesresponse.capability; |
| 108 | + $.cookie('capabilities', g_capabilities, { expires: 1}); |
| 109 | + |
100 | 110 | g_supportELB = json.listcapabilitiesresponse.capability.supportELB.toString(); //convert boolean to string if it's boolean |
101 | 111 | $.cookie('supportELB', g_supportELB, { expires: 1}); |
102 | | - |
103 | | - g_userProjectsEnabled = json.listcapabilitiesresponse.capability.allowusercreateprojects; |
104 | | - $.cookie('userProjectsEnabled', g_userProjectsEnabled, { expires: 1 }); |
105 | | - |
| 112 | + |
106 | 113 | if (json.listcapabilitiesresponse.capability.userpublictemplateenabled != null) { |
107 | 114 | g_userPublicTemplateEnabled = json.listcapabilitiesresponse.capability.userpublictemplateenabled.toString(); //convert boolean to string if it's boolean |
108 | 115 | $.cookie('userpublictemplateenabled', g_userPublicTemplateEnabled, { expires: 1}); |
109 | 116 | } |
| 117 | + |
| 118 | + g_userProjectsEnabled = json.listcapabilitiesresponse.capability.allowusercreateprojects; |
| 119 | + $.cookie('userProjectsEnabled', g_userProjectsEnabled, { expires: 1 }); |
| 120 | + |
110 | 121 | userValid = true; |
111 | 122 | }, |
112 | 123 | error: function(xmlHTTP) { |
|
200 | 211 | $.cookie('userid', g_userid, { expires: 1 }); |
201 | 212 |
|
202 | 213 | $.ajax({ |
203 | | - url: createURL("listCapabilities"), |
204 | | - //url: "command=/client/api?listCapabilities&sessionkey="+g_sessionKey, |
| 214 | + url: createURL("listCapabilities"), |
205 | 215 | dataType: "json", |
206 | 216 | async: false, |
207 | 217 | success: function(json) { |
208 | 218 | g_capabilities = json.listcapabilitiesresponse.capability; |
| 219 | + $.cookie('capabilities', g_capabilities, { expires: 1}); |
| 220 | + |
209 | 221 | g_supportELB = json.listcapabilitiesresponse.capability.supportELB.toString(); //convert boolean to string if it's boolean |
210 | 222 | $.cookie('supportELB', g_supportELB, { expires: 1}); |
211 | 223 |
|
|
0 commit comments