togglesubadmins.php 340 B

1234567891011121314151617
  1. <?php
  2. OC_JSON::checkAdminUser();
  3. OCP\JSON::callCheck();
  4. $username = $_POST["username"];
  5. $group = OC_Util::sanitizeHTML($_POST["group"]);
  6. // Toggle group
  7. if(OC_SubAdmin::isSubAdminofGroup($username, $group)) {
  8. OC_SubAdmin::deleteSubAdmin($username, $group);
  9. }else{
  10. OC_SubAdmin::createSubAdmin($username, $group);
  11. }
  12. OC_JSON::success();