Mercurial > p > roundup > code
comparison roundup/admin.py @ 928:23c9d4f86380
Added the web access and email access permissions..
...so people can restrict access to users who register through the
email interface (for example). Also added "security" command to the
roundup-admin interface to display the Role/Permission config for an
instance.
| author | Richard Jones <richard@users.sourceforge.net> |
|---|---|
| date | Thu, 01 Aug 2002 00:56:22 +0000 |
| parents | b0d3d3535998 |
| children | f3e978888cb8 |
comparison
equal
deleted
inserted
replaced
| 927:51519406b73e | 928:23c9d4f86380 |
|---|---|
| 14 # BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS | 14 # BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS |
| 15 # FOR A PARTICULAR PURPOSE. THE CODE PROVIDED HEREUNDER IS ON AN "AS IS" | 15 # FOR A PARTICULAR PURPOSE. THE CODE PROVIDED HEREUNDER IS ON AN "AS IS" |
| 16 # BASIS, AND THERE IS NO OBLIGATION WHATSOEVER TO PROVIDE MAINTENANCE, | 16 # BASIS, AND THERE IS NO OBLIGATION WHATSOEVER TO PROVIDE MAINTENANCE, |
| 17 # SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. | 17 # SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. |
| 18 # | 18 # |
| 19 # $Id: admin.py,v 1.19 2002-07-25 07:14:05 richard Exp $ | 19 # $Id: admin.py,v 1.20 2002-08-01 00:56:22 richard Exp $ |
| 20 | 20 |
| 21 import sys, os, getpass, getopt, re, UserDict, shlex, shutil | 21 import sys, os, getpass, getopt, re, UserDict, shlex, shutil |
| 22 try: | 22 try: |
| 23 import csv | 23 import csv |
| 24 except ImportError: | 24 except ImportError: |
| 246 templates = roundup.templates.listTemplates() | 246 templates = roundup.templates.listTemplates() |
| 247 print _('Templates:'), ', '.join(templates) | 247 print _('Templates:'), ', '.join(templates) |
| 248 import roundup.backends | 248 import roundup.backends |
| 249 backends = roundup.backends.__all__ | 249 backends = roundup.backends.__all__ |
| 250 print _('Back ends:'), ', '.join(backends) | 250 print _('Back ends:'), ', '.join(backends) |
| 251 | |
| 252 | 251 |
| 253 def do_install(self, instance_home, args): | 252 def do_install(self, instance_home, args): |
| 254 '''Usage: install [template [backend [admin password]]] | 253 '''Usage: install [template [backend [admin password]]] |
| 255 Install a new Roundup instance. | 254 Install a new Roundup instance. |
| 256 | 255 |
| 979 ''' | 978 ''' |
| 980 self.db.indexer.force_reindex() | 979 self.db.indexer.force_reindex() |
| 981 self.db.reindex() | 980 self.db.reindex() |
| 982 return 0 | 981 return 0 |
| 983 | 982 |
| 983 def do_security(self, args): | |
| 984 '''Usage: security [Role name] | |
| 985 Display the Permissions available to one or all Roles. | |
| 986 ''' | |
| 987 if len(args) == 1: | |
| 988 role = args[0] | |
| 989 try: | |
| 990 roles = [(args[0], self.db.security.role[args[0]])] | |
| 991 except KeyError: | |
| 992 print _('No such Role "%(role)s"')%locals() | |
| 993 return 1 | |
| 994 else: | |
| 995 roles = self.db.security.role.items() | |
| 996 roles.sort() | |
| 997 for rolename, role in roles: | |
| 998 print _('Role "%(name)s":')%role.__dict__ | |
| 999 for permission in role.permissions: | |
| 1000 if permission.klass: | |
| 1001 print _(' %(description)s (%(name)s for "%(klass)s" ' | |
| 1002 'only)')%permission.__dict__ | |
| 1003 else: | |
| 1004 print _(' %(description)s (%(name)s)')%permission.__dict__ | |
| 1005 return 0 | |
| 1006 | |
| 984 def run_command(self, args): | 1007 def run_command(self, args): |
| 985 '''Run a single command | 1008 '''Run a single command |
| 986 ''' | 1009 ''' |
| 987 command = args[0] | 1010 command = args[0] |
| 988 | 1011 |
| 1129 tool = AdminTool() | 1152 tool = AdminTool() |
| 1130 sys.exit(tool.main()) | 1153 sys.exit(tool.main()) |
| 1131 | 1154 |
| 1132 # | 1155 # |
| 1133 # $Log: not supported by cvs2svn $ | 1156 # $Log: not supported by cvs2svn $ |
| 1157 # Revision 1.19 2002/07/25 07:14:05 richard | |
| 1158 # Bugger it. Here's the current shape of the new security implementation. | |
| 1159 # Still to do: | |
| 1160 # . call the security funcs from cgi and mailgw | |
| 1161 # . change shipped templates to include correct initialisation and remove | |
| 1162 # the old config vars | |
| 1163 # ... that seems like a lot. The bulk of the work has been done though. Honest :) | |
| 1164 # | |
| 1134 # Revision 1.18 2002/07/18 11:17:30 gmcm | 1165 # Revision 1.18 2002/07/18 11:17:30 gmcm |
| 1135 # Add Number and Boolean types to hyperdb. | 1166 # Add Number and Boolean types to hyperdb. |
| 1136 # Add conversion cases to web, mail & admin interfaces. | 1167 # Add conversion cases to web, mail & admin interfaces. |
| 1137 # Add storage/serialization cases to back_anydbm & back_metakit. | 1168 # Add storage/serialization cases to back_anydbm & back_metakit. |
| 1138 # | 1169 # |
