Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
Events.prototype.unbind = function(event, method){
if (0 == arguments.length) return this.unbindAll();
if (1 == arguments.length) return this.unbindAllOf(event);
// no bindings for this event
var bindings = this._events[event];
if (!bindings) return;
// no bindings for this method
var cb = bindings[method];
if (!cb) return;
events.unbind(this.el, event, cb);
};
Events.prototype.unbind = function(event, method){
if (0 == arguments.length) return this.unbindAll();
if (1 == arguments.length) return this.unbindAllOf(event);
// no bindings for this event
var bindings = this._events[event];
if (!bindings) return;
// no bindings for this method
var cb = bindings[method];
if (!cb) return;
events.unbind(this.el, event, cb);
};
Events.prototype.unbind = function(event, method){
if (0 == arguments.length) return this.unbindAll();
if (1 == arguments.length) return this.unbindAllOf(event);
// no bindings for this event
var bindings = this._events[event];
if (!bindings) return;
// no bindings for this method
var cb = bindings[method];
if (!cb) return;
events.unbind(this.el, event, cb);
};
var init = function(isPjax) {
// open the messages menu
if(!isPjax) {
event.on('humhub:modules:mail:live:NewUserMessage', function (evt, events) {
event = events[events.length - 1];
setMailMessageCount(event.data.count);
}).on('humhub:modules:mail:live:UserMessageDeleted', function (evt, events) {
event = events[events.length - 1];
setMailMessageCount(event.data.count);
});
$('#icon-messages').click(function () {
if(currentXhr) {
currentXhr.abort();
}
// remove all <li> entries from dropdown
$('#loader_messages').parent().find(':not(#loader_messages)').remove();</li>
user.init = function (options) {
var event = require('event');
event.on('tenantCreate', function (tenantId) {
});
event.on('tenantLoad', function (tenantId) {
var registry = server.systemRegistry(tenantId);
user.configs(tenantId, JSON.parse(registry.content(options.tenantConfigs)));
});
event.on('tenantUnload', function (tenantId) {
});
event.on('login', function (tenantId, usr, session) {
var space,
carbon = require('carbon');
server.current(session, usr);
session.put(USER_REGISTRY, new carbon.registry.Registry(server.instance(), {
username: usr.username,
tenantId: tenantId
}));
space = user.userSpace(usr);
session.put(USER_SPACE, space);
if (!usr.isAuthorized(space, carbon.registry.actions.PUT)) {
event.emit('userRegister', tenantId, usr);
}
});
event.on('logout', function (tenantId, usr, session) {
server.current(session, null);
tenantId: tenantId
});
//loads tenant's anon registry
config[ANONYMOUS_REGISTRY] = new carbon.registry.Registry(server(), {
tenantId: tenantId
});
//loads tenant's user manager
config[USER_MANAGER] = new carbon.user.UserManager(server(), tenantId);
});
event.on('tenantUnload', function (tenantId) {
var config = configs(tenantId);
delete config[tenantId];
});
event.on('login', function (tenantId, user, session) {
//we check the existence of user manager in the application ctx and
//decide whether tenant has been already loaded.
/*log.debug('login : ' + tenantId + ' User : ' + JSON.stringify(user));
if (application.get(tenantId + USER_MANAGER)) {
//return;
}
event.emit('tenantCreate', tenantId);
event.emit('tenantLoad', tenantId);*/
var carbon = require('carbon'),
server = require('/modules/server.js'),
loginManager = carbon.server.osgiService('org.wso2.carbon.core.services.callback.LoginSubscriptionManagerService'),
configReg = server.systemRegistry(tenantId).registry.getChrootedRegistry("/_system/config"),
domain = carbon.server.tenantDomain({
tenantId: tenantId
});
loginManager.triggerEvent(configReg, user.username, tenantId, domain);
tenantId: tenantId
});
//loads tenant's anon registry
config[ANONYMOUS_REGISTRY] = new carbon.registry.Registry(server.instance(), {
tenantId: tenantId
});
//loads tenant's user manager
config[USER_MANAGER] = new carbon.user.UserManager(server.instance(), tenantId);
});
event.on('tenantUnload', function (tenantId) {
var config = server.configs(tenantId);
delete config[tenantId];
});
event.on('login', function (tenantId, user, session) {
//we check the existence of user manager in the application ctx and
//decide whether tenant has been already loaded.
/*log.info('login : ' + tenantId + ' User : ' + JSON.stringify(user));
if (application.get(tenantId + USER_MANAGER)) {
//return;
}
event.emit('tenantCreate', tenantId);
event.emit('tenantLoad', tenantId);*/
var carbon = require('carbon'),
loginManager = carbon.server.osgiService('org.wso2.carbon.core.services.callback.LoginSubscriptionManagerService'),
configReg = server.systemRegistry(tenantId).registry.getChrootedRegistry("/_system/config"),
domain = carbon.server.tenantDomain({
tenantId: tenantId
});
loginManager.triggerEvent(configReg, user.username, tenantId, domain);
});
exports.unbind = function(el, type, fn, capture){
if (!isCollection(el)) {
events.unbind(el, type, fn, capture);
} else if ( el && el[0] !== undefined ) {
for ( var i = 0; i < el.length; i++ ) {
events.unbind(el[i], type, fn, capture);
}
}
};
});
exports.unbind = function(el, type, fn, capture){
if (!isCollection(el)) {
events.unbind(el, type, fn, capture);
} else if ( el && el[0] !== undefined ) {
for ( var i = 0; i < el.length; i++ ) {
events.unbind(el[i], type, fn, capture);
}
}
};
});
exports.bind = function(el, type, fn, capture){
if (!isCollection(el)) {
events.bind(el, type, fn, capture);
} else if ( el && el[0] !== undefined ) {
for ( var i = 0; i < el.length; i++ ) {
events.bind(el[i], type, fn, capture);
}
}
};