📜 ⬆️ ⬇️

Easla.com integration features

No modern electronic document management system is unthinkable without the possibility of integrating it into the existing information space of an organization using API or communication protocols.



No exception and easla.com .

Authorization and import of users


First of all, easla.com allows employees of the organization to authenticate in several ways. The first is, of course, authorization using an easla.com account. Second, authorization via social networks. And third, authorization using the organization’s domain . Yes, the online system allows you to log in through a domain! I'm not kidding.
')
Obviously, for authorization through the organization's domain, the administrator must make the appropriate configuration in easla.com and in the domain itself. In the domain it is recommended to create additional. a user who has a limited set of rights sufficient to read data about users and only. Open the port or tunnel to the domain. The domain administrator must decide for himself what is simpler, more convenient and safer.

On the easla.com side, you need to register the IP domain, login and password, as well as the path for access to users. Check the connection and, if successful, import the users from the domain. If users are already created, then you can not import, although the import makes life easier for the administrator.



By the way, when importing users, not only the last name, first name, middle name, login and email are imported. mail, but all the necessary attributes, as well as the position and department.



Import from LDAP visually displays previously imported users, their status (blocked or not). In addition, contains a hyperlink to an existing account in easla.com . If there are many changes on the domain side, say, there was a “mass migration” of users from one cabinet to another and their phone numbers and cabinet numbers changed, you can update the data in the system with one button “Update all imported users”.
All with care about the administrator!

Mail server


Of course, easla.com has its own mail server, but letters sent with it will be on behalf of the same virtual user. But most employees are accustomed or accustomed to responding to incoming messages without looking at the sender's address and despite the warning that this is unnecessary. As a result, the letters go nowhere.
You can teach users to adequately perceive e-mail messages from the system, but you can do otherwise — use the organization’s mail server. Setting easla.com allows you to specify the name of the mail server of the organization, port, username and password. After that, if the from parameter is filled in the sendEmail function, the letter will leave the organization's mail server, and if the from parameter is not specified, then the easla.com mail server.



SOAP


The easla.com system provides all registered administrators and users with access to data via the SOAP protocol. The description of functions can be found on the links (only for authorized users and administrators):
https://easla.com/ru/admin/soap
https://easla.com/en/user/soap

Of course, access to data for the administrator and the user is different. A user, even through SOAP, will not be able to access an object to which he does not have access rights, and the administrator has the authority to obtain data about all objects.
You can use SOAP in a variety of ways. For example, using a VBScript script:
Getting a list of outgoing emails from easla.com
Function EaslaSoapLogin(userName, password) Dim strSoap strSoap = "<s:Envelope xmlns:s=""http://schemas.xmlsoap.org/soap/envelope/"">" & Chr(13) & _ "<s:Body xmlns:xsi=""http://www.w3.org/2001/XMLSchema-instance"" xmlns:xsd=""http://www.w3.org/2001/XMLSchema"">" & Chr(13) & _ "<login xmlns=""User"">" & Chr(13) & _ "<username>" & userName & "</username>" & Chr(13) & _ "<password>" & password & "</password>" & Chr(13) & _ "</login>" & Chr(13) & _ "</s:Body>" & Chr(13) & _ "</s:Envelope>" EaslaSoapLogin = strSoap End function Function EaslaSoapLogout() Dim strSoap strSoap = "<s:Envelope xmlns:s=""http://schemas.xmlsoap.org/soap/envelope/"">" & Chr(13) & _ "<s:Body xmlns:xsi=""http://www.w3.org/2001/XMLSchema-instance"" xmlns:xsd=""http://www.w3.org/2001/XMLSchema"">" & Chr(13) & _ "<logout xmlns=""User""/>" & Chr(13) & _ "</s:Body>" & Chr(13) & _ "</s:Envelope>" EaslaSoapLogout = strSoap End function Function EaslaSoapOutgoings() Dim strSoap strSoap = "<?xml version=""1.0"" encoding=""UTF-8""?>" & Chr(13) & _ "<soap:Envelope xmlns:soap=""http://schemas.xmlsoap.org/soap/envelope/"" xmlns:xsi=""http://www.w3.org/2001/XMLSchema-instance"" xmlns:xsd=""http://www.w3.org/2001/XMLSchema"">" & Chr(13) & _ "<soap:Body>" & Chr(13) & _ "<getObjectrefs xmlns=""User"">" & Chr(13) & _ "<objectdef>" & Chr(13) & _ "<id>234</id>" & Chr(13) & _ "<pid>118</pid>" & Chr(13) & _ "</objectdef>" & Chr(13) & _ "<attributerefs>" & Chr(13) & _ "<item>crs_management_outgoing_regnum</item>" & Chr(13) & _ "<item>crs_management_outgoing_document</item>" & Chr(13) & _ "<item>crs_management_outgoing_attachments</item>" & Chr(13) & _ "</attributerefs>" & Chr(13) & _ "<conditions>" & Chr(13) & _ "<item>" & Chr(13) & _ "<key>status</key>" & Chr(13) & _ "<values>" & Chr(13) & _ "<item>crs_management_outgoing_created</item>" & Chr(13) & _ "</values>" & Chr(13) & _ "</item>" & Chr(13) & _ "</conditions>" & Chr(13) & _ "</getObjectrefs>" & Chr(13) & _ "</soap:Body>" & Chr(13) & _ "</soap:Envelope>" EaslaSoapOutgoings = strSoap End function Function EaslaLogin(login, password) Dim URL URL = "https://easla.com/ru/user/soap/ws/1" Dim strSoapReq strSoapReq = EaslaSoapLogin(login, password) Dim oHttp Set oHttp = CreateObject("Msxml2.XMLHTTP") oHttp.open "POST", URL, false oHttp.setRequestHeader "Content-Type", "application/soap+xml" oHttp.setRequestHeader "charset", "utf-8" oHttp.send strSoapReq Dim strResult strResult = oHttp.responseText ',    ? dim regExp Set regExp = CreateObject("VBScript.RegExp") regExp.Multiline = True regExp.Pattern = "<ns1:loginResponse><loginResult>(.*)</loginResult></ns1:loginResponse>" 'Wscript.Echo strResult Set matches = regExp.Execute(strResult) if matches.count = 0 then EaslaLogin = false Exit Function end if EaslaLogin = (matches(0).SubMatches(0) = "true") End Function Function EaslaLogout Dim URL URL = "https://easla.com/ru/user/soap/ws/1" Dim strSoapReq strSoapReq = EaslaSoapLogout() Dim oHttp Set oHttp = CreateObject("Msxml2.XMLHTTP") oHttp.open "POST", URL, false oHttp.setRequestHeader "Content-Type", "application/soap+xml" oHttp.setRequestHeader "charset", "utf-8" oHttp.send strSoapReq Dim strResult strResult = oHttp.responseText ',    ? dim regExp Set regExp = CreateObject("VBScript.RegExp") regExp.Multiline = True regExp.Pattern = "<ns1:logoutResponse><logoutResult>(.*)</logoutResult></ns1:logoutResponse>" 'Wscript.Echo strResult Set matches = regExp.Execute(strResult) if matches.count = 0 then EaslaLogout = false Exit Function end if EaslaLogout = (matches(0).SubMatches(0) = "true") End Function Function EaslaOutgoings(ByRef ids, ByRef descriptions) Dim URL URL = "https://easla.com/ru/user/soap/ws/1" Dim strSoapReq strSoapReq = EaslaSoapOutgoings() Dim oHttp Set oHttp = CreateObject("Msxml2.XMLHTTP") oHttp.open "POST", URL, false oHttp.setRequestHeader "Content-Type", "application/soap+xml" oHttp.setRequestHeader "charset", "utf-8" oHttp.send strSoapReq Dim strResult strResult = oHttp.responseText ',    ? dim regExp Set regExp = CreateObject("VBScript.RegExp") regExp.Multiline = True regExp.Pattern = "<faultstring>(.*)</faultstring>" Set matches = regExp.Execute(strResult) if matches.count = 1 then EaslaOutgoings = false Exit Function end if EaslaOutgoings = ParseXMLToOutgoingsArray(Progress, strResult, ids, descriptions) End function Sub Reverse( ByRef myArray ) Dim i, j, idxLast, idxHalf, strHolder idxLast = UBound( myArray ) idxHalf = Int( idxLast / 2 ) For i = 0 To idxHalf strHolder = myArray( i ) myArray( i ) = myArray( idxLast - i ) myArray( idxLast - i ) = strHolder Next End Sub Function ParseXMLToOutgoingsArray(progress, strXML, ByRef ids, ByRef descriptions) Dim xmlDoc Set xmlDoc = CreateObject("Microsoft.XMLDOM") xmlDoc.async = false Dim ret ret = xmlDoc.loadXML(strXML) if (xmlDoc.parseError.errorCode <> 0) then Dim myErr Set myErr = xmlDoc.parseError ThisApplication.AddNotify "   XML " + myErr.reason end if dim nodeList Set nodeList = xmlDoc.SelectNodes("//getObjectrefsResult/item") Dim cnt, q, n cnt = nodeList.length q = 0 For Each node In nodeList dim id 'id = id_node.getElementsByTagName("value").item(0).Text id = node.getElementsByTagName("id").item(0).Text dim description description = node.getElementsByTagName("description").item(0).Text n = UBound(ids) if (n < 0) Then n = 0 ReDim Preserve ids(n + 1) ReDim Preserve descriptions(n + 1) ids(UBound(ids)) = id descriptions(UBound(descriptions)) = description q = q + 1 Next Call Reverse(ids) Call Reverse(descriptions) ParseXMLToOutgoingsArray = q End Function Dim auth auth = EaslaLogin("ORGANIZATION_CODE\User_login", "User_password") if (auth = false) then MsgBox "  easla.com  .     !", vbCritical Exit Sub end if Dim ids Dim descriptions Dim success success = EaslaOutgoings(ids, descriptions) Call EaslaLogout 



WITH#


Using EaslaAgent installed on the user's workplace, you can write modules and standalone applications in C # - now a very popular programming language. The agent will take over the user authorization, which simplifies the life of the programmer. All calls to easla.com agent also converts to the correct requests.
By the way, the agent provides the ability to display a dialog box with the list of received objects, so as not to “fence” it in each application again and again. The window looks like this:



A snippet of code that receives a list of objects from easla.com and displays them in a dialog box:
 var result = EaslaApp.getObjectrefs(object_def, new string[] { "crs_management_incoming_contragent_regnum" }, new Easla.KeyValuesPairSoap[] { new Easla.KeyValuesPairSoap() {key = "status", values = new string[] {"crs_management_incoming_created"} }, new Easla.KeyValuesPairSoap() {key = "isdeleted", values = new string[] {"0"} } }); var m = EaslaApp.ShowSelectObjectDialog(result, new Easla.KeyValuePairSoap[] { new Easla.KeyValuePairSoap() { key = "", value = "description"}, new Easla.KeyValuePairSoap() { key = " ", value = "createtime"}, new Easla.KeyValuePairSoap() { key = "", value = "status.name"}, new Easla.KeyValuePairSoap() { key = "  ", value = "attributerefs[0].values[0].values[0]"} }) as Easla.ObjectrefComplexSoap; 


SQL


Finally, add that easla.com is able to integrate into MS SQL using the CLR module. By installing the Easla.com module for MS SQL , you can directly from the SQL query request data from easla.com , process and transfer, say, to locally used systems or to reports.
A simple example:
 select @logined = [master].[dbo].[EASLAlogin](,) IF (@logined = 1) BEGIN --   ,       SELECT @organization_id = organization.id, @process_id = process.id, @objectdef_id = objectdef.id FROM [master].[dbo].[EASLAgetOrganization] ('TNGP') AS organization LEFT JOIN [master].[dbo].[EASLAgetAllProcesses] () AS process ON process.oid = organization.id LEFT JOIN [master].[dbo].[EASLAgetAllObjectdefs] () AS objectdef ON objectdef.pid = process.id WHERE process.code = 'crs_management' AND objectdef.code = 'crs_management_outgoing'; SELECT attributerefs.value('(ArrayOfAttributerefSimpleSoap[1]/AttributerefSimpleSoap[1]/values/item/node())[1]','varchar(30)') as letternum ,attributerefs.value('(ArrayOfAttributerefSimpleSoap[1]/AttributerefSimpleSoap[2]/values/item/node())[1]','varchar(30)') as regdate ,cast(attributerefs.query('(ArrayOfAttributerefSimpleSoap[1]/AttributerefSimpleSoap[3]/values/item/consist/item/revdata)')as varchar(max)) as revguid ,cast([status].query('(StatusSimpleSoap[1]/name[1]/node())')as varchar(max)) as sentstatus FROM master.[dbo].[EASLAgetobjectrefs]( @process_id, @objectdef_id,CAST(' <attributerefs> <item>crs_management_outgoing_regnum</item> <item>crs_management_outgoing_sentdate</item> <item>crs_management_outgoing_attachments</item> </attributerefs> ' AS XML) , ' <conditions> <item> <key>status</key> <values><item>crs_management_outgoing_created</item></values> </item> </conditions>', @user_id –- -  ); END IF (@logined = 1) BEGIN select @logined = 1 - [master].[dbo].[EASLAlogout]() END 


Results


Summing up, I repeat, only a truly open system has the right to live in the current environment and easla.com allows the user (in this case, rather, the administrator) to feel the full flexibility of its operation and independence in accessing data. No restrictions!

Source: https://habr.com/ru/post/300894/


All Articles