rbrindley: branch rbrindley/astman_revamp r4587 - /team/rbrindley/astman_reva...

SVN commits to the Asterisk-GUI project asterisk-gui-commits at lists.digium.com
Thu Mar 5 12:36:47 CST 2009


Author: rbrindley
Date: Thu Mar  5 12:36:44 2009
New Revision: 4587

URL: http://svn.digium.com/svn-view/asterisk-gui?view=rev&rev=4587
Log:

- copied astman_manageusers.addUser to pbx.users.add


Modified:
    team/rbrindley/astman_revamp/config/js/pbx2.js

Modified: team/rbrindley/astman_revamp/config/js/pbx2.js
URL: http://svn.digium.com/svn-view/asterisk-gui/team/rbrindley/astman_revamp/config/js/pbx2.js?view=diff&rev=4587&r1=4586&r2=4587
==============================================================================
--- team/rbrindley/astman_revamp/config/js/pbx2.js (original)
+++ team/rbrindley/astman_revamp/config/js/pbx2.js Thu Mar  5 12:36:44 2009
@@ -96,6 +96,56 @@
  */
 pbx.users = {};
 
+/**
+ * Add a user.
+ * This function adds a user to the system, updating the gui's cache first
+ * and then Asterisk.
+ * WARNING: This function also deletes any existing user with the same exten.
+ * @param exten The user's extension.
+ * @param info All the properties of the user.
+ * @param callback The callback function once the user has been added.
+ */
+pbx.users.add = function(exten, info, callback) {
+	userinfo = ASTGUI.toCustomObject(userinfo);
+
+	var disallow = info.getProperty('disallow') || 'all';
+	var allow = info.getProperty('allow') || 'all';
+	sessionData.pbxinfo['users'][exten] = userinfo;
+	sessionData.pbxinfo['users'][exten]['disallow'] = disallow;
+	sessionData.pbxinfo['users'][exten]['allow'] = allow;
+	sessionData.pbxinfo['users'][exten]['mailbox'] = info.mailbox || exten;
+	sessionData.pbxinfo['users'][exten]['call-limit'] = '100';
+
+	delete info.disallow;
+	delete info.allow;
+
+	var x = new listOfActions();
+	x.filename('users.conf');
+	x.new_action('delcat', exten, '', '');
+	x.new_action('newcat', exten, '', '');
+	x.new_action('append', exten, 'username', exten);
+	x.new_action('append', exten, 'transfer', 'yes');
+	x.new_action('append', exten, 'disallow', disallow);
+	x.new_action('append', exten, 'allow', allow);
+	x.new_action('append', exten, 'mailbox', info.mailbox || exten);
+	x.new_action('append', exten, 'call-limit', '100');
+
+	if (info.mailbox) {
+		delete info.mailbox;
+	}
+
+	if (info.hasOwnProperty('hassip') && info['hassip'].isAstTrue()) {
+		x.new_action('append', exten, 'host', dynamic);
+	}
+
+	for (var prop in info) {
+		if (info.hasOwnProperty(prop)) {
+			x.new_action('append', exten, prop, info[prop]);
+		}
+	}
+
+	x.callActions(callback);
+};
 /**
  * Get User Details
  * @param user The user to get.




More information about the asterisk-gui-commits mailing list