|
From: Eloi G. <ada...@us...> - 2008-10-10 04:28:01
|
Update of /cvsroot/phpwebsite-comm/modules/article/class In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv28198/class Modified Files: AM_Lists.php AM_Data.php Article.php Log Message: Fixed Bug Report [ 2130663 ] - Restricted Users cannot edit their own articles Index: AM_Data.php =================================================================== RCS file: /cvsroot/phpwebsite-comm/modules/article/class/AM_Data.php,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** AM_Data.php 8 Oct 2008 17:21:18 -0000 1.16 --- AM_Data.php 10 Oct 2008 04:27:40 -0000 1.17 *************** *** 211,215 **** if (!empty($object)) { /* if user can edit articles or can edit this article... */ ! if ((Current_User::allow('article', 'edit_articles', $object->id) || (Current_User::getId() && $object->created_id == Current_User::getId())) & !$object->isLocked($object->editlock, $object->edituser)) $link[] = PHPWS_Text::moduleLink(dgettext('article', 'Edit this article'), 'article', array('op'=>'edit', 'id' => $object->id)); /* if user can delete articles or can delete this article... */ --- 211,215 ---- if (!empty($object)) { /* if user can edit articles or can edit this article... */ ! if ($object->can_edit() && !$object->isLocked($object->editlock, $object->edituser)) $link[] = PHPWS_Text::moduleLink(dgettext('article', 'Edit this article'), 'article', array('op'=>'edit', 'id' => $object->id)); /* if user can delete articles or can delete this article... */ Index: AM_Lists.php =================================================================== RCS file: /cvsroot/phpwebsite-comm/modules/article/class/AM_Lists.php,v retrieving revision 1.18 retrieving revision 1.19 diff -C2 -d -r1.18 -r1.19 *** AM_Lists.php 8 Oct 2008 17:21:18 -0000 1.18 --- AM_Lists.php 10 Oct 2008 04:27:40 -0000 1.19 *************** *** 252,256 **** /* ACTION */ /* if user can edit articles or can edit this article... */ ! if (Current_User::allow('article', 'edit_articles', $id) || (Current_User::getId() && $created_id == Current_User::getId())) { /* If someone else is editing this page... */ if (PHPWS_Article::isLocked($editlock, $edituser)) --- 252,256 ---- /* ACTION */ /* if user can edit articles or can edit this article... */ ! if (PHPWS_Article::can_edit($id, $created_id)) { /* If someone else is editing this page... */ if (PHPWS_Article::isLocked($editlock, $edituser)) Index: Article.php =================================================================== RCS file: /cvsroot/phpwebsite-comm/modules/article/class/Article.php,v retrieving revision 1.53 retrieving revision 1.54 diff -C2 -d -r1.53 -r1.54 *** Article.php 8 Oct 2008 17:21:18 -0000 1.53 --- Article.php 10 Oct 2008 04:27:40 -0000 1.54 *************** *** 282,286 **** /* if user can edit articles or can edit this article... */ ! if (Current_User::allow('article', 'edit_articles', $this->id) || (Current_User::getId() && $this->created_id == Current_User::getId())) { /* If someone else is editing this article... */ if ($this->isLocked($this->editlock, $this->edituser)) --- 282,286 ---- /* if user can edit articles or can edit this article... */ ! if ($this->can_edit()) { /* If someone else is editing this article... */ if ($this->isLocked($this->editlock, $this->edituser)) *************** *** 930,935 **** || ($_REQUEST['module']=='article' && !$saving ! && (Current_User::allow('article', 'edit_articles', $this->id) ! || (Current_User::getId() && $this->created_id == Current_User::getId())) || $GLOBALS['module']=='approval'); } --- 930,934 ---- || ($_REQUEST['module']=='article' && !$saving ! && ($this->can_edit()) || $GLOBALS['module']=='approval'); } *************** *** 1052,1056 **** , 'msg' => @$version->source_data['vr_reviewer_note']); } ! } ?> \ No newline at end of file --- 1051,1078 ---- , 'msg' => @$version->source_data['vr_reviewer_note']); } ! ! /** ! * Determines if an article can be edited by the user. ! * ! * If an id was not given, the method will assume that we're checking the ! * current object's permissions ! * ! * @author Eloi George <el...@NO...> ! * @module Article Manager ! * @param int $id : Article id to check, if known. ! * @param int $creator_id : Article Author id to check, if known. ! * @return bool : true or false. ! * @access public ! */ ! function can_edit ($id = null, $creator_id = null) { ! /* If an id was not given, check general editing pro */ ! if (empty($id)) { ! $id = $this->id; ! $creator_id = $this->created_id; ! } ! return Current_User::allow('article', 'edit_articles', $id) ! || (Current_User::getId() && $creator_id == Current_User::getId()); ! } ! } ?> \ No newline at end of file |