logo

NJP

#2 Create different ACL in ServiceNow | How to create ACL in ServiceNow

Import · Feb 15, 2021 · video

[Music] please subscribe to my channel and click on the bell icon to get the regular updates of my channel and do not forget to like comment and share hello everyone welcome back to sas with servicenow this is part two of creating acl in servicenow in this tutorial you will learn to create different types of acls in servicenow practically in my personal developer instance in order to show you this demo i will create two tables in service now one as parent table and other as child table i will also create a user and show you the access by impersonating the same user that how that user can access different records or what kind of access that user will have once i will create or delete or configure different types of acls in different tables we will create this is my personal developer instance i will start with creating these two tables first in order to create table i will just quickly go to here under system definition i have these tables module and it will open these list of tables we have in the system i will click on new so that i can create a new table now first i will create the parent table so here i will mention acl youtube demo tab and we will have this name here and i'm not going to extend this table right now we have here we have create module so i will create the module and this will be added under self service automatically and i will also create some fields so that we can apply different filters as well so i will select here let's say i will select group and here i can select the type as reference and i will select here reference as group table says underscore user underscore group so i have this table selected i will add another field maybe i will add title and here i will just mention string that's it and yeah i think two fields are enough and i will just go to controls now here i will make this table as extensible because i will extend this table to create child table so i will check this box extensible now here we have this option create access controls now if i will check this check box this will create four default acls automatically that's a feature out of the box feature we have in service now and if you will select this one you can also specify a role which will be added to those acls now it's totally up to you that how you exactly you want to define how exactly you want to create tables as per your requirement now if i will keep this role this will also create a new role because as of now this role is not available in the system so this will also create a new role you can see that says a new racket with this value will be created automatically now in that case what i will do i will definitely create the acl and this role will also be created so i will just quickly click on save and when i will click on save this table will be created at the same time those four acls which i am talking about those will also be created so i will just go here now in the related list of this table you can see we have these four acls created and those acls are for four different operations create operation read operation write operation and delete operation that means if user will be performing these operations then these four acls will be applied overall these are table acl these are not field level acl these are table acls and if i will open these acls one by one you will see more details so you can see we have that role mentioned here and this is so you can see as of now i cannot see uh much details even i cannot edit this acl now this is one of the important point of acl in order to edit or create acl you should have security admin role at the same time you should also have elevated access for that particular session so what i will do i will go here so i have admin access so i will come here i will click on this elevate rules and here i have to check this checkbox security admin once i will do that and i will click on ok now this will allow me system will allow me to edit or create acls now you will see a difference here if i will reload the form you will see that that now a lot of fields which we have they're not grayed out i can definitely edit them so you can see this is table this is the object like where we select here we have type of acl here we have operation here we have admin override and then we have object so we have table and i have selected none here so it is table level acl so this is for read and one important thing is in this section of permission we have requires role that means if user will have this role then only user will be able to read records of this table if i go here next one i will reload it and this will also allow me to edit these like this record like these fields here we have for create operation what exactly it means this is for if user wants to create new rackets but user will be able to create new rackets only when user will have this role because this role is mentioned over here we already talked about this this particular thing in our previous video in our first video that how exactly user gets permission there are three total three sections requires roles conditions and we also have advanced where you can do scripting if i will check this box it will definitely open uh show you the script field where i can write basically a script in javascript language as per the requirement you will get but if i talk about high level uh most of most of the time if you just provide if you want to provide access to the user's virus roles then you can just add roles over here in that case until earnest user will have this role they cannot access the rackets and and for that particular operation as well even for create even for read and we also have other two those are right and the fourth one is delete that means user will not be able to delete rackets as well and we also have right that means i cannot edit the records of that particular table so these are all table level acls right now now this is our first table that's a parent table now i will create child table so let's create child table so i will go to the same module maybe this tables and this time i will select acl youtube demo child that's my another table so i will click on new and here i will select acl youtube demo chat now how exactly i will make this table which we i'm going to create child of the previous table it's quite simple i just need to select extends table and if i will select acl i got this table i will select that table now this this table will become the child of this table that means this table is basically extended from this table i will go to columns i can definitely create a new just a column just one column let's say i will just mention this caption and that's it and here i can just mention string now one thing you have to remember when i will create this column and i will create this table now the columns of parent table now that's out of the box that's a feature of of servicenow platform then if i will create a table and i will extend this table i think this is overall concept of tables like database so if i have table i'm extending it from parent table so the columns of that table will also be shown here they will not be created but they will be shown here as well so i will create the module and i will just add this module to the self service and i will just click on save so this will create the table and so you can see we got group title automatically but this these two fields they are not on this table they are they are basically inherited from our parent table now one thing you will notice that we also have these four acls these are automatically created for this this child table as well the reason behind it because we got this with this particular controls and you here we have already selected user role and we have selected this create access control checkbox that's the reason it created uh these four acls automatically and similar to what we have in parent table you will also see this new role this particular role in these acls as well that means the user who will have this role will be able to access the records in child table as well now the third thing i will do i will create new user which way basically we will impersonate and we will see different kind of access for that particular user so that you understand how exactly uh how exactly acl works with the live effects so whenever you change any acl whenever you create any acl what kind of access you restrict or what kind of access you provide to the user by changing those acl configurations so let's create a new user first so i will just go to sys user dot list so i will create a new user and new user would be i think you can select any any user you want so here i will do acl.demo that's a user id so i will put acl demo and i will just click on save so this will create the user and what i will do i will open the same instance in my another browser as well and overall i have already opened it so if you will see this is my chrome browser or and this is my this is my safari browser now in order to show you the difference i will just change the theme of this particular view so maybe i will change it to maybe i will change it for the user so i will impersonate that user first that's a acl demo so let me impersonate that user so we got this acl demo and now i will change the theme and here i have this theme so user definitely can select the theme and let's change it to maybe this one so i'm done so now at least you can see the difference so this is basically this screen that this theme is for the user whom we want to impersonate and see the access for for these tables and this one with admin access where i will do some changes and and create acls so overall we have created three things we have created uh two tables we have created users uh as well now what we will do we will see and what kind of acls we have and how exactly they work so starting with the parent racket maybe so here you can see i think we can we can talk about both so here you can see we have acl youtube demo child so this will show you the rackets of child table and here it will show you the rackets of parent table now like we have fields the similar to fields if you will create new rackets and parent table you will definitely be able to you'll not be able to see in child table but it's a vice versa if you will create rackets in child table you will be able to see in parent table so what i will do i will quickly create a new rackets so here we have a description so it's just test one i will submit this and um i think maybe i can select group here and these fields are basically from parent one so i will select network and here i can select just title one i can select title one that's it and i will create uh one more record so i will click on new and here i will just mention test two submit and here i can select a different group maybe so i have application development and here i can select title two so we have two records in child table and then i will go to parent one now you can see that i created two rackets in child table i can definitely see them in parent view as well because because child tables inherited from extended from are this parent table so i will create a new record in parent table here i can select let's say group here and i can just mention title 1 i will submit this i will create one more i will select any other group this time network cab managers maybe and i will mention here title 2 and i will submit this total we have four rackets two in child two in parent if i would click here i can only see two rackets here and four rackets here two from main table that's parent table and like own table and two from child table as well now if i will go here so here we have impersonated that user and you can see the difference that as of now here i have this acl uh youtube demo child module and here for parent table module because we created them but this user cannot see that module even if i refresh it i cannot see those modules what is the reason behind it now the reason is whenever you create a new role and when you create the module for a particular table it automatically adds when it creates when it creates a module it automatically adds that role that means user will only be able to access access the rackets or the module if user will have that role but what about the rackets let's say these are the modules but what about the rackets will this user be able to access the rackets we have in these tables let's see that so what i will do i will quickly copy the name of the table here and i will just mention here and i will type dot list let's see you can see it says security constraints that means this user does not have that role and that's the reason this user cannot access the rackets of parent table what about child if i do underscore child dot list if i do that again same message this user cannot access child as well because even for child it needs that particular role for child table now what we will do we will basically um add one of the role so let's do one thing let's go to the user maybe i think i can just quickly go to the user so yes underscore user.list now i will just open the list of users and we got acl so we have this acl demo so this is the user what i will do i will add basically one of the role let's add for child table first so if i will do that um let's type acl i think uh i can just type acl here we have uh i think this is for uh parent and this is for child so i will add it for child first because i want to show you the difference that how exactly user can access so here i have added the role and now if i refresh the window for this user you will see the difference you can see i still cannot access now sometime you might get this kind of issue now this is this happens just because of caching so what you can do maybe you can just uh unimpersonate and impersonate the same user again that is what you can try i think yep you can see that this time i can it's all about the cache so for that session maybe uh for cache for because cache was stored that's the reason user was not able to access uh the new module basically the change which we did and that basically happens most of the time for these acls so always try to maybe sometime you can you you might need to log out as well so maybe just close the browser and reopen the session so in that case you can see now this time this user can access a child table uh module and even the rackets records are accessible so if i open this open record here now i can also edit these fields because i have that access now what about the fields which are inherited from parent table so if i go back you can see we have group and title and if i just yes i can still edit it even they are inherited i can still edit the reason this table is not basically giving restricting the access because i have that role and i can definitely i definitely have right access as well and i have create access because i can see a new button here and i also have delete access i can show you that as well if i open this yes i can see delete buttons i can also delete the racket overall i have basically access to all the operations the reason behind it because i have that role now what i can do i can let's let's disable disable the acls of child table and see the difference so what i will do i will come over here and maybe i will quickly go to the acls of child table so for that i will just go to configure security rules so we have these acls table level acls now why we have if you will go to security rules why we have multiple acls because if you remember we already talked about it that overall you you have three types of acls like you have table level the actual table level acl actual table acl then you have parent table acl and then you have all table acl that is star one so that's the reason you will always see uh star table acls as well at the same time parent table and table labels table level acls so here we have these uh four acls for read create write and delete what i will do i will quickly deactivate one so i will deactivate read one so that means there are no rules what will happen and let's basically maybe deactivate this one as well we want to see the effect that what exactly will happen after deactivating all these acls now this means there are no acls available for child table now at the same time what we will do i think i can just quickly do one thing i will i will just remove this rule now if i will remove this rule what kind of access this user will have let's see that so i have removed the role however at the same time i have also disabled the acl that means child table does not have any acl so i will go to the user now here i definitely have access maybe i will end impersonation but i will re-impersonate the same user so i will impersonate here click on acl demo and you can see now i cannot access the module because in order to access the module i need that role i don't have that role but can i access the rackets because there's there are no acls in the parent in the child table now can i access the rackets the answer is no so let me show you that so the thing is i will just copy the table name and i will put it here and i will type dot list you can see i cannot access the rackets and if you remember we talked about the same scenario in our previous video the first video that's how acl execution acl permission execution works the thing is system did not find child table acl that means the main table which user is trying to access but then user will try to find whether the same table has any parent table and that parent table has any acl and we already have active parent table acls where you should have another role that is related to parent table and that's the reason this user does not have that role not even a single role and this user will not be able to access the rackets how this user can access the rackets let's say even without that rule you can still do it so i will go to the system we will we will do it for read first and then we will go one by one so we will start with read maybe i will just close all these tabs so i will start with this read one for child table acl and this is table dot none again what i will do i will just remove this requires rule what exactly we are doing so i am giving the access now and there is no permission mentioned that means even user does not have a single role that means the same role he will be able to access the rackets is it yes so let me save this i think i forgot to make it active so i have to make it active now what will happen system will check for the acl and you will see that it is going to mask parent table acl you can see that message and if i i want to continue i can just click on continue now this way this this way it will mask parentable acel and it will provide the access as per the permission mentioned in these three sections as of now no value is mentioned in these three sections so if i will go to the user now and if i will refresh this let's so yeah you can see the difference i cannot access the module the reason behind it in order to access the module you should have that role but in order to access the rackets you don't need any role because that's the reason that's that's how we we created the acl so we have that acl enabled and we we have removed that role as well so user any user even even he he doesn't have that same rule or any role especially that role which is assigned to that table user can still access the rackets of the table and if i if i try to edit now you can see one difference and i think that's the reason i wanted to show you so i can definitely read the rackets as of now we were talking about read now what about right initially if you remember we were able to edit the rackets as well that means i was able to edit with this uh user i was able to edit description field even this field as well but here i cannot add it and the reason behind it for write operation basically parent table acl is still applied because on child table the right acl is still deactivated yes you can see it is still deactivated that's the reason user is not able to edit these rackets now in order to provide access so if you before i before i show you that i just want to mention that same statement i use in order to provide access users should pass at least one acl if user will pass it then definitely user will have access moreover this also applies for for multiple acls created on the same object that's how you can create different types of acls in this case we are talking about right now right operation now so what i will do i will just open this right one first but there is still one difference which i have not shown you but i will just show you after this write operation acl so i will active uh this acl and i will activate this acl then i will remove this rule as well this way the user the same user because he doesn't have that role he will still be able to write the rackets nowadays masking i will click on continue and this is saved and this time i will reload it so i can access the records absolutely and if i will double click absolutely you can see i can edit these records i can edit these fields without any issue so this time this is for create but if you remember we were able to see a create button here at the same time let me open this record and we were able to see delete as well but now you can see i cannot access i cannot delete this record i cannot create new rackets as well what is the reason behind it because let me go here and here we have create and delete acl are still deactivated they are not active yet and because we don't have create and delete acl it is looking for parent table aslm we do have uh write not delete and create acyl on parent table that's the reason the user is not able to create new record and delete the racket but in order to provide access again i can just maybe not this one i have to just open these two which one like create one i will just activate this at the same time i will also remove the roll and i will save this and here as well this masking and for delete operation as well i will activate this i will remove the roll and i will save this this is also masking and activating so both are activated without roll and i will go to this user now and if i reload the screen you will see the difference here now i have this new button enabled automatically because of acl so i can create new record at the same time if i open the record you can see i have full right to delete this record as well but i was not able to do that before because acl was restricting it these are all table level acls which give access to the users for these different operations for table now what about fields because as you must have seen that as of now i was able to edit all the fields but what about field level acls where i want to restrict user to edit the fields maybe few fields off of any particular table so we will try to see that with parent table now so i will just go here and so as you know that for parent uh for for field level acls they're not basically created automatically you definitely have to create yourself that those are you can say that those are custom acls you have to create then only you can restrict or provide access to the users so if i talk about the tables uh fields like group and title here we have this this title and here we have i think we have different titles and we have this group as well let's say for example i want to i want to provide access to edit this field only to few users maybe the users who have that child table roll only then only user should be able to edit the rackets else not so what i will do let me just do one thing i will quickly assign basically parent table role as well so let me do that to the same user says underscore user dot list i have this acl demo so here i will assign parent table acl so i will just mention acl we have this parent table acl i will click on save and if i go to the user i will reload it now i will be able to see parent table module i cannot that's fine i just have to reimpersonate now this is happening because of cache i will impersonate the user again and yeah we can see here so we have this acl youtube demos and if i click on this i can access child records as well i can access parent table records as well so we have all those four rackets and here i can edit as well you can see i can edit these records yep i can edit the rackets without any issue but as i mentioned i want to restrict that access for this title uh field the user the user will use if user will have that child table role then only user should be able to edit this field now for that i need to create a field level acl how exactly i will do that so let me go to the main instance here and here i will go to configure security rules so i will create a new acl and that acl will be field level acl you can you have to keep selecting this type as racket operation right and here you have to select the table so you have this acl youtube demo now here you will select the table on which you want to restrict access so i will select this title and here i will select the required row and that will be acl this child one and i will save this and yep it is showing adding you can see this field level acl i will click on continue now the thing is now this user has this parent table is a role parent table acl role but this user does not have child table child table role that's the reason it can access rackets of parent table but let's see if he's able to edit these fields so if i maybe reload it and if i let's maybe open any record if i do that i can i can only see this description maybe i will open this one yes you can see here that i can edit this group field but i cannot edit this title field anymore let's see in the list as well so that you can understand because we tried to edit these fields from list view and you can see it says security prevents writing to this field which security prevents because we have and for the security that hey this user can only edit this field if he will have that child table role let's add that child table role and see the difference so this time i have this user and i will add it here and i will add that role that's our child table role i will click on save and i will come here i will reload it and you will see the difference now if i open this one i think it's still happening because of cache that's fine i will end this impersonation i will impersonate user now and i will and now you i can access a child table as well but overall we will see this one and if i let's say double click on this absolutely you can see that i can edit the field as well that's how you can create field level acls so this is how you can create different types of acls in servicenow platform as per your requirement from your customers and clients please provide your comments for any question or feedback and if you think i am able to change your learning experience in service now then do not forget to like and share the video and subscribe to my channel thanks for watching

View original source

https://www.youtube.com/watch?v=hgRQWHOV1ko