From c22da3da1c5d3c5418cb9f142883adb838db9f76 Mon Sep 17 00:00:00 2001 From: redmatrix Date: Wed, 2 Sep 2015 20:12:40 -0700 Subject: start to modularise the clone import and sync functions --- include/AccessList.php | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'include/AccessList.php') diff --git a/include/AccessList.php b/include/AccessList.php index 46e66d33d..43f1de111 100644 --- a/include/AccessList.php +++ b/include/AccessList.php @@ -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'])); -- cgit v1.2.3