Browse Source

Fixed a problem where user data of anonymous user is not loaded when a plugin uses the authorization api.

Appdata authorization even now provides the userid.
pull/160/head
Simon Eisenmann 11 years ago
parent
commit
99ab9df509
  1. 22
      static/js/controllers/mediastreamcontroller.js
  2. 7
      static/js/services/appdata.js

22
static/js/controllers/mediastreamcontroller.js

@ -408,10 +408,28 @@ define(['jquery', 'underscore', 'angular', 'bigscreen', 'moment', 'sjcl', 'moder
// Unmark authorization process. // Unmark authorization process.
if (data.Userid) { if (data.Userid) {
appData.authorizing(false); appData.authorizing(false, data.Userid);
} else if (!appData.authorizing()) { } else {
if (!appData.authorizing()) {
// Trigger user data load when not in authorizing phase. // Trigger user data load when not in authorizing phase.
$scope.loadUserSettings(); $scope.loadUserSettings();
} else {
// Wait until authorizing is over and try it then.
var handler = (function() {
return function(event, authorizing, userid) {
if (!authorizing) {
// Turn of handler if we are no longer authorizing.
appData.e.off("authorizing", handler);
handler = null;
if (!userid) {
// Trigger user data load when without user after authorizing phase.
$scope.loadUserSettings();
}
}
}
})();
appData.e.on("authorizing", handler);
}
} }
// Select room if settings have an alternative default room. // Select room if settings have an alternative default room.

7
static/js/services/appdata.js

@ -40,8 +40,9 @@ define(["jquery"], function($) {
// - mainStatus(event, status) // - mainStatus(event, status)
// status (string) : Status id (connected, waiting, ...) // status (string) : Status id (connected, waiting, ...)
// //
// - authorizing(event, flag) // - authorizing(event, flag, userid)
// flag (bool) : True if authorizing phase, else false. // flag (bool) : True if authorizing phase, else false.
// userid (string) : User id if a user was authorized.
// //
// - userSettingsLoaded(event, loaded, user_settings) // - userSettingsLoaded(event, loaded, user_settings)
// loaded (bool) : True if something was loaded, else false. // loaded (bool) : True if something was loaded, else false.
@ -74,13 +75,13 @@ define(["jquery"], function($) {
service.data = d; service.data = d;
return d; return d;
}; };
service.authorizing = function(value) { service.authorizing = function(value, userid) {
// Boolean flag to indicate that an authentication is currently in progress. // Boolean flag to indicate that an authentication is currently in progress.
if (typeof(value) !== "undefined") { if (typeof(value) !== "undefined") {
var v = !!value; var v = !!value;
if (v !== service.flags.authorizing) { if (v !== service.flags.authorizing) {
service.flags.authorizing = v; service.flags.authorizing = v;
service.e.triggerHandler("authorizing", v); service.e.triggerHandler("authorizing", v, userid);
} }
} }
return service.flags.authorizing; return service.flags.authorizing;

Loading…
Cancel
Save