[asterisk-commits] branch oej/astum r10269 - in /team/oej/astum: ./ configs/ include/asterisk/ res/

asterisk-commits at lists.digium.com asterisk-commits at lists.digium.com
Thu Feb 16 01:08:39 MST 2006


Author: oej
Date: Thu Feb 16 02:08:34 2006
New Revision: 10269

URL: http://svn.digium.com/view/asterisk?rev=10269&view=rev
Log:
- Adding more configuration parameters for groups
- Adding manager permissions to configuration, making manager.c functions public in order to handle this
- Adding manager read/write permissions to groups and users

Still need to figure out a strategy for realtime groups - we need to cache them in memory
as long as we have users, but how do I handle changes in the group table in the db meanwhile?


Modified:
    team/oej/astum/configs/extconfig.conf.sample
    team/oej/astum/include/asterisk/astum.h
    team/oej/astum/include/asterisk/manager.h
    team/oej/astum/manager.c
    team/oej/astum/res/res_astum.c

Modified: team/oej/astum/configs/extconfig.conf.sample
URL: http://svn.digium.com/view/asterisk/team/oej/astum/configs/extconfig.conf.sample?rev=10269&r1=10268&r2=10269&view=diff
==============================================================================
--- team/oej/astum/configs/extconfig.conf.sample (original)
+++ team/oej/astum/configs/extconfig.conf.sample Thu Feb 16 02:08:34 2006
@@ -42,6 +42,8 @@
 ;example => odbc,asterisk,alttable
 ;example2 => ldap,"dc=oxymium,dc=net",example2
 ;
+;aumusers => mysql,asterisk
+;aumgroups => mysql,asterisk
 ;iaxusers => odbc,asterisk
 ;iaxpeers => odbc,asterisk
 ;sipusers => odbc,asterisk

Modified: team/oej/astum/include/asterisk/astum.h
URL: http://svn.digium.com/view/asterisk/team/oej/astum/include/asterisk/astum.h?rev=10269&r1=10268&r2=10269&view=diff
==============================================================================
--- team/oej/astum/include/asterisk/astum.h (original)
+++ team/oej/astum/include/asterisk/astum.h Thu Feb 16 02:08:34 2006
@@ -132,7 +132,8 @@
 	AUM_CNF_CID,			/*!< Caller ID */
 	AUM_CNF_CALLERPRES,		/*!< Caller ID presentation when making calls */
 	AUM_CNF_ACCOUNTCODE,		/*!< Account code for this user */
-	AUM_CNF_MANAGERACCESS,		/*!< Manager access something */
+	AUM_CNF_MANAGER_WACCESS,	/*!< Manager write access */
+	AUM_CNF_MANAGER_RACCESS,	/*!< Manager read access */
 	AUM_CNF_SECRET,			/*!< Secret (password) */
 	AUM_CNF_PIN,			/*!< Pin code for authorization by DTMF */
 	AUM_CNF_CALLGROUP,		/*!< Calling group */
@@ -314,6 +315,7 @@
 	char secret[80];		/*!< Secret for this user */
 	char ldapdn[180];		/*!< LDAP DN */
 	char registrar[20];		/*!< Who added this object? */
+	char timezone[80];		/*!< Time zone (voicemail.conf) */
 	ast_group_t callgroup;			/*!< Calling group for calls */
 	ast_group_t pickupgroup;		/*!< Pickup group */
 	struct ast_variable *chanvars;	/*!< Default channel variables */
@@ -324,7 +326,8 @@
 	struct aum_devicelist devices;		/*!< Linked list of devices active for this user */
 	struct ast_ha	*acl;			/*!< Access control list for user */
 						/*!< The highest priority is used as primary group for setting default values */
-	int managerperm;			/*!< If sat, this user can log in to manager with these permissions */
+	int manager_read_perm;			/*!< If set, this user can log in to manager with these permissions */
+	int manager_write_perm;			/*!< If set, this user can log in to manager with these permissions */
 };
 
 /*! \brief the AUM group definition */
@@ -337,11 +340,13 @@
 	char musicclass[MAX_MUSICCLASS];	/*!< Default musicclass for this group */
 	ast_group_t callgroup;			/*!< Calling group for calls */
 	ast_group_t pickupgroup;		/*!< Pickup group */
-	int managerperm;			/*!< This group's permissions in manager */
+	int manager_read_perm;			/*!< If set, this group can log in to manager with these permissions */
+	int manager_write_perm;			/*!< If set, this group can log in to manager with these permissions */
 	struct aum_user_contextlist contexts;	/*!< Linked list of contexts this group use */
 	struct ast_variable *chanvars;
 	struct ast_ha	*acl;			/*!< Access control list for user */
 	char *description;			/*!< Description */
+	char timezone[80];		/*!< Time zone (voicemail.conf) */
 	struct aum_user_grouplist members;	/*!< Members list */
 	char registrar[20];		/*!< Who added this object? */
 };

Modified: team/oej/astum/include/asterisk/manager.h
URL: http://svn.digium.com/view/asterisk/team/oej/astum/include/asterisk/manager.h?rev=10269&r1=10268&r2=10269&view=diff
==============================================================================
--- team/oej/astum/include/asterisk/manager.h (original)
+++ team/oej/astum/include/asterisk/manager.h Thu Feb 16 02:08:34 2006
@@ -169,4 +169,12 @@
 /*! Called by Asterisk initialization */
 extern int reload_manager(void);
 
+/* \brief Convert permission string to integer 
+	\param instr Manager permission string
+*/
+int get_perm(char *instr);
+
+/*! \brief Convert authority code to string with serveral options */
+char *authority_to_str(int authority, char *res, int reslen);
+
 #endif /* _ASTERISK_MANAGER_H */

Modified: team/oej/astum/manager.c
URL: http://svn.digium.com/view/asterisk/team/oej/astum/manager.c?rev=10269&r1=10268&r2=10269&view=diff
==============================================================================
--- team/oej/astum/manager.c (original)
+++ team/oej/astum/manager.c Thu Feb 16 02:08:34 2006
@@ -142,7 +142,7 @@
 }
 
 /*! authority_to_str: Convert authority code to string with serveral options */
-static char *authority_to_str(int authority, char *res, int reslen)
+char *authority_to_str(int authority, char *res, int reslen)
 {
 	int running_total = 0, i;
 	memset(res, 0, reslen);
@@ -417,7 +417,7 @@
 	return 0;
 }
 
-static int get_perm(char *instr)
+int get_perm(char *instr)
 {
 	int x = 0, ret = 0;
 

Modified: team/oej/astum/res/res_astum.c
URL: http://svn.digium.com/view/asterisk/team/oej/astum/res/res_astum.c?rev=10269&r1=10268&r2=10269&view=diff
==============================================================================
--- team/oej/astum/res/res_astum.c (original)
+++ team/oej/astum/res/res_astum.c Thu Feb 16 02:08:34 2006
@@ -518,6 +518,11 @@
 	ast_cli(fd, " Language:       %s\n", user->language);
 	ast_cli(fd, " Mailbox:        %s\n", user->mailbox);
 	ast_cli(fd, " ACL:            %s\n", (user->acl?"Yes (IP address restriction)":"No"));
+	if (user->manager_write_perm || user->manager_read_perm) {
+		char permbuf[120];
+		ast_cli(fd, " Manager write:  %s\n", authority_to_str(user->manager_write_perm, permbuf, sizeof(permbuf)));
+		ast_cli(fd, " Manager read:  %s\n", authority_to_str(user->manager_read_perm, permbuf, sizeof(permbuf)));
+	}
 	if (user->chanvars) {
 		struct ast_variable *v;
  		ast_cli(fd, "  Variables    :\n");
@@ -582,6 +587,11 @@
 	ast_cli(fd, " Music class:    %s\n", group->musicclass);
 	ast_cli(fd, " Language:       %s\n", group->language);
 	ast_cli(fd, " ACL:            %s\n", (group->acl?"Yes (IP address restriction)":"No"));
+	if (group->manager_write_perm || group->manager_read_perm) {
+		char permbuf[120];
+		ast_cli(fd, " Manager write:  %s\n", authority_to_str(group->manager_write_perm, permbuf, sizeof(permbuf)));
+		ast_cli(fd, " Manager read:  %s\n", authority_to_str(group->manager_read_perm, permbuf, sizeof(permbuf)));
+	}
 	if (group->chanvars) {
 		struct ast_variable *v;
  		ast_cli(fd, "  Variables    :\n");
@@ -869,7 +879,8 @@
 	{ AUM_CNF_CID,		"callerid" 	,AUM_CONFOBJ_USER },
 	{ AUM_CNF_CALLERPRES,	"callerpres" 	,AUM_CONFOBJ_USER & AUM_CONFOBJ_GROUP },
 	{ AUM_CNF_ACCOUNTCODE,	"accountcode" 	,AUM_CONFOBJ_USER & AUM_CONFOBJ_GROUP },
-	{ AUM_CNF_MANAGERACCESS,"managerperm" 	,AUM_CONFOBJ_USER & AUM_CONFOBJ_GROUP },
+	{ AUM_CNF_MANAGER_RACCESS,"managerread" ,AUM_CONFOBJ_USER & AUM_CONFOBJ_GROUP },
+	{ AUM_CNF_MANAGER_WACCESS,"managerwrite",AUM_CONFOBJ_USER & AUM_CONFOBJ_GROUP },
 	{ AUM_CNF_SECRET,	"secret" 	,AUM_CONFOBJ_USER },
 	{ AUM_CNF_IAX2KEY,	"iax2key" 	,AUM_CONFOBJ_USER },
 	{ AUM_CNF_MUSICCLASS,	"musicclass" 	,AUM_CONFOBJ_USER & AUM_CONFOBJ_GROUP },
@@ -1219,12 +1230,16 @@
 				ast_log(LOG_ERROR, "Address %s not added for user %s\n", x->value, username);
 			break;
 		case AUM_CNF_VMAILBOX:
+			if (!ast_strlen_zero(x->value))
+				ast_copy_string(user->mailbox, x->value, sizeof(user->mailbox));
 			break;
 		case AUM_CNF_GROUP:
 			if (add_user_to_group(find_aum_group_by_name(x->value), user) < 0)
 				ast_log(LOG_ERROR, "Could not add user %s to group %s\n", user->name, x->value);
 			break;
-		case AUM_CNF_CALLBACKEXT:
+		case AUM_CNF_CALLBACKEXT:	/* ??????? Which field ?????? */
+			if (!ast_strlen_zero(x->value))
+				ast_copy_string(user->default_exten, x->value, sizeof(user->default_exten));
 			break;
 		case AUM_CNF_DEFCONTEXT:
 		case AUM_CNF_SUBSCRIBECONTEXT:
@@ -1260,7 +1275,11 @@
 		case AUM_CNF_ACCOUNTCODE:
 			ast_copy_string(user->accountcode, x->value, sizeof(user->accountcode));
 			break;
-		case AUM_CNF_MANAGERACCESS:
+		case AUM_CNF_MANAGER_WACCESS:
+			user->manager_write_perm = get_perm(x->value);
+			break;
+		case AUM_CNF_MANAGER_RACCESS:
+			user->manager_read_perm = get_perm(x->value);
 			break;
 		case AUM_CNF_SECRET:
 			ast_copy_string(user->secret, x->value, sizeof(user->secret));
@@ -1296,7 +1315,7 @@
 			break;
 		case AUM_CNF_PERMIT:
 		case AUM_CNF_DENY:
-			// ACL
+			/* ACL */
 			user->acl = ast_append_ha(x->name, x->value, user->acl);
 			break;
 		case AUM_CNF_NUMID:
@@ -1383,15 +1402,41 @@
 		case AUM_CNF_SUBSCRIBECONTEXT:
 		case AUM_CNF_DISACONTEXT:
 		case AUM_CNF_PARKING:
-			break;
 			context = build_context(AUM_CONTEXT_NONE, option, x->value);
 			if (context)
 				AST_LIST_INSERT_TAIL(&group->contexts, context, list);
 			else
 				ast_log(LOG_ERROR, "Context %s not added for group %s\n", x->value, groupname);
 			break;
+		case AUM_CNF_MANAGER_WACCESS:
+			group->manager_write_perm = get_perm(x->value);
+			break;
+		case AUM_CNF_MANAGER_RACCESS:
+			group->manager_read_perm = get_perm(x->value);
+			break;
+		case AUM_CNF_MUSICCLASS:
+			ast_copy_string(group->musicclass, x->value, sizeof(group->musicclass));
+			break;
+		case AUM_CNF_LANGUAGE:
+			ast_copy_string(group->language, x->value, sizeof(group->language));
+			break;
 		case AUM_CNF_NOT_FOUND:
 			ast_log(LOG_NOTICE, "Configuration label unknown in AUM configuration: %s\n", x->name);
+			break;
+		case AUM_CNF_CALLGROUP:
+			group->callgroup = ast_get_group(x->value);
+			break;
+		case AUM_CNF_PICKUPGROUP:
+			group->pickupgroup = ast_get_group(x->value);
+			break;
+		case AUM_CNF_CHANVAR:
+			/* Set peer channel variable */
+			group->chanvars = add_variable_to_list(group->chanvars, x->value, NULL);
+			break;
+		case AUM_CNF_PERMIT:
+		case AUM_CNF_DENY:
+			/* ACL */
+			group->acl = ast_append_ha(x->name, x->value, group->acl);
 			break;
 		case AUM_CNF_NOT_VALID_FOR_OBJECT:
 			ast_log(LOG_NOTICE, "Configuration label not valid for group objects in AUM configuration: %s\n", x->name);



More information about the asterisk-commits mailing list