Delete access right by process code

Hi all,

I'm trying to delete access rights by code in a process. I've tried the following, but it can find the table "SyAccountRight".


public virtual void DeleteAllRights(UserConnection uc, Guid recordId, string sSchemaName)
	string sRightSchemaName = "Sys" + sSchemaName + "Right";
	var esqRights = new EntitySchemaQuery(uc.EntitySchemaManager, sRightSchemaName);
		"RecordId", recordId));
	var entities = esqRights.GetEntityCollection(uc);
	foreach(Entity entity in entities)

Maybe with DBSecurityEngine, but I can't find any documentation on this class.

Like 0



I'm not sure you can use ESQ with Sys*Right tables (I don't see entity schemas for those) but I've never tried. It might work to use Delete, although I've not tried this on those tables either.

Something like this: 

var del = new Delete(UserConnection)
    .Where("RecordId").IsEqual(Column.Parameter(recordId)) as Delete;


Thanks Ryan !

Dear Jerome, 

In order to delete from rights table you can use the Delete class on the server side. 

Firstly, you need to get the userConnection in order to pass it in the Delete query:

var userConnection = Get<UserConnection>("UserConnection"); 

After that you can create a delete query:

var delete = new Delete(userConnection)


//add conditions




And execute it:


Here is more info on the Delete class in the development manual:…



Ryan Farley,

I have tried using delete . It is not deleting the record and no errors found.


Pavan Manne,


You can find an example of how to edit access right via code inside the system in the schema ChangeAdminRightsUserTask.

In there you can find methods AddRecordRight/DeleteRecordRight, you need to realize something similar to them.


Show all comments