The 1C:Enterprise developers forum

#1
People who like this: 0 Yes / 0 No
Active user
Rating: 2
Joined: Jan 14, 2013
Company:

I create 1 account that login  at the same time only 1 point in 1C

 
#2
People who like this: 0 Yes / 0 No
Active user
Rating: 7
Joined: Sep 26, 2012
Company: individual

Are you set some roles for user?

 
#3
People who like this: 0 Yes / 0 No
Active user
Rating: 2
Joined: Jan 14, 2013
Company:

Hi ivan avdonin!

I want this account the same 'designer' when i'm using it, nobody can use it for login.

 
#4
People who like this: 0 Yes / 0 No
Active user
Rating: 7
Joined: Sep 26, 2012
Company: individual

You can write script at event handler BeforeStart at Managed Application Module, and function at Common module, which check another connections with same user

Code
//Managed Application Module
Procedure BeforeStart(Cancel)
   If CommonFunctions.IsAnotherUser() Then
      
      Message = "The same user already open 1c. Current connection exit.";
      
      TextMessage = New TextDocument;
      TextMessage.SetText("
      |<HT ML><HEAD>
      |<MET A content=""text/html; charset=utf-8"" http-equiv=Content-Type>
      |<MET A name=GENERATOR content=""MSHTML 9.00.8112.16464""></HEAD>
      |<BODY><h2>" + StrReplace(Message, Chars.LF, "<br>") + "</h2></BODY></HTML>");

      FilePath = GetTempFileName("html");
      TextMessage.Write(FilePath);

      #If WebClient Then 
         DoMessageBox(Message, 3);
      #Else
         RunApp(FilePath);
      #EndIf
      
      Cancel = True;
   
   EndIf;   
EndProcedure

// Common module "CommonFunctions"
Function IsAnotherUser() Export 

   CurrentConnectionNumber = InfoBaseConnectionNumber();
   UserUUID = InfoBaseUsers.CurrentUser().UUID;
   
   ConnectionArray = GetInfoBaseConnections();
   
   For each CurConnection In ConnectionArray Do
      If (Find(CurConnection.ApplicationName, "1CV8") > 0) AND (NOT CurConnection.ConnectionNumber = CurrentConnectionNumber)
         AND (NOT CurConnection.User = Undefined)
         AND (CurConnection.User.UUID = UserUUID) Then
         
         Return True;
         
      EndIf;
   EndDo;
   
   Return False;

EndFunction // CheckAnotherUser()

Edited: ivan avdonin - Nov 05, 2014 12:09 AM
 
#5
People who like this: 0 Yes / 0 No
Active user
Rating: 2
Joined: Jan 14, 2013
Company:

Hi ivan avdonin!

Thanks you.

 
Subscribe
Users browsing this topic (guests: 3, registered: 0, hidden: 0)