diff --git a/phpgwapi/inc/class.categories.inc.php b/phpgwapi/inc/class.categories.inc.php index 9fee974b4b..d08e9495c6 100644 --- a/phpgwapi/inc/class.categories.inc.php +++ b/phpgwapi/inc/class.categories.inc.php @@ -668,6 +668,20 @@ class categories return $cache[$cat['cat_name']] = (int) $cats[0]['id']; } + /** + * Check if catgory is global (owner <= 0 || appname == 'phpgw') + * + * @param int|array $cat + * @return boolean + */ + static function is_global($cat) + { + if (!is_array($cat) && !($cat = self::read($cat))) return null; // cat not found + + return $cat['owner'] <= self::GLOBAL_ACCOUNT || $cat['appname'] == self::GLOBAL_APPNAME; + } + + /** * return category information for a given id *