6
6
7
7
class UnityOrg
8
8
{
9
- private $ orgid ;
9
+ public $ gid ;
10
10
11
11
private $ MAILER ;
12
12
private $ SQL ;
13
13
private $ LDAP ;
14
14
private $ REDIS ;
15
15
private $ WEBHOOK ;
16
16
17
- public function __construct ($ orgid , $ LDAP , $ SQL , $ MAILER , $ REDIS , $ WEBHOOK )
17
+ public function __construct ($ gid , $ LDAP , $ SQL , $ MAILER , $ REDIS , $ WEBHOOK )
18
18
{
19
- $ this ->orgid = $ orgid ;
19
+ $ this ->gid = $ gid ;
20
20
21
21
$ this ->LDAP = $ LDAP ;
22
22
$ this ->SQL = $ SQL ;
@@ -37,7 +37,7 @@ public function init()
37
37
$ org_group ->write ();
38
38
}
39
39
40
- $ this ->REDIS ->appendCacheArray ("sorted_orgs " , "" , $ this ->getOrgID () );
40
+ $ this ->REDIS ->appendCacheArray ("sorted_orgs " , "" , $ this ->gid );
41
41
}
42
42
43
43
public function exists ()
@@ -47,12 +47,7 @@ public function exists()
47
47
48
48
public function getLDAPOrgGroup ()
49
49
{
50
- return $ this ->LDAP ->getOrgGroupEntry ($ this ->orgid );
51
- }
52
-
53
- public function getOrgID ()
54
- {
55
- return $ this ->orgid ;
50
+ return $ this ->LDAP ->getOrgGroupEntry ($ this ->gid );
56
51
}
57
52
58
53
public function inOrg ($ user , $ ignorecache = false )
@@ -82,7 +77,7 @@ public function getOrgMembers($ignorecache = false)
82
77
public function getOrgMemberUIDs ($ ignorecache = false )
83
78
{
84
79
if (!$ ignorecache ) {
85
- $ cached_val = $ this ->REDIS ->getCache ($ this ->getOrgID () , "members " );
80
+ $ cached_val = $ this ->REDIS ->getCache ($ this ->gid , "members " );
86
81
if (!is_null ($ cached_val )) {
87
82
$ members = $ cached_val ;
88
83
}
@@ -95,7 +90,7 @@ public function getOrgMemberUIDs($ignorecache = false)
95
90
}
96
91
if (!$ ignorecache && $ updatecache ) {
97
92
sort ($ members );
98
- $ this ->REDIS ->setCache ($ this ->getOrgID () , "members " , $ members );
93
+ $ this ->REDIS ->setCache ($ this ->gid , "members " , $ members );
99
94
}
100
95
return $ members ;
101
96
}
@@ -105,14 +100,14 @@ public function addUser($user)
105
100
$ org_group = $ this ->getLDAPOrgGroup ();
106
101
$ org_group ->appendAttribute ("memberuid " , $ user ->getUID ());
107
102
$ org_group ->write ();
108
- $ this ->REDIS ->appendCacheArray ($ this ->getOrgID () , "members " , $ user ->getUID ());
103
+ $ this ->REDIS ->appendCacheArray ($ this ->gid , "members " , $ user ->getUID ());
109
104
}
110
105
111
106
public function removeUser ($ user )
112
107
{
113
108
$ org_group = $ this ->getLDAPOrgGroup ();
114
109
$ org_group ->removeAttributeEntryByValue ("memberuid " , $ user ->getUID ());
115
110
$ org_group ->write ();
116
- $ this ->REDIS ->removeCacheArray ($ this ->getOrgID () , "members " , $ user ->getUID ());
111
+ $ this ->REDIS ->removeCacheArray ($ this ->gid , "members " , $ user ->getUID ());
117
112
}
118
113
}
0 commit comments