Created
May 16, 2010 16:48
-
-
Save ojii/402985 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/cms/models/pluginmodel.py b/cms/models/pluginmodel.py | |
index 5f4317f..5f5d4b5 100644 | |
--- a/cms/models/pluginmodel.py | |
+++ b/cms/models/pluginmodel.py | |
@@ -237,6 +237,14 @@ class CMSPlugin(MpttPublisher): | |
Handle copying of any relations attached to this plugin | |
""" | |
+ def has_change_permission(self, request): | |
+ if self.page: | |
+ return self.page.has_change_permission(request) | |
+ elif self.placeholder: | |
+ return self.placeholder.has_change_permission(request) | |
+ else: | |
+ return self.parent.has_change_permission(request) | |
+ | |
def is_first_in_placeholder(self): | |
return self.position == 0 | |
diff --git a/cms/plugin_base.py b/cms/plugin_base.py | |
index 495ad18..187ea05 100644 | |
--- a/cms/plugin_base.py | |
+++ b/cms/plugin_base.py | |
@@ -142,12 +142,7 @@ class CMSPluginBase(admin.ModelAdmin): | |
Not sure if there will be plugin permission requirement in future, but | |
if, then this must be changed. | |
""" | |
- if self.page: | |
- return self.page.has_change_permission(request) | |
- elif self.placeholder: | |
- return self.placeholder.has_change_permission(request) | |
- else: | |
- return self.parent.has_change_permission(request) | |
+ return self.cms_plugin_instance.has_change_permission(request) | |
has_delete_permission = has_change_permission = has_add_permission | |
def save_model(self, request, obj, form, change): |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment