// Set the Role ID of the Row to be inserted. // Has to be a role of the user. public Insert SetRoleID(long roleID) { try { // Here we will Add the Role ID given by the User to the Statement. // Check if the Table is syncable, then only Add the row level security. if (CloudDB.IsSyncable(tableName)) { // Lets validate if the User is allowed to write with this role. if (cdb.ValidateRoleRLS(roleID, CloudDB.CRUD.WRITE) || cdb.IsSystemUser) { // The user is allowed to write with this role. rlsType = C.RLS.ROW_RLS; rlsID = roleID; AddStatus("User is Authorized to Write in this Role"); return(this); } else { // The user is not allowed to write with this role. rlsType = C.RLS.NO_RLS; rlsID = 0; AddStatus("User is NOT Authorized to Write in this Role"); isError = true; return(this); } } else { // The table is not syncable, so we will not Add any RLS. rlsType = C.RLS.NO_RLS; rlsID = 0; AddStatus("Table is not a Syncable Table."); return(this); } } catch (Exception e) { // There was an Error. rlsType = C.RLS.NO_RLS; rlsID = 0; AddStatus("Error : " + e.Message); isError = true; return(this); } }