0

For some reason I lost access to one of the sites that I have configured on my sensenet. I cannot access to any configuration on "Explorer" even with the Admin user.

How can I set the permissions of the site?

Checking the logEntrie on the Database I can verify the last change permissions on the site:

<Type>SetPermissions</Type>   
<OldAcl>-(5968)|+(7):_____________________________________________+++++++++++++++++++,+(8):___________________________________________________________+++++</OldAcl>  
<NewAcl>-(5968)|+(7):_____________________________________________+++++++++++++++++++,+(8):_______________________________________________+___________+++++</NewAcl>   
<UserName>BuiltIn\Admin</UserName>   

I also verified on Nodes table that the Path, that I think it is from the default start page, is locked:

/Root/Sites/<site>/<document workspace>/(apps)/This/Browse

(I had specified the document workspace as alternative start page on site).

halfer
  • 19,824
  • 17
  • 99
  • 186
  • So you cannot even enter Content Explorer with the admin user, or you can enter it and see the tree, but cannot access one of the sensenet site content in the tree? – Miklós Tóth Jan 23 '17 at 12:29
  • Do you have multiple site content with different urls, or only the default site that you get when you install sensenet? – Miklós Tóth Jan 23 '17 at 12:30
  • Another question: do you remember what you did before the issue? Was it a permission change somewhere? – Miklós Tóth Jan 23 '17 at 12:32
  • I can access to Content Explorer with admin user, and see on the tree (left side) all the content of the site. But I cannot access the content including the permissions... – Luciano Valinho Jan 23 '17 at 12:37
  • I'm not really sure what I did before... I was trying to made some permissions modifications on site and on a specific content on the site (document workspace)... I don't remember to do this action, but the only way that I think that happen is in some way the Administrators Group was removed from the security entry of the site... Yes I have a different URL to this site. – Luciano Valinho Jan 23 '17 at 12:47
  • I tried to write a detailed answer below. It is possible that you have to add permissions to the Administrators group to the Root and not the site, because by default there are no permission defined on the site for this group at all, it simply inherits them from the Root. – Miklós Tóth Jan 23 '17 at 15:16

1 Answers1

2

Assuming that the problem is that there are missing permissions for the admin group, you have two options for changing permissions in the Content Repository from the command line.

Using SnAdmin

SnAdmin is a command line tool that is able to execute packages. A package can be a huge upgrade package (provided for Enterprise customers) or a small package that is assembled manually. It is actually a zip file, containing at least a manifest.xml and optionally other stuff (e.g. sql scripts to change the db or files to import).

SnAdmin is the recommended way to make technical modifications in the repository.

In your case it would be really easy:

  • create a zip file (e.g. by the name "MyPermissionPackage.zip"), containing a single manifest.xml file (see contents below) that contains permissions setter steps.
  • copy this zip to the web\Admin directory
  • stop the IIS site
  • check that the web\Tools\SnAdminRuntime.exe.config file contains the same connection string config value as the web.config (this is important, so that the tool works with the same repository!)
  • execute the package from the command line (the main SnAdmin.exe resides in the web\Admin\bin folder, you can execute it from there)

SnAdmin.exe MyPermissionPackage

This is a sample manifest, you can add any number of steps (there is a whole library of them):

<Package type='Product' level='Tool'>
  <Name>Sense/Net ECM</Name>
  <ReleaseDate>2017-01-01</ReleaseDate>
  <Steps>
      <Phase>
          <StartRepository startWorkflowEngine="false" />
          <SetPermissions
            path="/Root/Sites/Default_Site"
            identity="/Root/IMS/BuiltIn/Portal/Administrators"
            allow="Open,RunApplication,SeePermissions,SetPermissions"
            />
    </Phase>
  </Steps>
</Package>

If everything goes well, after you start the website you'll see the changes.

(in the near future this will be a lot easier when we release built-in tool packages, so that you do not have to create packages for these common operations every time, just execute one of the tools with some arguments)

Using the Import tool

In this case you execute a regular import. You'll have to find the '.Content' files in the original source package - or create them manually, but it is easier to copy the one you want to import (e.g. the default site's content file). At the bottom of a .Content file you'll see the Permissions section, where you can define the imported permissions. In fact, you should remove the whole Fields section from the file, so that you do not overwrite any metadata fields, only import permissions.

Miklós Tóth
  • 1,490
  • 13
  • 19
  • I ended up doing restoring the database with a previous version. Fortunately I had a recently version of the database. Before this I tried using the SnAdmin command but for some reason didn't work. The command worked fine but I believe that my problem could be a different one.. Thanks for all. – Luciano Valinho Jan 23 '17 at 17:46