35 if (empty($folder_pk)) {
57 $sql =
"select * from foldercontents where parent_fk=$folder_pk";
58 $result = pg_query($PG_CONN, $sql);
60 while ($row = pg_fetch_assoc($result)) {
61 switch ($row[
"foldercontents_mode"]) {
66 $uploads[] = $row[
"child_id"];
72 pg_free_result($result);
90 foreach ($GroupArray as &$Grec) {
91 if ($Grec[
'user_pk'] == $GroupRow[
'user_fk']) {
95 if ($Grec[
'group_perm'] < $GroupRow[
'group_perm']) {
96 $Grec[
'group_perm'] = $GroupRow[
'group_perm'];
105 $NewGroup[
'user_pk'] = $GroupRow[
'user_fk'];
106 $NewGroup[
'group_pk'] = $GroupRow[
'group_pk'];
107 $NewGroup[
'group_name'] = $GroupRow[
'group_name'];
108 $NewGroup[
'group_perm'] = $GroupRow[
'group_perm'];
109 $GroupArray[] = $NewGroup;
127 $GroupArray = array();
130 if (empty($user_pk)) {
135 if (empty($user_pk)) {
138 $UserCondition =
" and user_fk=$user_pk ";
141 $sql =
"select group_pk, group_name, group_perm, user_fk from group_user_member, groups where group_pk=$group_pk and group_pk=group_fk $UserCondition";
142 $result = pg_query($PG_CONN, $sql);
144 while ($row = pg_fetch_assoc($result)) {
164 $GroupArray = array();
166 if (empty($user_pk)) {
169 if (empty($user_pk)) {
173 $sql =
"select group_fk as group_pk from group_user_member where user_fk=$user_pk";
174 $result = pg_query($PG_CONN, $sql);
176 while ($row = pg_fetch_assoc($result)) {
180 pg_free_result($result);
196 $GroupArray = array();
199 $sql =
"select group_pk, group_name from groups";
201 $sql =
"select group_pk, group_name from groups, group_user_member 202 where group_pk=group_fk and user_fk='$user_pk' and group_perm=1";
204 $result = pg_query($PG_CONN, $sql);
206 if (pg_num_rows($result) > 0) {
207 while ($row = pg_fetch_assoc($result)) {
208 $GroupArray[$row[
'group_pk']] = $row[
'group_name'];
211 pg_free_result($result);
213 natcasesort($GroupArray);
227 $user_pk = Auth::getUserId();
230 if (empty($group_pk)) {
231 $text = _(
"Error: Group name must be specified.");
236 $sql =
"SELECT group_pk FROM groups WHERE group_pk = '$group_pk'";
237 $result = pg_query($PG_CONN, $sql);
239 if (pg_num_rows($result) < 1) {
240 pg_free_result($result);
241 $text = _(
"Group does not exist. Not deleted.");
244 pg_free_result($result);
251 $sql =
"SELECT * FROM group_user_member WHERE group_fk = '$group_pk' and user_fk='$user_pk' and group_perm=1";
252 $result = pg_query($PG_CONN, $sql);
254 if (pg_num_rows($result) < 1) {
255 pg_free_result($result);
256 $text = _(
"Permission Denied.");
259 pg_free_result($result);
264 $result = pg_query($PG_CONN, $sql);
266 pg_free_result($result);
269 $sql =
"delete from perm_upload where group_fk='$group_pk'";
270 $result = pg_query($PG_CONN, $sql);
272 pg_free_result($result);
275 $sql =
"delete from group_user_member where group_fk='$group_pk'";
276 $result = pg_query($PG_CONN, $sql);
278 pg_free_result($result);
281 $sql =
"update users set new_upload_group_fk=NULL, new_upload_perm=NULL where new_upload_group_fk='$group_pk'";
282 $result = pg_query($PG_CONN, $sql);
284 pg_free_result($result);
287 $sql =
"delete from groups where group_pk='$group_pk'";
288 $result = pg_query($PG_CONN, $sql);
290 pg_free_result($result);
294 $result = pg_query($PG_CONN, $sql);
296 pg_free_result($result);
AddUserToGroupArray($GroupRow, &$GroupArray)
Check if User is already in the $GroupArray.
#define PLUGIN_DB_ADMIN
Plugin requires admin level permission on DB.
GetUsersGroups($user_pk='')
Find all the groups a user belongs to.
GetGroupArray($user_pk)
Get array of groups that this user has admin access to use UserDao::getAdminGroupMap() ...
GetGroupUsers($user_pk, $group_pk, &$GroupArray)
Get all the users users of this group.
GetUploadsFromFolder_recurse($folder_pk, &$uploads)
GetUploadsFromFolder($folder_pk)
foreach($Options as $Option=> $OptVal) if(0==$reference_flag &&0==$nomos_flag) $PG_CONN
DBCheckResult($result, $sql, $filenm, $lineno)
Check the postgres result for unexpected errors. If found, treat them as fatal.
GetArrayVal($Key, $Arr)
Get the value from a array(map)
DeleteGroup($group_pk)
Delete a group.