| 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 or (at your
8 # option) any later version as published by the Free Software Foundation.
9 #
10 # For complete information please visit: http://www.zenoss.com/oss/
11 #
12 ###########################################################################
13
14 import logging
15 log = logging.getLogger("zen.triggers")
16
17 from Globals import InitializeClass
18 from Globals import DTMLFile
19 from AccessControl import ClassSecurityInfo
20 from AdministrativeRoleable import AdministrativeRoleable
21 from Products.ZenModel.ZenossSecurity import *
22 from Products.ZenRelations.RelSchema import *
23 from Products.ZenModel.ZenModelRM import ZenModelRM
24 from zope.interface import implements
25 from Products.ZenUtils.guid.interfaces import IGloballyIdentifiable
26
27
29
30
32 """Create the trigger manager."""
33 tm = TriggerManager(TriggerManager.root)
34 context._setObject(TriggerManager.root, tm)
35 if REQUEST is not None:
36 REQUEST['RESPONSE'].redirect(context.absolute_url() + '/manage_main')
37
39 """Manage triggers."""
40
41 _id = "TriggerManager"
42 root = 'Triggers'
43 meta_type = _id
44
45 sub_meta_types = ("Trigger",)
46
47 factory_type_information = (
48 {
49 'id' : _id,
50 'meta_type' : _id,
51 'description' : """Management of triggers""",
52 'icon' : 'UserSettingsManager.gif',
53 'product' : 'ZenModel',
54 'factory' : 'manage_addTriggerManager',
55 'immediate_view' : 'editSettings',
56 'actions' : (
57 {
58 'id' : 'settings',
59 'name' : 'Settings',
60 'action' : '../editSettings',
61 'permissions' : ( ZEN_MANAGE_DMD, )
62 })
63 },
64 )
65
66 addTrigger = DTMLFile('dtml/addTrigger',globals())
67
68
70 """Create a trigger"""
71 ns = Trigger(id, title)
72 context._setObject(id, ns)
73 if REQUEST:
74 REQUEST['RESPONSE'].redirect(context.absolute_url() + '/manage_main')
75
77 """
78 A stub object that is used for managing permissions.
79 """
80 implements(IGloballyIdentifiable)
81 security = ClassSecurityInfo()
82
83 _id = "Trigger"
84 meta_type = _id
85
86 _properties = ZenModelRM._properties
87
88 _relations = (
89 ("adminRoles",
90 ToManyCont(
91 ToOne,
92 "Products.ZenModel.AdministrativeRole",
93 "managedObject"
94 )),
95 )
96
97 factory_type_information = (
98 {
99 'id' : _id,
100 'meta_type' : _id,
101 'description' : """Stub object representing a trigger.""",
102 'icon' : 'ActionRule.gif',
103 'product' : 'ZenEvents',
104 'factory' : 'manage_addTrigger',
105 'immediate_view' : 'editTrigger',
106 'actions' :(
107 {
108 'id' : 'edit',
109 'name' : 'Edit',
110 'action' : 'editTrigger',
111 'permissions' : (ZEN_CHANGE_ALERTING_RULES,)
112 }
113 )
114 },
115 )
116
117 # a property storing user permission mappings
118 users = []
119
121 self.globalRead = False
122 self.globalWrite = False
123 self.globalManage = False
124
125 self.userRead = False
126 self.userWrite = False
127 self.userManage = False
128
129 super(ZenModelRM, self).__init__(id, title=title, buildRelations=buildRelations)
130
131 security.declareProtected(ZEN_CHANGE_ALERTING_RULES, 'manage_editTrigger')
135
136 InitializeClass(TriggerManager)
137 InitializeClass(Trigger)
138
| Trees | Indices | Help |
|
|---|
| Generated by Epydoc 3.0.1.1812 on Tue Oct 11 12:51:45 2011 | http://epydoc.sourceforge.net |