Trees | Indices | Help |
|
---|
|
1 ########################################################################### 2 # 3 # This program is part of Zenoss Core, an open source monitoring platform. 4 # Copyright (C) 2007, Zenoss Inc. 5 # 6 # This program is free software; you can redistribute it and/or modify it 7 # under the terms of the GNU General Public License version 2 as published by 8 # the Free Software Foundation. 9 # 10 # For complete information please visit: http://www.zenoss.com/oss/ 11 # 12 ########################################################################### 13 """ 14 AdministrativeRoleable.py 15 16 Created by Marc Irlandez on 2007-04-05. 17 """ 18 19 import types 20 from AccessControl import ClassSecurityInfo 21 from Products.ZenModel.AdministrativeRole import AdministrativeRole 22 from Globals import InitializeClass 23 from ZenossSecurity import * 2426 27 security = ClassSecurityInfo() 28 29 security.declareProtected(ZEN_ADMINISTRATORS_VIEW, 30 'getAdministrativeRoles') 34 35 security.declareProtected(ZEN_ADMINISTRATORS_EDIT, 36 'manage_addAdministrativeRole')90 91 92 InitializeClass(AdministrativeRoleable) 9338 "Add a Admin Role to this device" 39 us = self.ZenUsers.getUserSettings(newId) 40 AdministrativeRole(us, self) 41 self.setAdminLocalRoles() 42 if REQUEST: 43 if us: 44 REQUEST['message'] = "Administrative Role Added" 45 return self.callZenScreen(REQUEST)46 47 security.declareProtected(ZEN_ADMINISTRATORS_EDIT, 48 'manage_editAdministrativeRoles')51 """Edit list of admin roles. 52 """ 53 if type(ids) in types.StringTypes: 54 ids = [ids] 55 role = [role] 56 level = [level] 57 for i, id in enumerate(ids): 58 ar = self.adminRoles._getOb(id) 59 ar.update(role[i], level[i]) 60 self.setAdminLocalRoles() 61 if REQUEST: 62 REQUEST['message'] = "Administrative Roles Updated" 63 return self.callZenScreen(REQUEST)64 65 66 security.declareProtected(ZEN_ADMINISTRATORS_EDIT, 67 'manage_deleteAdministrativeRole')69 "Delete a admin role to this device" 70 if type(delids) in types.StringTypes: 71 delids = [delids] 72 for userid in delids: 73 ar = self.adminRoles._getOb(userid, None) 74 if ar is not None: ar.delete() 75 self.manage_delLocalRoles((userid,)) 76 self.setAdminLocalRoles() 77 if REQUEST: 78 if delids: 79 REQUEST['message'] = "Administrative Roles Deleted" 80 return self.callZenScreen(REQUEST)8183 """List the user and their roles on an object""" 84 return [ (ar.id, (ar.role,)) for ar in self.adminRoles() ]85 86
Trees | Indices | Help |
|
---|
Generated by Epydoc 3.0beta1 on Thu Oct 25 16:28:21 2007 | http://epydoc.sourceforge.net |