Nicholas-Westby / usergrouppermissions

Repository for User Group Permissions source code.
MIT License
4 stars 4 forks source link

"Server Error: There was an issue communicating with the server." on permissions save #8

Closed francesconero closed 8 years ago

francesconero commented 8 years ago

When trying to set permissions using this plugin on Umbraco version 7.3.1 there is an error:

Server Error: There was an issue communicating with the server.

I am not familiar with Umbraco, so I don't really know what info to provide to better debug the issue, if you have any advice it would be great!

Nicholas-Westby commented 8 years ago

@francesconero Thanks for the report! That can happen if you are logged out of Umbraco (e.g., due to session expiration). Can you confirm that you are logged in and try again?

Also, if you could attach a screenshot of the screen/button you are clicking to reproduce this error, that would be useful.

Nicholas-Westby commented 8 years ago

Also, please look in your Umbraco log (App_Data/Logs/UmbracoTraceLog.txt). There may be an error message in that file.

francesconero commented 8 years ago

@Nicholas-Westby Thanks for the super fast response!

Here is the screenshot of the error:

usergrouppermission-error

And here is the log of what I imagine be the error (the timings match):

2015-11-30 17:42:09,276 [P7660/D9/T66] INFO  Umbraco.Core.PluginManager - Starting resolution types of Umbraco.Core.PropertyEditors.IParameterEditor
 2015-11-30 17:42:09,291 [P7660/D9/T66] INFO  Umbraco.Core.PluginManager - Completed resolution of types of Umbraco.Core.PropertyEditors.IParameterEditor, found 0 (took 23ms)
 2015-11-30 17:42:14,257 [P7660/D9/T65] INFO  Umbraco.Core.PluginManager - Starting resolution types of Umbraco.Web.Trees.TreeController
 2015-11-30 17:42:14,275 [P7660/D9/T65] INFO  Umbraco.Core.PluginManager - Completed resolution of types of Umbraco.Web.Trees.TreeController, found 0 (took 4ms)
 2015-11-30 17:42:21,794 [P7660/D9/T66] INFO  Umbraco.Core.Persistence.UmbracoDatabase -    at System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection, Action`1 wrapCloseInAction)
   at System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection, Action`1 wrapCloseInAction)
   at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj, Boolean callerHasConnectionLock, Boolean asyncClose)
   at System.Data.SqlClient.TdsParser.TryRun(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj, Boolean& dataReady)
   at System.Data.SqlClient.SqlCommand.FinishExecuteReader(SqlDataReader ds, RunBehavior runBehavior, String resetOptionsString)
   at System.Data.SqlClient.SqlCommand.RunExecuteReaderTds(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, Boolean async, Int32 timeout, Task& task, Boolean asyncWrite, SqlDataReader ds, Boolean describeParameterEncryptionRequest)
   at System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method, TaskCompletionSource`1 completion, Int32 timeout, Task& task, Boolean asyncWrite)
   at System.Data.SqlClient.SqlCommand.InternalExecuteNonQuery(TaskCompletionSource`1 completion, String methodName, Boolean sendToPipe, Int32 timeout, Boolean asyncWrite)
   at System.Data.SqlClient.SqlCommand.ExecuteNonQuery()
   at StackExchange.Profiling.Data.ProfiledDbCommand.ExecuteNonQuery()
   at Umbraco.Core.Persistence.PetaPocoCommandExtensions.<>c__DisplayClass1.<ExecuteNonQueryWithRetry>b__0()
   at Umbraco.Core.Persistence.FaultHandling.RetryPolicy.ExecuteAction[TResult](Func`1 func)
   at Umbraco.Core.Persistence.PetaPocoCommandExtensions.ExecuteNonQueryWithRetry(IDbCommand command, RetryPolicy cmdRetryPolicy, RetryPolicy conRetryPolicy)
   at Umbraco.Core.Persistence.PetaPocoCommandExtensions.ExecuteNonQueryWithRetry(IDbCommand command, RetryPolicy retryPolicy)
   at Umbraco.Core.Persistence.PetaPocoCommandExtensions.ExecuteNonQueryWithRetry(IDbCommand command)
   at Umbraco.Core.Persistence.Database.Execute(String sql, Object[] args)
Nicholas-Westby commented 8 years ago

@francesconero I just did a clean install of Umbraco 7.3.1 using all the defaults and had no problems:

screen

Can you tell me a little about your SQL setup? Is it SQL Server?

My guess is that the credentials you are using for SQL do not have enough permissions to create tables in the database. Can you confirm that you have the UserTypePermissions table in your database and that it has records in it (in my case, I'm using SQL Server CE)?:

table

francesconero commented 8 years ago

I am using SQL Server as a service on Azure, yes. But I do have the UserTypePermissions in the database, so I think it created it fine. The problem is that it's empty.

Nicholas-Westby commented 8 years ago

@francesconero Can you send me a screenshot of your table structure so I can see each field and the data type of each field (on the UserTypePermissions table)?

francesconero commented 8 years ago

Here it is: tablestructure

Nicholas-Westby commented 8 years ago

Now that I think about it, I think Azure has the peculiar requirement that it needs a clustered index on each table. Perhaps that is the issue.

I'll see if I can release a new version soon that adds an index to that table.

In the meantime, you might want to try adding a clustered index to see if that allows you to change permissions. You could probably just create a clustered index from all three fields (I don't think it has to be unique).

Nicholas-Westby commented 8 years ago

Here is some info on adding a clustered index (also has some info on Azure, if you are curious and would like to do further testing): http://parasdoshi.com/2012/03/05/do-tables-in-a-sql-azure-database-need-to-have-a-primary-key/

francesconero commented 8 years ago

Thanks will try tomorrow and report back!

Nicholas-Westby commented 8 years ago

Give the latest version (1.2.0) a try: https://our.umbraco.org/projects/backoffice-extensions/user-group-permissions/

You will likely have to delete the UserTypePermissions table for this version to work (on application start, it will recreate the table with a primary key column).

At some point, I hope to figure out Migrations so I can automate this upgrade process: https://our.umbraco.org/forum/developers/api-questions/73340-how-do-umbraco-db-migrations-work-not-upgrades

francesconero commented 8 years ago

:+1: great job, thanks!

There is now another little problem. I get an error when deselecting the last permission on a role: the result is that a role cannot have zero permissions on a node.

Any ideas?

Nicholas-Westby commented 8 years ago

@francesconero Thanks for the quick follow up report! That bug has now been fixed too (in version 1.2.1): https://our.umbraco.org/projects/backoffice-extensions/user-group-permissions/

The fix is a JavaScript change, so after you install the update, you may have to delete App_Data/TEMP/ClientDependency and App_Data/TEMP/PluginCache.

Nicholas-Westby commented 8 years ago

@francesconero Did this work out for you? I'm going to close this ticket. If you have any more issues, please don't hesitate to let me know.

francesconero commented 8 years ago

Yes, forgive me for the late reply!

No more errors, can confirm.

You were so helpful, I can't thank you enough!

sparky-dog commented 8 years ago

This worked for me too. Thanks!!