From 5a0255926961418a89befb6a198148ba943449b8 Mon Sep 17 00:00:00 2001 From: Mzhelskiy Maxim Date: Mon, 9 Nov 2015 17:03:23 +0700 Subject: [PATCH] fix #724 --- application/classes/modules/acl/ACL.class.php | 8 +------- .../modules/user/entity/User.entity.class.php | 13 +++++++++++++ .../components/blog/blocks/block.blog-add.tpl | 2 +- framework | 2 +- 4 files changed, 16 insertions(+), 9 deletions(-) diff --git a/application/classes/modules/acl/ACL.class.php b/application/classes/modules/acl/ACL.class.php index 04c3ff15..83ce6c48 100644 --- a/application/classes/modules/acl/ACL.class.php +++ b/application/classes/modules/acl/ACL.class.php @@ -57,13 +57,7 @@ class ModuleACL extends Module if (!$oUser) { return false; } - if ($oUser->isAdministrator()) { - return true; - } - /** - * Проверяем хватает ли рейтинга юзеру чтоб создать блог - */ - if ($oUser->getRating() < Config::Get('acl.create.blog.rating')) { + if (!$oUser->isAllowCreateBlog()) { return $that->Lang_Get('blog.add.alerts.acl'); } return true; diff --git a/application/classes/modules/user/entity/User.entity.class.php b/application/classes/modules/user/entity/User.entity.class.php index d3173e5f..18d0bad1 100644 --- a/application/classes/modules/user/entity/User.entity.class.php +++ b/application/classes/modules/user/entity/User.entity.class.php @@ -633,6 +633,19 @@ class ModuleUser_EntityUser extends Entity return false; } + /** + * Проверка на возможность создания блога юзером + * + * @return bool + */ + public function isAllowCreateBlog() + { + if ($this->isAdministrator() or $this->getRating() >= Config::Get('acl.create.blog.rating')) { + return true; + } + return false; + } + /** * Устанавливает ID пользователя diff --git a/application/frontend/components/blog/blocks/block.blog-add.tpl b/application/frontend/components/blog/blocks/block.blog-add.tpl index 02c34610..d0628ffb 100644 --- a/application/frontend/components/blog/blocks/block.blog-add.tpl +++ b/application/frontend/components/blog/blocks/block.blog-add.tpl @@ -4,7 +4,7 @@ {if $oUserCurrent} {capture 'block_content'} - {if $oUserCurrent && ($oUserCurrent->getRating() > Config::Get('acl.create.blog.rating') or $oUserCurrent->isAdministrator())} + {if $oUserCurrent && $oUserCurrent->isAllowCreateBlog()}

{$aLang.blog.can_add}

{component 'button' url="{router page='blog'}add/" mods='primary large' text=$aLang.blog.create_blog} diff --git a/framework b/framework index fce2a720..6e84853b 160000 --- a/framework +++ b/framework @@ -1 +1 @@ -Subproject commit fce2a720edf08e411eee114c3de1712294a5a08e +Subproject commit 6e84853becbd465cfbb2e9bc721ad808206eaff7