Login or Register

RSS IconRecent posts in this topic

avatar
jakekrohn on Aug 21. 2007. 11:38 am
Hi -

I noticed the following problem when making some changes to our AC code. In the "ProjectFileRevision.class.php" file is the following function:

function canEdit(User $user) {
  if(!$this->canManage(logged_user())) return false; // user don't have access to this project or can't manage files
  if($user->isAdministrator()) return true; // give access to admin
  return false;
} // canEdit


Either the first conditional should not be negated and the return value should be "true", or the last one should be "true", but both cannot have the same value.

I think I'm going to do this, since it seems more in the style of the rest of the code:

function canEdit(User $user) {
  if($this->canManage(logged_user())) return true;
  if($user->isAdministrator()) return true; // give access to admin
  return false;
} // canEdit


Anyone else come across this?
Topic is locked. If you have something important to say about issues discussed on this page please write at hi@a51dev.com.

RSS IconRecent posts in this topic