cancel
Showing results for 
Search instead for 
Did you mean: 

who can create sites

boneill
Star Contributor
Star Contributor
Hi all,

Can all users create new sites in share.  Managers can manage sites, as in add users, but can I limit the users that have permission to create sites.  How do you create a user so that they are a manager?

Regards

Brian
12 REPLIES 12

mikeh
Star Contributor
Star Contributor
Can all users create new sites in share. Managers can manage sites, as in add users, but can I limit the users that have permission to create sites.
Currently any user can create a site; there's no way of limiting this today.

How do you create a user so that they are a manager?
You don't - you grant permissions to a user on a site-by-site basis in the Members page for that Site.

Thanks,
Mike

alexander
Champ in-the-making
Champ in-the-making
Is it by design? I cant imagine any corporate or managed service provider feeling good about that fact.

Any pointers on what is required to be changed (Java components, Web Scripts) to limit this feature to "Administrators" group?

Thanks
Alexander

mikeh
Star Contributor
Star Contributor
The easiest way would be to put a user/permissions check in an overridden copy of "sites.post.json.js" in the Repository.

Mike

alexander
Champ in-the-making
Champ in-the-making
Thanks Mike

Alexander

boneill
Star Contributor
Star Contributor
Thanks mike.  Is this something that is on the Roadmap for future.

Regards

mikeh
Star Contributor
Star Contributor
Not currently: http://wiki.alfresco.com/wiki/Roadmap

…but please feel free to suggest it as an Enhancement in JIRA.

Thanks,
Mike

jtp
Champ in-the-making
Champ in-the-making
I would vote for it.

alexander
Champ in-the-making
Champ in-the-making
According to Mikes's suggestion, placing the code below into "<alfresco dir>/tomcat/shared/classes/alfresco/extension/templates/webscripts/org/alfresco/repository/site/sites.post.json.js" solves the problem:

function main()
{
   
   //Code below is added to check if user has administrator permissions
   if (person == null || !people.isAdmin(person))
   {
      status.setCode(status.STATUS_BAD_REQUEST, "Site creation is not allowed, your have to be an  Administrator");
      return;
   }

   // Get the details of the site
   var shortName = json.get("shortName");
   if (shortName == null || shortName.length == 0)
   {
      status.setCode(status.STATUS_BAD_REQUEST, "Short name missing when creating site");
      return;
   }

   // See if the shortName is available
   var site = siteService.getSite(shortName);
   if (site != null)
   {
      status.setCode(status.STATUS_INTERNAL_SERVER_ERROR, "error.duplicateShortName");
      return;
   }

   var sitePreset = json.get("sitePreset");
   if (shortName == null || shortName.length == 0)
   {
      status.setCode(status.STATUS_BAD_REQUEST, "Site preset missing when creating site");
      return;
   }
   
   var title = json.get("title");
   var description = json.get("description");
   var isPublic = json.getBoolean("isPublic");
   
   // Create the site
   var site = siteService.createSite(sitePreset, shortName, title, description, isPublic);
   
   // Put the created site into the model
   model.site = site;
}

main();   

ednargocat
Champ on-the-rise
Champ on-the-rise
I can't find that … i only have bootstrap and mt directories in the extension directory.