com.starteam
Class ImpersonateUser

java.lang.Object
  extended by com.starteam.ImpersonateUser

public final class ImpersonateUser
extends java.lang.Object

Switch the server to execute in the context of an impersonated user Useful for applications like import utilities or web clients that service multiple users by switching context.


Constructor Summary
ImpersonateUser(Server server)
          Creates a new ImpersonateUser object for the specified server.
 
Method Summary
 void enableImpersonation()
          Warning: This method is potentially very dangerous and should be used with extreme caution. Calling this method will put the server into a state in which the same server object can be used to perform operations for different users.
 void setCommandTime(DateTime time)
          Warning: This method is potentially very dangerous and should be used with extreme caution. Each command issued to a StarTeam Server can have an optional override time.
 void setCommandUser(User user)
          Warning: This method is potentially very dangerous and should be used with extreme caution. This can only be called when in impersonation mode and is used to impersonate a user for subsequent commands.
 void switchContext(User user)
          Warning: This method is potentially very dangerous and should be used with extreme caution. This can only be called when in impersonation mode and is used to specify which user will be used for subsequent operations.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ImpersonateUser

public ImpersonateUser(Server server)
Creates a new ImpersonateUser object for the specified server.

Parameters:
server - the server object
Method Detail

setCommandTime

public void setCommandTime(DateTime time)
Warning: This method is potentially very dangerous and should be used with extreme caution. Each command issued to a StarTeam Server can have an optional override time. The override time will be interpreted as the time at which the operation occurred rather than the true current time. This is useful when implementing an import utility (for instance) so that, for example, a revision of a file can be checked in to the repository and it will appear to have been checked in at some point in the past rather than at the time the import tool actually performed the checkin.

Once the value is set it will be used on all subsequent commands. To revert to using the current time this method should be called with a value of DateTime.CURRENT_SERVER_TIME.

Parameters:
time - the time to use for subsequent commands

setCommandUser

public void setCommandUser(User user)
Warning: This method is potentially very dangerous and should be used with extreme caution. This can only be called when in impersonation mode and is used to impersonate a user for subsequent commands. Note that the command will be executed at the privilege level of the impersonated user

Parameters:
user - the user on whose behalf new actions will be performed.
See Also:
ImpersonateUser.enableImpersonation()

enableImpersonation

public void enableImpersonation()
Warning: This method is potentially very dangerous and should be used with extreme caution. Calling this method will put the server into a state in which the same server object can be used to perform operations for different users. Once the server has been put into impersonation mode it cannot be put out of that mode

See Also:
ImpersonateUser.switchContext(User)

switchContext

public void switchContext(User user)
Warning: This method is potentially very dangerous and should be used with extreme caution. This can only be called when in impersonation mode and is used to specify which user will be used for subsequent operations. Note that the user (to whose context the session is being switched) should already have been logged on

Parameters:
user - the user for whom new actions will be performed.
See Also:
ImpersonateUser.enableImpersonation()


StarTeam SDK 14.0, Build 21
Copyright © 2003-2012 Borland Software Corporation. All rights reserved.