Permissions
This class contains functions that allow you to check the accesses of various entities and users in the application.
Description
If the entity name is available on the application
Return Function
A logical value indicating whether or not the entity is available in the application.
Parameters
value |
Description |
Type |
entityName |
The name of the entity, for example Clients is CL, Invoicing Documents is FT, Suppliers is FL, Purchases is FO |
String |
Example
´The following example first check if the entity is available before returning a list with all the series number of Invoicing Documents in the database.
If SDK.Permissions.isEntityAvailable("td")
Dim allConfigNumbers as List(Of Integer) = SDK.Query.getValues(Of Integer)("td", "ndoc")
End If
Description
If the entity type is available on the application.
Return Function
A logical value indicating whether or not the entity is available in the application.
Parameters
value |
Description |
Type |
entityType |
The type of the entity, for example Clients is GetType(ClVO), Invoicing Documents is GetType(FtVO), Suppliers is GetType(FlVO), Purchases is GetType(FoVO) |
System.Type |
Example
´The following example first check if the entity is available before returning a list with all the series number of Invoicing Documents in the database.
If SDK.Permissions.isEntityAvailable(GetType(TdVO))
Dim allConfigNumbers as List(Of Integer) = SDK.Query.getValues(Of Integer)("td", "ndoc")
End If
Description
If the entity name is available on the application and the current user has the respective access.
Return Function
A logical value indicating whether or not the entity is available in the application and the current user has the respective access.
Parameters
value |
Description |
Type |
entityName |
The name of the entity, for example Clients is CL, Invoicing Documents is FT, Suppliers is FL, Purchases is FO |
String |
permission |
Is the type of permission checked, by default the query/view permission is used, for more detail . This parameter is optional and the default value is "PermissionsTypes.View" |
ENUM PHCDataLayer.PermissionsType |
Example
´The following example first check if the entity is available and the user have Edit access to it before returning a list with all the series number of Invoicing Documents in the database.
If SDK.Permissions.isEntityAvailable(GetType(TdVO),PermissionsTypes.Edit)
Dim allConfigNumbers as List(Of Integer) = SDK.Query.getValues(Of Integer)("td", "ndoc")
End If
Description
If the entity name is available on the application and the current user has the respective access.
Return Function
A logical value indicating whether or not the entity is available in the application and the current user has the respective access.
Parameters
value |
Description |
Type |
entityType |
The type of the entity, for example Clients is GetType(ClVO), Invoicing Documents is GetType(FtVO), Suppliers is GetType(FlVO), Purchases is GetType(FoVO) |
System.Type |
permission |
Is the type of permission checked, by default the query/view permission is used, for more detail . This parameter is optional and the default value is "PermissionsTypes.View" |
ENUM PHCDataLayer.PermissionsType |
Example
´The following example first check if the entity is available and the user have Edit access to it before returning a list with all the series number of Invoicing Documents in the database.
If SDK.Permissions.isEntityAvailable(GetType(TdVO),PermissionsTypes.Edit)
Dim allConfigNumbers as List(Of Integer) = SDK.Query.getValues(Of Integer)("td", "ndoc")
End If
Description
Checks if the user currently logged on has access to the features of a given add-on.
Return Function
A logical value indicating whether or not the user currently logged on has access to the features of a given add-on.
Parameters
value |
Description |
Type |
addonID |
The identifier of the add-on to check for availability |
String |
Example
´The following example first checks if the user currently logged on has access to the features of the add-on identified by "u123_test" before returning a list with all the series number of Invoicing Documents in the "u123_table" that is part of the add-on.
If SDK.Permissions.isUserAddonAvailable("u123_test")
Dim allConfigNumbers as List(Of Integer) = SDK.Query.getValues(Of Integer)("u123_table", "ndoc")
End If
Description
Check if the application has some product.
Return Function
A logical value indicating whether or not the application has some product
Parameters
value |
Description |
Type |
productId |
The identifier of the product to check for availability |
ENUM PHCLibrary.Products |
Example
´The following example check if the product "Agenda" is available in this application
Dim hasAgenda as boolean = SDK.Permissions.UserHaveProduct(Products.Agenda)
Products = (POS,Documents,VENDAS,STOCKS,COMPRAS,TESOURARIA,ANALISES,Agenda,UBLESPAP2_1)