start to modularise the clone import and sync functions

This commit is contained in:
redmatrix
2015-09-02 20:12:40 -07:00
parent 69fc10d5ad
commit c22da3da1c
5 changed files with 386 additions and 204 deletions

View File

@@ -34,6 +34,11 @@ class AccessList {
return $this->explicit;
}
/**
* Set AccessList from strings such as those in already
* existing stored data items
*/
function set($arr,$explicit = true) {
$this->allow_cid = $arr['allow_cid'];
$this->allow_gid = $arr['allow_gid'];
@@ -43,6 +48,12 @@ class AccessList {
$this->explicit = $explicit;
}
/**
* return an array consisting of the current
* access list components where the elements
* are directly storable.
*/
function get() {
return array(
'allow_cid' => $this->allow_cid,
@@ -52,6 +63,12 @@ class AccessList {
);
}
/**
* Set AccessList from arrays, such as those provided by
* acl_selector(). For convenience, a string (or non-array) input is
* assumed to be a comma-separated list and auto-converted into an array.
*/
function set_from_array($arr,$explicit = true) {
$this->allow_cid = perms2str((is_array($arr['contact_allow']))
? $arr['contact_allow'] : explode(',',$arr['contact_allow']));