Skip to content
Snippets Groups Projects
Commit fa102cd2 authored by Robin Appelman's avatar Robin Appelman
Browse files

create the necessary groups when creating a user

parent f03874ac
Branches
No related tags found
No related merge requests found
...@@ -28,6 +28,9 @@ if( in_array( $username, OC_User::getUsers())){ ...@@ -28,6 +28,9 @@ if( in_array( $username, OC_User::getUsers())){
// Return Success story // Return Success story
if( OC_User::createUser( $username, $password )){ if( OC_User::createUser( $username, $password )){
foreach( $groups as $i ){ foreach( $groups as $i ){
if(!OC_Group::groupExists($i)){
OC_Group::createGroup($i);
}
OC_Group::addToGroup( $username, $i ); OC_Group::addToGroup( $username, $i );
} }
echo json_encode( array( "status" => "success", "data" => array( "username" => $username, "groups" => implode( ", ", OC_Group::getUserGroups( $username ))))); echo json_encode( array( "status" => "success", "data" => array( "username" => $username, "groups" => implode( ", ", OC_Group::getUserGroups( $username )))));
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment