Esempio n. 1
0
 /** Deletes the site */
 public void deleteSite() {
   if (siteService.isSiteAdmin(AuthenticationUtil.getFullyAuthenticatedUser())) {
     AuthenticationUtil.runAs(
         new AuthenticationUtil.RunAsWork<Void>() {
           public Void doWork() throws Exception {
             // Delete the site
             siteService.deleteSite(siteInfo.getShortName());
             return null;
           }
         },
         AuthenticationUtil.getAdminUserName());
   } else {
     // Delete the site
     this.siteService.deleteSite(this.siteInfo.getShortName());
   }
 }
Esempio n. 2
0
 /**
  * Saves any outstanding updates to the site details.
  *
  * <p>If properties of the site are changed and save is not called, those changes will be lost.
  */
 public void save() {
   if (this.isDirty == true) {
     if (siteService.isSiteAdmin(AuthenticationUtil.getFullyAuthenticatedUser())) {
       AuthenticationUtil.runAs(
           new AuthenticationUtil.RunAsWork<Void>() {
             public Void doWork() throws Exception {
               // Update the site details as a site-admin
               siteService.updateSite(siteInfo);
               return null;
             }
           },
           AuthenticationUtil.getAdminUserName());
     } else {
       // Update the site details
       this.siteService.updateSite(this.siteInfo);
     }
     // Reset the dirty flag
     this.isDirty = false;
   }
 }