Login | Register
My pages Projects Community openCollabNet

Discussions > commits > svn commit: r311 - trunk: current current/api current/db cwebapp/cwebapp cwebapp/cwebapp/templates

Project highlights: Stable Version: 1.6.1, Development Version: 1.7.6

current
Discussion topic

Back to topic list

svn commit: r311 - trunk: current current/api current/db cwebapp/cwebapp cwebapp/cwebapp/templates

Reply

Author jjneely
Full name Jack Neely
Date 2006-11-04 15:30:24 PST
Message Author: jjneely
Date: 2006-11-04 15:30:24-0800
New Revision: 311

Added:
   trunk/cwebapp/cwebap​p/templates/policy.k​id
Modified:
   trunk/current/api/policy.py
   trunk/current/db/ou.py
   trunk/current/ou.py
   trunk/cwebapp/cwebap​p/controllers.py
   trunk/cwebapp/cwebap​p/templates/master.k​id

Log:
The start of a Policy page with the OU tree displayed


Modified: trunk/current/api/policy.py
Url: http://current.tigri​s.org/source/browse/​current/trunk/curren​t/api/policy.py?view​=diff&rev=311​&p1=trunk/current/a​pi/policy.py&p2=​trunk/current/api/po​licy.py&r1=310​&r2=311
====================​====================​====================​==================
--- trunk/current/api/policy.py (original)
+++ trunk/current/api/policy.py 2006-11-04 15:30:24-0800
@@ -28,6 +28,9 @@
     'createUser',
     'showTree',
     'createOU',
+ 'myOU',
+ 'profilesOfOU',
+ 'countProfilesOfOU',
     ]
 
 def login(username, password):
@@ -50,13 +53,13 @@
     # Will raise exception if username already exists.
     return True
 
-def showTree(sess):
+def showTree(sess, root=None):
     u = SessionUser(sess)
     if not u.isValid():
         return xmlrpclib.Fault(EAUTH, "Bad session. Please login.")
 
     oulib = OU()
- return oulib.showTree()
+ return oulib.showTree(root)
 
 def createOU(sess, parent, label, description):
     u = SessionUser(sess)
@@ -66,4 +69,28 @@
     oulib = OU()
     return oulib.createOU(parent, label, description)
 
+def myOU(sess):
+ "Return this users default OU."
+ u = SessionUser(sess)
+ if not u.isValid():
+ return xmlrpclib.Fault(EAUTH, "Bad session. Please login.")
+
+ return u.ou
+
+def profilesOfOU(sess, ou):
+ u = SessionUser(sess)
+ if not u.isValid():
+ return xmlrpclib.Fault(EAUTH, "Bad session. Please login.")
+
+ oulib = OU()
+ return oulib.profilesOfOU(ou)
+
+def countProfilesOfOU(sess, ou):
+ u = SessionUser(sess)
+ if not u.isValid():
+ return xmlrpclib.Fault(EAUTH, "Bad session. Please login.")
+
+ oulib = OU()
+ return oulib.countProfilesOfOU(ou)\
+
 ## END OF LINE ##

Modified: trunk/current/db/ou.py
Url: http://current.tigri​s.org/source/browse/​current/trunk/curren​t/db/ou.py?view=diff​&rev=311&p1=​trunk/current/db/ou.​py&p2=trunk/curr​ent/db/ou.py&r1=​310&r2=311
====================​====================​====================​==================
--- trunk/current/db/ou.py (original)
+++ trunk/current/db/ou.py 2006-11-04 15:30:24-0800
@@ -129,7 +129,7 @@
         if root == None:
             raise CurrentOUError("Invalid OU ID.")
 
- q = """select node.label, node.ou_id,
+ q = """select node.label, node.ou_id, node.description,
                   (count(parent.label) - (sub_tree.depth + 1)) as depth
                from OU as node,
                   OU as parent,
@@ -150,3 +150,16 @@
 
         self.cursor.execute(q, (root,))
         return resultSet(self.cursor).dump()
+
+ def profilesOfOU(self, ou):
+ ou = self.getOUID(ou)
+ q = "select profile_id, name from PROFILE where ou_id = %s"
+ self.cursor.execute(q, (ou,))
+ return resultSet(self.cursor).dump()
+
+ def countProfilesOfOU(self, ou):
+ ou = self.getOUID(ou)
+ q = "select count(*) from PROFILE where ou_id = %s"
+ self.cursor.execute(q, (ou,))
+ return self.cursor.fetchone()[0]
+

Modified: trunk/current/ou.py
Url: http://current.tigri​s.org/source/browse/​current/trunk/curren​t/ou.py?view=diff​&rev=311&p1=tru​nk/current/ou.py​&p2=trunk/current/ou​.py&r1=310&r​2=311
====================​====================​====================​==================
--- trunk/current/ou.py (original)
+++ trunk/current/ou.py 2006-11-04 15:30:24-0800
@@ -47,3 +47,10 @@
             user = self.db.getRootID()
         return self.db.subTree(user)
 
+ def profilesOfOU(self, ou):
+ ou = self.db.getOUID(ou)
+ return self.db.profileOfOU(ou)
+
+ def countProfilesOfOU(self, ou):
+ ou = self.db.getOUID(ou)
+ return self.db.countProfilesOfOU(ou)

Modified: trunk/cwebapp/cwebap​p/controllers.py
Url: http://current.tigri​s.org/source/browse/​current/trunk/cwebap​p/cwebapp/controller​s.py?view=diff&r​ev=311&p1=trunk/​cwebapp/cwebapp/cont​rollers.py&p2=tr​unk/cwebapp/cwebapp/​controllers.py&r​1=310&r2=311
====================​====================​====================​==================
--- trunk/cwebapp/cwebap​p/controllers.py (original)
+++ trunk/cwebapp/cwebap​p/controllers.py 2006-11-04 15:30:24-0800
@@ -7,27 +7,35 @@
 class SubDir(object):
 
     def __init__(self, api):
- self.__api = api
+ self._api = api
 
 class Policy(SubDir):
 
     @turbogears.expose(h​tml="cwebapp.templat​es.policy")
     @auth.needsLogin
     def index(self, userInfo):
- myOU = foo
+ myOU = self._api.policy.myO​U(userInfo['session'​])
+ tree = self._api.policy.sho​wTree(userInfo['sess​ion'])
+
+ for row in tree:
+ clients = self._api.policy.cou​ntProfilesOfOU(userI​nfo['session'],
+ row['ou_id'])
+ row['num_clients'] = clients
+
+ return dict(OU=myOU, tree=tree)
 
 class Systems(SubDir):
 
     @turbogears.expose(h​tml="cwebapp.templat​es.systems")
     @auth.needsLogin
     def index(self, userInfo):
- systems = self.__api.cadmin.fi​ndProfile(userInfo['​session'])
+ systems = self._api.cadmin.fin​dProfile(userInfo['s​ession'])
         return dict(systems=systems)
 
     @turbogears.expose(h​tml="cwebapp.templat​es.systemDetail")
     @auth.needsLogin
     def details(self, userInfo, profileID):
- system = self.__api.systems.s​ystemDetail(userInfo​['session'],
+ system = self._api.systems.sy​stemDetail(userInfo[​'session'],
                                                 profileID)
         return dict(system=system)
 
@@ -36,13 +44,13 @@
     @turbogears.expose(h​tml="cwebapp.templat​es.channels")
     @auth.needsLogin
     def index(self, userInfo):
- channels = self.__api.channels.​listChannels(userInf​o['session'])
+ channels = self._api.channels.l​istChannels(userInfo​['session'])
         return dict(channels=channels)
 
     @turbogears.expose(h​tml="cwebapp.templat​es.channelDetail")
     @auth.needsLogin
     def detail(self, userInfo, label):
- detail = self.__api.channels.​getChannelDetail(use​rInfo['session'],
+ detail = self._api.channels.g​etChannelDetail(user​Info['session'],
                                                       label)
         return dict(channel=detail)
 
@@ -50,19 +58,20 @@
 
     def __init__(self):
         controllers.Root.__init__(self)
- self.__api = xmlrpclib.Server(che​rrypy.config.get("cu​rrent"))
+ self._api = xmlrpclib.Server(che​rrypy.config.get("cu​rrent"))
 
- self.systems = Systems(self.__api)
- self.channels = Channels(self.__api)
+ self.systems = Systems(self._api)
+ self.channels = Channels(self._api)
+ self.policy = Policy(self._api)
 
     def doLoginCall(self, userid, password):
- return self.__api.policy.login(userid, password)
+ return self._api.policy.login(userid, password)
 
     @turbogears.expose(h​tml="cwebapp.templat​es.index")
     @auth.needsLogin
     def index(self, userInfo):
         print userInfo
- return dict(systemTotal=sel​f.__api.systems.syst​emCount(
+ return dict(systemTotal=sel​f._api.systems.syste​mCount(
                     userInfo['session']),
                     userID=userInfo['userid'])
 

Modified: trunk/cwebapp/cwebap​p/templates/master.k​id
Url: http://current.tigri​s.org/source/browse/​current/trunk/cwebap​p/cwebapp/templates/​master.kid?view=diff​&rev=311&p1=​trunk/cwebapp/cwebap​p/templates/master.k​id&p2=trunk/cweb​app/cwebapp/template​s/master.kid&r1=​310&r2=311
====================​====================​====================​==================
--- trunk/cwebapp/cwebap​p/templates/master.k​id (original)
+++ trunk/cwebapp/cwebap​p/templates/master.k​id 2006-11-04 15:30:24-0800
@@ -32,6 +32,9 @@
         <li class="navlink">
           <a href="${std.url('/c​hannels')}">Chann​els</a>
         </li>
+ <li class="navlink">
+ <a href="${std.url('/p​olicy')}">Policy​</a>
+ </li>
 
         <li class="help">
           <a href="http://current.tigris.org">Current Home</a>

Added: trunk/cwebapp/cwebap​p/templates/policy.k​id
Url: http://current.tigri​s.org/source/browse/​current/trunk/cwebap​p/cwebapp/templates/​policy.kid?view=auto​&rev=311
====================​====================​====================​==================
--- (empty file)
+++ trunk/cwebapp/cwebap​p/templates/policy.k​id 2006-11-04 15:30:24-0800
@@ -0,0 +1,38 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR​/xhtml1/DTD/xhtml1-t​ransitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" xmlns:py="http://purl.org/kid/ns#"
+ py:extends="'master.kid'">
+
+<head>
+ <meta content="text/html; charset=UTF-8" http-equiv="content-type" py:replace="''"/>
+ <link rel="stylesheet" type="text/css" charset="utf-8"
+ href="${tg.url('/st​atic/css/current.css​')}" />
+ <title>Current​</title>
+</head>
+
+<body>
+ <h1>Client Hieracracy and Permissions</h1>
+
+ <p>My OU is <span py:replace="OU">F​oo</span></​p>
+
+ <table class="tabledata">
+ <tr><th>OU Label</th><​th>Description​</th><th>At​tached Clients</th></tr>
+ <tr py:for="i, row in enumerate(tree)"
+ class="${i%2 and 'oddrow' or 'evenrow'}">
+
+ <td>
+ <span py:replace="'&nb​sp;&nbsp;&nb​sp;'*row['depth']"​></span>
+ <img src="${tg.url('/sta​tic/images/favicon.i​co')}" />
+ <span py:replace="row['label']">OU Label</span>
+ </td>
+
+ <td py:content="row['des​cription']">
+ </td>
+
+ <td py:content="row['num​_clients']">
+ </td>
+
+ </tr>
+ </table>
+
+</body>
+</html>

« Previous message in topic | 1 of 1 | Next message in topic »

Messages

Show all messages in topic

svn commit: r311 - trunk: current current/api current/db cwebapp/cwebapp cwebapp/cwebapp/templates jjneely Jack Neely 2006-11-04 15:30:24 PST
Messages per page: