Servoy 8.3 launch part 2: Multi-Tenancy
Servoy 8.3 launch part 2: Multi-Tenancy
Good morning, good afternoon or good evening depending on where you are and welcome from sunny California where I’m Presenting from today. My name is the amelman. I’m the founder of Servoy and with me today is John Devlin one of the most senior engineers at Servoy and he’s been leading the Development and release of Servoy8.3 and as such also presenting The launch webinar series this week, which is quite exciting. I thought it was a part two Sean, but your flights as part one Should be an interesting update today. Yeah Yeah, I think that’s the I forgot to change the lead in slide But hopefully that’s the worst part of the webinar Okay, and what are we gonna talk about today? so today We are gonna talk about multi-tenancy Which has been Really a part of the platform since the beginning of the product But in 8.3 we’re gonna make it even easier and we’ve also added some performance enhancements around multi-tenancy and data broadcasting Cool all right, well, let’s get started if anybody has any questions Feel free to post them in the questions channel or if you have suggestions or comments then that’s the place to To put them in So feel free to do that as the presentation rolls on and we’ll pick up some questions during and at the end of this session And hopefully the next 20 25 minutes. We’re gonna learn everything about multi-tenancy in Servoy 8.3 Okay, well as is the tradition we’re gonna start with some demos and then we’ll review What we saw and how we did it so I’m gonna jump right into a demo about the basic multi-tenancy And then we’ll talk a bit about advanced data filtering because we added some We added some enhancements around filtering in general And we’ll talk a bit about performance enhancement around sort of siloing the data broadcast events So I’m going to switch over to My browser is my screen visible. Yeah Yes, I can see your browser in the nice graph here. Okay, good Okay, so what we’re looking at here is actually a Security management console which comes with a an extension This the security extension for Servoy That’s not really the focus here. There’s a separate webinar about that but what I wanted to show was that I have a set up here with multiple tenants and if I jump into One of my tenants here you can see that I have three users And I’m gonna show a bit about logging in with with these users and I’m gonna look at another tenant here demo which has only one user and we’re gonna log in with with both users are both tenants and we’re gonna see The multi tenant filtering applied and we’ll also use those three users that I showed you Here to just talk about advanced filters, so I want to take a look at them You can see that I have myself and if I look at my roles I have a North America role and If I look at my colleague Jan because he is the founder of Servoy and he’s based in the US but also Hales from the Netherlands. We give him two permissions here Europe and North America and We have one other user here Juan who is in South America, so we give him the South America role and we’re gonna see that a bit later to sort of remember that we’re gonna see that a bit later in When we talk about advanced filtering So let’s switch solutions here because I’m running from developer We can only have one active solution at a time, so I’m gonna jump into example multi-tenancy And So first I’m gonna log in as myself and the tenant you’ll notice is Servoy And You can see that there’s an owner column on my customer records here And we’re seeing all the records from the Servoy tenant the same is true if I go to products Borders There’s the owner column there, so what I want to do is log out I Mean a change to the demo Tenant and I’m gonna log back in again and I only have two records in in this table for that for that tenant You can see that if I were to add a new customer Just put it a little bit of information And save it The owner was was added automatically So that the next time when I am logging in it’s either filtered in or filtered out So typically that’s that’s been fairly straightforward to set up, but it requires some steps And I want to show what I did in Developer to get this effect Because now it’s actually quite a bit easier So the first thing I want to show is a a New action that you can launch from developer if you right click any database server You’ll see an option here flag tenant columns And what you can do is type in the name of What column in your tables and this is if they’re named consistent across your database I’ll show you what you can do if they’re not in a minute, but you put something in in my case It was owner It doesn’t create the column it just sets a flag on it the column has to already be there If I look at one of my tables here And I select the owner column What basically what that does is it goes through every table and it if it has a column with that name it applies this flag tenant now you could have Tables where the tenant column is different or they don’t have one So you can do that manually on each call What that does is it just writes The flag in the dbi file which is stored in your resources project so That applies to all the solutions that share that resources project Now the next thing that you would have to do is to apply who the current tenant is now I’m using an extension to help manage security and have Basically it’s a security database with users and tenants and groups and things like that But in this application If I look at the on-solution open event What I do is I I’m calling this this line of code here Security dot set tenant value and that would be located here in the security API of the solution explorer And you can see it there Set tenant value and that’s basically going to be you know a number uid a string Which is going to match on What’s in that tenant column in those tables? And so what this does is it it goes through your databases in any any tables in any databases that have that tenant flag set It’s actually applying the filter for you. So in the past if you were doing this you’d have to call database manager add table filter parameter and and do it that way This does that automatically for you and it also It also sets with the auto enter value will be so even though my owner Auto enter I haven’t set It’s doing it automatically So I don’t have to go through on every column and set That the auto enter is going to be some variable like current tenant. That’s all done internally now And the third thing it does is it it actually limits Data broadcasting within that tenant and that’s the performance enhancement I was talking about so Data broadcast events will only be pushed within client sessions that are have the same tenant value applied so basically I did the setup of Setting the tenant flag and then calling this one line of code and that that does those three things The next example that I want to show you is Is another feature that was added in eight three which is the ability to filter tables or found sets based on something more complex so typically it was A data provider name an operator like equals or like or you know greater than And then a value and you could apply them that way. It was traditionally difficult to to do joints or Logicals like ands and ores and you know basically a complex kind of query and have it set and be a persistent filter So I’m going to use my Servoy tenant and Log in as myself again And you’ll notice that If I go to my orders table It’s only showing me orders in north America because I had that north America privilege So I see Canada Mexico and USA If I search for something like Germany I get I get no results If I log out and Log in as my colleague Yion Remember he had both Europe and North America You can see that we’re getting all of the oops, that’s the customer table You can see we’re getting all the European countries so Germany is okay USA is okay But maybe Brazil We still get no results And finally I’ll log back in as my other colleague Juan In South America. He had the South American privilege Um Something went wrong there. Oh, no, it’s orders. I didn’t do the other table So now you can see Brazil Venezuela etc But of course Nothing in North America And nothing in Europe Okay, so again, it’s It’s filtered but in this case we needed a join and you couldn’t do that with filter parameters Previously, so let’s take a look at the code Now on solution open. I’m calling this method filter orders And down here is where I apply that advanced filter And you can see that what I start with is a QB select object So I create a query against the orders table And then I’m using again, this is part of that security extension But that’s not the point of this webinar the point of this webinar is just how to do the filter It could be managed some other way But I’m basically checking if they have the North American role Then I apply this filter and you’ll notice that I’m doing the join here orders to customers Because I I couldn’t do that with the regular database manager add filter per amp because it doesn’t let you do joins And so then I do an or here and basically it builds up the privileges Of those ores which you couldn’t do ores either With a traditional database filter parameter. So now it’s really possible to get complex filters without having to Do some sort of weird query stuff that you try to apply every time you run a search or something It’s really a persistent filter. The other thing is that this applies to found set filter Brams as well both are supported with the query object Okay, and then for the third demonstration what I’d like to show is Really the data broadcasting So I’m I guess I’ll log back in as myself with the Servoy tenant and What I’m going to do is Launch because I’m in running developer I can’t have more than one debug client of a certain type at the same time so I’m going to launch the classic web client We’re going to miss some of the styling I Want to make I’m going to be in this well, I’m going to be in the separate tenant first So I’m going to log in this time as the demo tenant And you can see my three records here it is filtered but over in this client I’m logged in as the Servoy tenant So what I want to demonstrate is that if I make a change here and I’m showing a dialogue on on data broadcast So I’m going to update The city say from Amsterdam to I don’t know New York And I’m going to save that so that record’s been committed to the database Over here. I’m not even in that that tenant so I really don’t care to get a data broadcast Nothing happened. No event was pushed now. What I’m going to do is is log out Come back in as the demo tenant And I’m going to come over here to Let’s do demo company to and rename this to Los Angeles and save And you can see over in the first client I am showing the dialogue on the data broadcast event because we’re in the same tenant In in those sessions the data broadcast event is Is pushed I’m not doing any logic to do that because we really want to limit the the event for performance reasons So we don’t even have to worry about that and you can see that this second company was updated to Los Angeles If I if I show you the code for that If we look at the solution properties for example Multitenacy there is an on data broadcast event handler and All I’m doing is I was limiting it to just customers in this case But I’m making this bigger. I’m checking the data source and if it’s customers then I I show the dialogue That the broadcast event happened so I’m not checking it for the tenant or anything that’s done automatically Okay So Let’s quickly review what we saw The first thing we did is we applied the tenant columns in the database and you can do that by right clicking the database connection And if you if you select flag all tent flag tenant columns It’ll do all columns with that name in the database But you can see on the right hand picture there you can do it individually on the column level. It’s just that tenant flag Then sometime usually on on solution open you want to apply the tenant Value and that’s in the security API And you said the tenant value and that does three things it applies the data filters automatically And then it also sets the auto enter for all of those columns and it also limits data broadcast within tenants same tenants sessions Then we saw the advanced filtering and what we did there is we used the The cubie select object and sort of instead of a traditional database data filter parameter and In this case we limited it based on using a join But you could do whatever you can normally do in query builder It really just copies the wear clause of your query and applies it to all queries to that data source I Think that’s it. Y’all do we have any questions There is a couple of questions coming in yes There’s a question from mark. I assume security about set tenant value Should not be applied to a stateless web service now when you insert a record through this web service for a specific tenant Well, that also be broadcasted to just the users which are logged in using the security to set tenant value with that specific value Yeah, that’s correct anyone who who applies Call security set tenant value Will be in a silo of broadcast events so they only get it from within their tenant unless there’s no tenant Then it can go across so if you have a table that has no tenant column, then it can still broadcast to all So if you have a shared table in multi-tenancy, that’s common and there’s a change there that broadcast is propagated Okay Question from Bob can we do then can we do more than one column in with a tenant flag? Yes, that is supported so Well wait more than one column with a tenant flag I think right now it’s currently just one column. I have to check with R&D Because you can do it now you can do it on multiple because you can just go in and and select one and flag it So you get a multiple flag you just can’t do it at the The right click and set tenant value Because that just like you specify the column name and it goes through and applies it So maybe an enhancement opportunity there All right, there’s a question from Rob right can we have a combination of multiple tenants So I assume that that means can we have a tenant filter which is you know I can see company a B and C And what we decided for this feature was we see a lot of a lot of different security models and And we really Have to draw the line because people do it a lot of different ways and so we we went with just a strict tenant single tenant Kind of set up of course you can apply filters on your own And so this is this is more to do Really a separation of all the data and then if you need to do nuance filters about you know I can see three different companies or Like I showed you I can only see region and you know North America then You do that separately with with filter perhaps Okay Question from Patrice as we already have a more complex tenant is there a way to only set the tenant name in the client to use the new data broadcast limitation Yeah, I mean if you if you Don’t set a Hey tenant so I assume what you mean is you don’t want to deal with the the columns and the filtering But you do want to limit data broadcast so If you don’t set the tenant value that flag on any of the Any of the database columns then the filtering won’t won’t really apply to anything But that is also a property of a of a stateful session And so if you want to limit data broadcasts there then you could do that But it’s it’s really going to look for those tables that have that value So I don’t quite know how that would work Maybe you could create an extra column that you sort of concatenate some stuff together and And you use that I don’t know Okay There’s a question from Imra Does the tenant name uniqueness needs to be configured on DB column level or is it done within Servoy? I’m not sure what the question if it maybe you do Well, so there There isn’t a tenant’s table in this setup now I had a I had a I had a I had the security extension which does have a tenant stable That’s why I was able to show you you know the that one console at the beginning where it showed the different tenants and the different users but but the uniqueness of a tenant isn’t Isn’t really in play because there is no tenant stable by default. It’s just You know a stateful session value plus some filters that you might apply So that would be up to you if you had your own tenant stable if you if you use the extension that I was using here Then the uniqueness is built in Okay Last question from mark When you flag the tenant column is this a one-time action or is this applied to future new columns with the same name If not, maybe this is something to have in the developer preferences I see yeah, I believe it’s a one-time action It’s sort of shorthand for going into each column and and making that flag So yeah, I guess that’s an opportunity for an enhancement to To have a setting where you could apply it To tables as they’re added although You know, it’s probably not too much work to just say okay every time I add a table, you know Set that you know re re run that and it’ll it’ll do it for you automatically, but it could probably be automated All right, but those are the questions for today Of course if anybody else has additional questions or questions in the future then feel free to join the discussion on the forum That’s the right place to continue the discussion. We’ll be keeping an eye on it make sure to Download server 8.3 and try it out for yourself So if there’s any issues that you can find them in time before it goes live very soon out of early scandied it And last but not least what is the topic for prior nature Friday is going to be about client design mode So customizing the user interface in the ng client And that happens to be my favorite feature of server 8.3 I look forward to that. Thanks. I hope for presenting it. Thanks everybody for attending. Thank you