| Trees | Indices | Help |
|
|---|
|
|
1 ##############################################################################
2 #
3 # Copyright (C) Zenoss, Inc. 2007, all rights reserved.
4 #
5 # This content is made available according to terms specified in
6 # License.zenoss under the directory where your Zenoss product is installed.
7 #
8 ##############################################################################
9
10
11 import logging
12 log = logging.getLogger("zen.triggers")
13
14 from Globals import InitializeClass
15 from Globals import DTMLFile
16 from AccessControl import ClassSecurityInfo
17 from AdministrativeRoleable import AdministrativeRoleable
18 from Products.ZenModel.ZenossSecurity import *
19 from Products.ZenRelations.RelSchema import *
20 from Products.ZenModel.ZenModelRM import ZenModelRM
21 from zope.interface import implements
22 from Products.ZenUtils.guid.interfaces import IGloballyIdentifiable
23
24
26
27
29 """Create the trigger manager."""
30 tm = TriggerManager(TriggerManager.root)
31 context._setObject(TriggerManager.root, tm)
32 if REQUEST is not None:
33 REQUEST['RESPONSE'].redirect(context.absolute_url() + '/manage_main')
34
36 """Manage triggers."""
37
38 _id = "TriggerManager"
39 root = 'Triggers'
40 meta_type = _id
41
42 sub_meta_types = ("Trigger",)
43
44 factory_type_information = (
45 {
46 'id' : _id,
47 'meta_type' : _id,
48 'description' : """Management of triggers""",
49 'icon' : 'UserSettingsManager.gif',
50 'product' : 'ZenModel',
51 'factory' : 'manage_addTriggerManager',
52 'immediate_view' : 'editSettings',
53 'actions' : (
54 {
55 'id' : 'settings',
56 'name' : 'Settings',
57 'action' : '../editSettings',
58 'permissions' : ( ZEN_MANAGE_DMD, )
59 })
60 },
61 )
62
63 addTrigger = DTMLFile('dtml/addTrigger',globals())
64
65
67 """Create a trigger"""
68 ns = Trigger(id, title)
69 context._setObject(id, ns)
70 if REQUEST:
71 REQUEST['RESPONSE'].redirect(context.absolute_url() + '/manage_main')
72
74 """
75 A stub object that is used for managing permissions.
76 """
77 implements(IGloballyIdentifiable)
78 security = ClassSecurityInfo()
79
80 _id = "Trigger"
81 meta_type = _id
82
83 _properties = ZenModelRM._properties
84
85 _relations = (
86 ("adminRoles",
87 ToManyCont(
88 ToOne,
89 "Products.ZenModel.AdministrativeRole",
90 "managedObject"
91 )),
92 )
93
94 factory_type_information = (
95 {
96 'id' : _id,
97 'meta_type' : _id,
98 'description' : """Stub object representing a trigger.""",
99 'icon' : 'ActionRule.gif',
100 'product' : 'ZenEvents',
101 'factory' : 'manage_addTrigger',
102 'immediate_view' : 'editTrigger',
103 'actions' :(
104 {
105 'id' : 'edit',
106 'name' : 'Edit',
107 'action' : 'editTrigger',
108 'permissions' : (ZEN_CHANGE_ALERTING_RULES,)
109 }
110 )
111 },
112 )
113
114 # a property storing user permission mappings
115 users = []
116
118 self.globalRead = False
119 self.globalWrite = False
120 self.globalManage = False
121
122 self.userRead = False
123 self.userWrite = False
124 self.userManage = False
125
126 super(ZenModelRM, self).__init__(id, title=title, buildRelations=buildRelations)
127
128 security.declareProtected(ZEN_CHANGE_ALERTING_RULES, 'manage_editTrigger')
132
133 InitializeClass(TriggerManager)
134 InitializeClass(Trigger)
135
| Trees | Indices | Help |
|
|---|
| Generated by Epydoc 3.0.1.1812 on Mon Jul 30 17:11:43 2012 | http://epydoc.sourceforge.net |