Example #1
0
 /**
  * Check if this user can remove other user from project
  *
  * @access public
  * @param User $user
  * @param User $remove_user User that need to be removed
  * @return boolean
  */
 function canRemoveUserFromProject(User $user, User $remove_user)
 {
     if ($remove_user->isAccountOwner()) {
         return false;
     }
     return $user->isAccountOwner() || $user->isAdministrator();
 }
Example #2
0
 /**
 * Check if specific user can update this user account
 *
 * @access public
 * @param User $user
 * @return boolean
 */
 function canEdit(User $user) {
   if ($user->getId() == $this->getId()) {
     return true; // account owner
   } // if
   if ($user->isAccountOwner()) {
     return true;
   } // if
   return $user->isAdministrator();
 } // canEdit
Example #3
0
 /**
 * Check if this user can remove other user from project
 *
 * @access public
 * @param User $user
 * @param User $remove_user User that need to be removed
 * @return boolean
 */
 function canRemoveUserFromProject(User $user, User $remove_user) {
   if ($remove_user->isAccountOwner()) {
     return false;
   }
   return ($this->getCreatedById() == $user->getId()) || $user->isAccountOwner() || $user->isAdministrator();
 } // canRemoveUserFromProject
Example #4
0
 /**
  * Returns true if specific user can add client company
  *
  * @access public
  * @param User $user
  * @return boolean
  */
 function canAddClient(User $user)
 {
     if (!$user->isMemberOf($this)) {
         return false;
     }
     return $user->isAccountOwner() || $user->isAdministrator($this);
 }
 /**
  * Check if user can add task lists in specific project
  *
  * @param User $user
  * @param Project $project
  * @return boolean
  */
 function canAdd(User $user, Project $project)
 {
     if ($user->isAccountOwner()) {
         return true;
     }
     // if
     return $user->getProjectPermission($project, ProjectUsers::CAN_MANAGE_TASKS);
 }
 /**
  * Check if user can add task lists in specific project
  *
  * @param User $user
  * @param Project $project
  * @return boolean
  */
 function canAdd(User $user, Project $project)
 {
     if ($user->isAccountOwner()) {
         return true;
     }
     // if
     if ($user->isAdministrator()) {
         return true;
     }
     // if
     return $user->getProjectPermission($project, PermissionManager::CAN_MANAGE_TASKS);
 }
Example #7
0
 /**
  * Returns if this user can edit the user account linked to that contact
  *
  * @param User $user
  * @return boolean
  */
 function canEditUserAccount(User $user)
 {
     if ($user->isAccountOwner()) {
         return true;
     }
     // if
     if ($this->getUserId() == $user->getId()) {
         return true;
     }
     // can edit your own user account
     return $user->isAdministrator();
 }
Example #8
0
 /**
  * Check if this user can remove other user from project
  *
  * @access public
  * @param User $user
  * @param User $remove_user User that need to be removed
  * @return boolean
  */
 function canRemoveUserFromProject(User $user, User $remove_user)
 {
     if ($remove_user->isAccountOwner()) {
         return false;
     }
     return $user->isAccountOwner() || can_manage_workspaces(logged_user()) || can_manage_security(logged_user());
 }
Example #9
0
 /**
  * Check if specific user can delete this group
  *
  * @access public
  * @param User $user
  * @return boolean
  */
 function canDelete(User $user)
 {
     return ($user->isAccountOwner() || $user->isAdministrator()) && !$this->isAdministratorGroup();
 }
Example #10
0
 /**
  * Check if specific user can update this user account
  *
  * @access public
  * @param User $user
  * @return boolean
  */
 function canEdit(User $user)
 {
     if ($user->getId() == $this->getId()) {
         return true;
         // account owner
     }
     // if
     if ($user->isAccountOwner()) {
         return true;
     }
     // if
     return can_manage_security(logged_user());
 }
Example #11
0
 /**
  * Returns true if specific user can add client company
  *
  * @access public
  * @param User $user
  * @return boolean
  */
 function canAddClient(User $user)
 {
     //      return  ($user->isMemberOf($this)) || can_manage_contacts(logged_user());
     return $user->isAccountOwner() || $user->isAdministrator($this) || can_manage_contacts(logged_user());
 }