diff options
author | Robin Appelman <icewind@owncloud.com> | 2014-04-18 16:29:45 +0400 |
---|---|---|
committer | Thomas Müller <thomas.mueller@tmit.eu> | 2014-06-03 14:42:35 +0400 |
commit | 53dc30af4fb09dabdd342ccd5dee9f20eaac52b0 (patch) | |
tree | a3aaf443b52356122bc001adee7e8a639b794b9d /lib/private/app.php | |
parent | bf9b634fd8981e8cb11bf2c44fbe283588bc048e (diff) |
Add option to enable app for specific groups
Diffstat (limited to 'lib/private/app.php')
-rw-r--r-- | lib/private/app.php | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/lib/private/app.php b/lib/private/app.php index 676df47245a..aa0fdd6da6c 100644 --- a/lib/private/app.php +++ b/lib/private/app.php @@ -208,12 +208,13 @@ class OC_App { /** * enables an app * @param mixed $app app + * @param array $groups (optional) when set, only these groups will have access to the app * @throws \Exception * @return void * * This function set an app as enabled in appconfig. */ - public static function enable($app) { + public static function enable($app, $groups = null) { self::$enabledAppsCache = array(); // flush if (!OC_Installer::isInstalled($app)) { // check if app is a shipped app or not. OCS apps have an integer as id, shipped apps use a string @@ -242,7 +243,11 @@ class OC_App { ) ); } else { - OC_Appconfig::setValue($app, 'enabled', 'yes'); + if (!is_null($groups)) { + OC_Appconfig::setValue($app, 'enabled', json_encode($groups)); + }else{ + OC_Appconfig::setValue($app, 'enabled', 'yes'); + } if (isset($appdata['id'])) { OC_Appconfig::setValue($app, 'ocsid', $appdata['id']); } @@ -723,10 +728,15 @@ class OC_App { continue; } - if (OC_Appconfig::getValue($app, 'enabled', 'no') == 'yes') { + $enabled = OC_Appconfig::getValue($app, 'enabled', 'no'); + $info['groups'] = null; + if ($enabled === 'yes') { $active = true; - } else { + } else if($enabled === 'no') { $active = false; + } else { + $active = true; + $info['groups'] = $enabled; } $info['active'] = $active; |