public function loadDetail($parameters) { $this->group = null; $this->available_permissions = array(); if (isset($parameters['id'])) { $this->group = new DinklyGroup(); $this->group->init($parameters['id']); //Build a collection of permissions that the group does not currently have $temp_permissions = DinklyPermissionCollection::getAll(); if ($temp_permissions != array()) { foreach ($temp_permissions as $temp_perm) { $has_perm = false; if ($this->group->getPermissions() != array()) { foreach ($this->group->getPermissions() as $p) { if ($temp_perm->getId() == $p->getId()) { $has_perm = true; } } } if (!$has_perm) { $this->available_permissions[] = $temp_perm; } } } return true; } }
public static function getPermissionsByGroup($db = null, $group_id) { $peer_object = new DinklyGroupPermission(); if ($db == null) { $db = self::fetchDB(); } $query = $peer_object->getSelectQuery() . " where dinkly_group_id = " . $db->quote($group_id); $group_perm_joins = self::getCollection($peer_object, $query, $db); if ($group_perm_joins != array()) { $perm_ids = array(); foreach ($group_perm_joins as $perm_join) { $perm_ids[] = $perm_join->getDinklyPermissionId(); } $perms = DinklyPermissionCollection::getByArrayOfIds($perm_ids, $db); if ($perms != array()) { return $perms; } } return false; }