File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1111
1212use JsonSerializable ;
1313use OCP \AppFramework \Db \Entity ;
14+ use OCP \Profile \IProfileManager ;
1415use OCP \Profile \ParameterDoesNotExistException ;
1516use function json_decode ;
1617use function json_encode ;
@@ -68,7 +69,7 @@ public function setVisibilityMap(array $visibilityMap): void {
6869 foreach ($ visibilityMap as $ paramId => $ visibility ) {
6970 $ config [$ paramId ] = array_merge (
7071 $ config [$ paramId ] ?: [],
71- ['visibility ' => $ visibility ],
72+ ['visibility ' => $ this -> normalizeVisibility ( $ visibility) ],
7273 );
7374 }
7475
@@ -103,4 +104,12 @@ public function jsonSerialize(): array {
103104 'config ' => $ this ->getConfigArray (),
104105 ];
105106 }
107+
108+ private function normalizeVisibility (string $ visibility ): string {
109+ return match (strtolower ($ visibility )) {
110+ IProfileManager::VISIBILITY_SHOW => IProfileManager::VISIBILITY_SHOW ,
111+ IProfileManager::VISIBILITY_SHOW_USERS_ONLY => IProfileManager::VISIBILITY_SHOW_USERS_ONLY ,
112+ default => IProfileManager::VISIBILITY_HIDE ,
113+ };
114+ }
106115}
You can’t perform that action at this time.
0 commit comments