Skip to content

Commit

Permalink
Fix bug
Browse files Browse the repository at this point in the history
  • Loading branch information
MrCrankHank committed Oct 31, 2015
1 parent 54f022b commit 62b83ae
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 24 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ Take a look at the github releases for detailed information about the features.

## Bugs in 0.5.6:
- [ ] Parse function could overwrite comments
- [ ] The same object can be added multiple times to a iqn
- [x] The same object can be added multiple times to a iqn

## Roadmap
In version 0.6:
Expand Down
41 changes: 18 additions & 23 deletions app/models/target/Logic.php
Original file line number Diff line number Diff line change
Expand Up @@ -109,8 +109,8 @@ protected function check_ietd_running() {
* @return array|bool
*
*/
public function get_acls($type = 'initiator') {
if ($type === 'initiator') {
public function get_acls($type = 'initiators') {
if ($type === 'initiators') {
$data = $this->parse_file($this->database->get_config('ietd_init_allow')['value'], [$this, 'parse_target_acl'], array(), true, false);
} else {
$data = $this->parse_file($this->database->get_config('ietd_target_allow')['value'], [$this, 'parse_target_acl'], array(), true, false);
Expand Down Expand Up @@ -150,27 +150,22 @@ public function get_acls($type = 'initiator') {
*
*/
protected function check_object_already_added($id, $type = 'initiators') {
$data = $this->get_acls();

if ($type == "targets") {
if (isset($data['targets'])) {
$value = $this->std->recursive_array_search($this->database->get_object_value($id), $data['targets']);
} else {
$value = false;
}
} else {
if (isset($data['initiators'])) {
$value = $this->std->recursive_array_search($this->database->get_object_value($id), $data['initiators']);
} else {
$value = false;
}
}

if ($value === false) {
return false;
} else {
return true;
}
$data = $this->get_acls($type);

if ($data !== false) {
// index 0 contains the iqn
unset($data[0]);

$key = $this->std->recursive_array_search($this->database->get_object_value($id), $data);

if ($key !== false) {
return true;
} else {
return false;
}
} else {
return false;
}
}

/**
Expand Down

0 comments on commit 62b83ae

Please sign in to comment.