File tree Expand file tree Collapse file tree 1 file changed +7
-0
lines changed
Expand file tree Collapse file tree 1 file changed +7
-0
lines changed Original file line number Diff line number Diff line change @@ -37,6 +37,7 @@ class tenant {
3737 * Tenant class constructor.
3838 *
3939 * @param string $identifier the tenant identifier; if left empty, the default tenant is being used
40+ * @throws \invalid_parameter_exception If the provided identifier contains invalid characters
4041 */
4142 public function __construct (string $ identifier = '' ) {
4243 global $ USER ;
@@ -47,6 +48,12 @@ public function __construct(string $identifier = '') {
4748 $ identifier = self ::DEFAULT_IDENTIFIER ;
4849 }
4950 }
51+
52+ if (!preg_match ('/^[A-Za-z0-9_\- ]+$/ ' , $ identifier )) {
53+ $ debuginfo = 'Tenant identifiers can only contain alphanumeric letters, hyphens, underscores or blank spaces. ' ;
54+ throw new \invalid_parameter_exception ($ debuginfo );
55+ }
56+
5057 $ this ->identifier = $ identifier ;
5158 }
5259
You can’t perform that action at this time.
0 commit comments