public function addGroupWriteAccess(a\Group $g)
 {
     if (self::DEBUG) {
         u\DebugUtility::out("Granting write access to " . $g->getName());
     }
     $this->setAccess($g, c\T::WRITE);
     return $this;
 }
 public function addGroupToSendReport(Group $g)
 {
     if ($g == NULL) {
         throw new e\NullAssetException(S_SPAN . c\M::NULL_GROUP . E_SPAN);
     }
     $g_name = $g->getName();
     $group_string = $this->getProperty()->sendReportToGroups;
     $group_array = explode(';', $group_string);
     if (!in_array($g_name, $group_array)) {
         $group_array[] = $g_name;
     }
     $group_string = implode(';', $group_array);
     $this->getProperty()->sendReportToGroups = $group_string;
     return $this;
 }
 public function addGroup(a\Group $g)
 {
     if ($g == NULL) {
         throw new e\NullAssetException(S_SPAN . c\M::NULL_GROUP . E_SPAN);
     }
     $g_name = $g->getName();
     $group_array = explode(self::DELIMITER, $this->groups);
     $temp = array();
     foreach ($group_array as $group) {
         if ($group != "") {
             $temp[] = $group;
         }
     }
     $group_array = $temp;
     if (!in_array($g_name, $group_array)) {
         $group_array[] = $g_name;
     }
     $this->groups = implode(self::DELIMITER, $group_array);
     return $this;
 }
 public function removeGroup(Group $g)
 {
     if ($g == NULL) {
         throw new e\NullAssetException(S_SPAN . c\M::NULL_GROUP . E_SPAN);
     }
     $group_name = $g->getName();
     $group_string = $this->getProperty()->applicableGroups;
     $group_array = explode(';', $group_string);
     if (in_array($group_name, $group_array)) {
         $temp = array();
         foreach ($group_array as $group) {
             if ($group != $group_name) {
                 $temp[] = $group;
             }
         }
         $group_array = $temp;
     }
     $group_string = implode(';', $group_array);
     $this->getProperty()->applicableGroups = $group_string;
     return $this;
 }
 public function createUser($user_name, $password, Group $group, Role $global_role)
 {
     if (trim($user_name) == "") {
         throw new e\CreationErrorException(S_SPAN . c\M::EMPTY_USER_NAME . E_SPAN);
     }
     if (trim($password) == "") {
         throw new e\CreationErrorException(S_SPAN . c\M::EMPTY_PASSWORD . E_SPAN);
     }
     $asset = AssetTemplate::getUser();
     $asset->user->username = $user_name;
     $asset->user->password = $password;
     $asset->user->groups = $group->getId();
     $asset->user->role = $global_role->getName();
     if (self::DEBUG && self::DUMP) {
         u\DebugUtility::dump($asset);
     }
     return $this->createAsset($asset, User::TYPE, $user_name);
 }
示例#6
0
 public function setDefaultGroup(Group $group = NULL)
 {
     if (isset($group)) {
         $this->getProperty()->defaultGroup = $group->getName();
     }
     return $this;
 }
 public function removeGroup(Group $g)
 {
     if ($g == NULL) {
         throw new e\NullAssetException(S_SPAN . c\M::NULL_GROUP . E_SPAN);
     }
     $group_name = $g->getName();
     $group_array = explode(self::DELIMITER, $this->getProperty()->applicableGroups);
     $temp = array();
     foreach ($group_array as $group) {
         if ($group != $group_name) {
             $temp[] = $group;
         }
     }
     $this->getProperty()->applicableGroups = implode(self::DELIMITER, $temp);
     return $this;
 }