ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
Store.php
Go to the documentation of this file.
1 <?php
9 abstract class sspmod_consent_Store
10 {
18  protected function __construct(&$config)
19  {
20  assert(is_array($config));
21  }
22 
23 
37  abstract public function hasConsent($userId, $destinationId, $attributeSet);
38 
39 
52  abstract public function saveConsent($userId, $destinationId, $attributeSet);
53 
54 
65  abstract public function deleteConsent($userId, $destinationId);
66 
67 
79  public function deleteAllConsents($userId)
80  {
81  throw new Exception('Not implemented: deleteAllConsents()');
82  }
83 
84 
92  public function getStatistics()
93  {
94  throw new Exception('Not implemented: getStatistics()');
95  }
96 
97 
107  abstract public function getConsents($userId);
108 
109 
122  public static function parseStoreConfig($config)
123  {
124  if (is_string($config)) {
125  $config = array($config);
126  }
127 
128  if (!is_array($config)) {
129  throw new Exception('Invalid configuration for consent store option: '.var_export($config, true));
130  }
131 
132  if (!array_key_exists(0, $config)) {
133  throw new Exception('Consent store without name given.');
134  }
135 
136  $className = SimpleSAML\Module::resolveClass(
137  $config[0],
138  'Consent_Store',
139  'sspmod_consent_Store'
140  );
141 
142  unset($config[0]);
143  return new $className($config);
144  }
145 }
$config
Definition: bootstrap.php:15
static resolveClass($id, $type, $subclass=null)
Resolve module class.
Definition: Module.php:169