Module: check_mk
Branch: master
Commit: bac3690c9543cf2cecb82e8ebe44ff0d13782df9
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=bac3690c9543cf…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Thu Dec 7 12:06:52 2017 +0100
5567 Scheduled reports can now be stored in the site
Instead of sending an email with the created report in the scheduled
interval it is now possible to store the just created reports locally
in the site.
This feature is configured in the configuration of the schedule. You
can now choose the action <i>Store locally</i> instead of
<i>Send via Email</i> and configure different action specific things
after this.
Each user allowed to use the report scheduler can open the page
"Scheduler > Stored reports" to view and open all stored reports
available to the user.
All reports are stored below <tt>~/var/check_mk/reports/archive/</tt>.
In the first directory below the base directory each user that creates
such stored reports gets a directory. All stored reports of this user
are saved below this directory. In case the user configures a schedule
to publish the resulting PDFs to other users, the reports are stored
in the <tt>public</tt> sub directory. A schedule can be configured
to store the report either directly in these directories or in a
hierarchy of subdirectories below these parent directories.
You can configure stored reports to be deleted after a given time.
Change-Id: I7e8e7aadaaef41f4019fb441186d0285395a678c
---
.werks/5567 | 33 +++++++++++++++++++++++++++++++++
web/htdocs/pagetypes.py | 10 ++++++++--
2 files changed, 41 insertions(+), 2 deletions(-)
diff --git a/.werks/5567 b/.werks/5567
new file mode 100644
index 0000000..34b6d24
--- /dev/null
+++ b/.werks/5567
@@ -0,0 +1,33 @@
+Title: Scheduled reports can now be stored in the site
+Level: 2
+Component: reporting
+Compatible: compat
+Edition: cee
+Version: 1.5.0i2
+Date: 1512640854
+Class: feature
+
+Instead of sending an email with the created report in the scheduled
+interval it is now possible to store the just created reports locally
+in the site.
+
+This feature is configured in the configuration of the schedule. You
+can now choose the action <i>Store locally</i> instead of
+<i>Send via Email</i> and configure different action specific things
+after this.
+
+Each user allowed to use the report scheduler can open the page
+"Scheduler > Stored reports" to view and open all stored reports
+available to the user.
+
+All reports are stored below <tt>~/var/check_mk/reports/archive/</tt>.
+
+In the first directory below the base directory each user that creates
+such stored reports gets a directory. All stored reports of this user
+are saved below this directory. In case the user configures a schedule
+to publish the resulting PDFs to other users, the reports are stored
+in the <tt>public</tt> sub directory. A schedule can be configured
+to store the report either directly in these directories or in a
+hierarchy of subdirectories below these parent directories.
+
+You can configure stored reports to be deleted after a given time.
diff --git a/web/htdocs/pagetypes.py b/web/htdocs/pagetypes.py
index 5602458..3153a19 100644
--- a/web/htdocs/pagetypes.py
+++ b/web/htdocs/pagetypes.py
@@ -476,6 +476,11 @@ class Overridable(Base):
return self.is_mine() and config.user.may("general.edit_" + self.type_name())
+ @classmethod
+ def _delete_permission(cls):
+ return "general.edit_" + cls.type_name()
+
+
def owner(self):
return self._["owner"]
@@ -514,7 +519,7 @@ class Overridable(Base):
def may_delete(self):
if self.is_builtin():
return False
- elif self.is_mine():
+ elif self.is_mine() and config.user.may(self._delete_permission()):
return True
else:
return config.user.may('general.delete_foreign_%s' % self.type_name())
@@ -523,7 +528,7 @@ class Overridable(Base):
def may_edit(self):
if self.is_builtin():
return False
- elif self.is_mine():
+ elif self.is_mine() and config.user.may("general.edit_%s" % self.type_name()):
return True
else:
return config.user.may('general.edit_foreign_%s' % self.type_name())
@@ -582,6 +587,7 @@ class Overridable(Base):
_("Make %s visible and usable for other users.") % cls.phrase("title_plural"),
[ "admin", "user" ])
+ # TODO: Bug: This permission does not seem to be used
config.declare_permission("general.see_user_" + cls.type_name(),
_("See user %s") % cls.phrase("title_plural"),
_("Is needed for seeing %s that other users have created.") % cls.phrase("title_plural"),