creategroup.php 504 B

123456789101112131415161718192021
  1. <?php
  2. OCP\JSON::callCheck();
  3. OC_JSON::checkAdminUser();
  4. $groupname = $_POST["groupname"];
  5. // Does the group exist?
  6. if( in_array( $groupname, OC_Group::getGroups())) {
  7. OC_JSON::error(array("data" => array( "message" => $l->t("Group already exists") )));
  8. exit();
  9. }
  10. // Return Success story
  11. if( OC_Group::createGroup( $groupname )) {
  12. OC_JSON::success(array("data" => array( "groupname" => $groupname )));
  13. }
  14. else{
  15. OC_JSON::error(array("data" => array( "message" => $l->t("Unable to add group") )));
  16. }