diff options
Diffstat (limited to 'server/modules/GACL_functions.py')
-rw-r--r-- | server/modules/GACL_functions.py | 64 |
1 files changed, 0 insertions, 64 deletions
diff --git a/server/modules/GACL_functions.py b/server/modules/GACL_functions.py deleted file mode 100644 index 147fa28..0000000 --- a/server/modules/GACL_functions.py +++ /dev/null @@ -1,64 +0,0 @@ -from adodb import * -from modules.client import * - -def get_client_groups(db,id) - #options. - option = 'NO_RECURSE' # * If $option == 'RECURSE' it will get all ancestor groups. defaults to only get direct parents. - # * @return array Array of Group ID #'s, or FALSE if Failed - print "get_object_groups(): Object ID: %s id Option: %s\n" % (id, option) - object_type = 'axo' - group_table = 'gacl_axo_groups' - map_table = 'gacl_groups_axo_map' - - if not id: - print "get_object_groups(): Object ID: (%s ) is empty, this is required" % str(id) - return false - - - if option == 'RECURSE': - query = """ - SELECT DISTINCT g.id AS group_id - FROM %s gm - LEFT JOIN %s g1 ON g1.id=gm.group_id - LEFT JOIN %s g ON g.lft<=g1.lft AND g.rgt>=g1.rgt - """ % (map_table,group_table,group_table) - else: - query = """ - SELECT gm.group_id - FROM %s gm - """ % map_table - - query += " WHERE gm.axo_id=%s " % str(id) - print query - cursor = db.conn.Execute(query) - #fixme error check the return - - while (not cursor.EOF): - row = cursor.FetchRow() - retarr.append(row[0]) - - return retarr - - - -# # Add the client into the gacl AXO table -# db.conn.Execute('LOCK TABLES `gacl_axo_seq` WRITE'); -# # we add one to get the next valid free id -# id = db.conn.GetRow('SELECT id FROM `gacl_axo_seq`')[0] + 1; -# result = db.conn.Execute('UPDATE `gacl_axo_seq` SET id=%s', id); -# db.conn.Execute('UNLOCK TABLES'); - -# result2 = db.conn.Execute('INSERT INTO `gacl_axo` (id,section_value,value,order_value,name,hidden) VALUES (%s,%s,%s,%s,%s,%s)', (id,'clients',client_info['hostname'],1,client_info['hostname'],0) ); - -def get_group_clients(db, group): - """This function gets the members of groups. Returns an array - containing those clients, empty otherwise""" - - # Missing recursive groups - members = [] - query = "SELECT axo_id FROM gacl_groups_axo_map WHERE group_id = %s" % group - print query - cursor = db.conn.Execute(query) - while (not cursor.EOF): - members.append(cursor.FetchRow()[0]) - return members |