|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objecthudson.model.AbstractModelObject
hudson.model.User
@ExportedBean public class User
Represents a user.
In Hudson, User objects are created in on-demand basis;
for example, when a build is performed, its change log is computed
and as a result commits from users who Hudson has never seen may be discovered.
When this happens, new User object is created.
If the persisted record for an user exists, the information is loaded at
that point, but if there's no such record, a fresh instance is created from
thin air (this is where UserPropertyDescriptor.newInstance(User) is
called to provide initial UserProperty objects.
Such newly created User objects will be simply GC-ed without
ever leaving the persisted record, unless save() method
is explicitly invoked (perhaps as a result of a browser submitting a
configuration.)
| Nested Class Summary | |
|---|---|
static class |
User.CanonicalIdResolver
|
static class |
User.FullNameIdResolver
Resolve user ID from full name |
| Field Summary | |
|---|---|
static XStream2 |
XSTREAM
Used to load/save user configuration. |
| Fields inherited from interface hudson.model.Saveable |
|---|
NOOP |
| Method Summary | ||
|---|---|---|
void |
addProperty(UserProperty p)
Updates the user object by adding a property. |
|
boolean |
canDelete()
With ADMINISTER permission, can delete users with persisted data but can't delete self. |
|
void |
checkPermission(Permission permission)
Convenient short-cut for getACL().checkPermission(permission) |
|
static void |
clear()
Stop gap hack. |
|
int |
compareTo(User that)
|
|
static User |
current()
Gets the User object representing the currently logged-in user, or null
if the current user is anonymous. |
|
void |
delete()
Deletes the data directory and removes this user from Hudson. |
|
void |
doConfigSubmit(org.kohsuke.stapler.StaplerRequest req,
org.kohsuke.stapler.StaplerResponse rsp)
Accepts submission from the configuration page. |
|
void |
doDoDelete(org.kohsuke.stapler.StaplerRequest req,
org.kohsuke.stapler.StaplerResponse rsp)
Deletes this user from Hudson. |
|
void |
doRssAll(org.kohsuke.stapler.StaplerRequest req,
org.kohsuke.stapler.StaplerResponse rsp)
|
|
void |
doRssFailed(org.kohsuke.stapler.StaplerRequest req,
org.kohsuke.stapler.StaplerResponse rsp)
|
|
void |
doRssLatest(org.kohsuke.stapler.StaplerRequest req,
org.kohsuke.stapler.StaplerResponse rsp)
|
|
void |
doSubmitDescription(org.kohsuke.stapler.StaplerRequest req,
org.kohsuke.stapler.StaplerResponse rsp)
Accepts the new description. |
|
static User |
get(String idOrFullName)
Gets the User object by its id or full name. |
|
static User |
get(String idOrFullName,
boolean create)
Deprecated. use get(String, boolean, java.util.Map) |
|
static User |
get(String idOrFullName,
boolean create,
Map context)
Gets the User object by its id or full name. |
|
String |
getAbsoluteUrl()
The URL of the user page. |
|
ACL |
getACL()
Obtains the ACL associated with this object. |
|
static Collection<User> |
getAll()
Gets all the users. |
|
List<UserProperty> |
getAllProperties()
List of all UserPropertys exposed primarily for the remoting API. |
|
Api |
getApi()
Exposed remote API. |
|
List<String> |
getAuthorities()
Checks for authorities (groups) associated with this user. |
|
RunList |
getBuilds()
Gets the list of Builds that include changes by this user,
by the timestamp order. |
|
protected XmlFile |
getConfigFile()
The file we save our configuration. |
|
String |
getDescription()
|
|
Descriptor |
getDescriptorByName(String className)
Exposes all Descriptors by its name to URL. |
|
String |
getDisplayName()
Returns the user name. |
|
Object |
getDynamic(String token)
|
|
String |
getFullName()
Gets the human readable name of this user. |
|
String |
getId()
|
|
Set<AbstractProject<?,?>> |
getProjects()
Gets all the AbstractProjects that this user has committed to. |
|
Map<Descriptor<UserProperty>,UserProperty> |
getProperties()
Gets the user properties configured for this user. |
|
|
getProperty(Class<T> clazz)
Gets the specific property, or null. |
|
List<Action> |
getPropertyActions()
Return all properties that are also actions. |
|
String |
getSearchUrl()
Returns the URL of this item relative to the parent SearchItem. |
|
List<Action> |
getTransientActions()
Return all transient actions associated with this user. |
|
static User |
getUnknown()
Gets the fallback "unknown" user instance. |
|
String |
getUrl()
|
|
boolean |
hasPermission(Permission permission)
Convenient short-cut for getACL().hasPermission(permission) |
|
org.acegisecurity.Authentication |
impersonate()
Creates an Authentication object that represents this user. |
|
static void |
reload()
Reloads the configuration from disk. |
|
void |
save()
Save the settings to a file. |
|
void |
setFullName(String name)
Sets the human readable name of thie user. |
|
String |
toString()
|
|
| Methods inherited from class hudson.model.AbstractModelObject |
|---|
getSearch, getSearchIndex, getSearchName, makeSearchIndex, requirePOST, sendError, sendError, sendError, sendError, sendError |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
public static final XStream2 XSTREAM
| Method Detail |
|---|
public int compareTo(User that)
compareTo in interface Comparable<User>@Exported public String getId()
public String getUrl()
public String getSearchUrl()
SearchItemSearchItem.
getSearchUrl in interface SearchItem@Exported(visibility=999) public String getAbsoluteUrl()
@Exported(visibility=999) public String getFullName()
public void setFullName(String name)
@Exported public String getDescription()
public Map<Descriptor<UserProperty>,UserProperty> getProperties()
public void addProperty(UserProperty p)
throws IOException
IOException
@Exported(name="property",
inline=true)
public List<UserProperty> getAllProperties()
UserPropertys exposed primarily for the remoting API.
public <T extends UserProperty> T getProperty(Class<T> clazz)
public org.acegisecurity.Authentication impersonate()
Authentication object that represents this user.
public void doSubmitDescription(org.kohsuke.stapler.StaplerRequest req,
org.kohsuke.stapler.StaplerResponse rsp)
throws IOException,
javax.servlet.ServletException
IOException
javax.servlet.ServletException@Nonnull public static User getUnknown()
This is used to avoid null User instance.
public static User get(String idOrFullName,
boolean create)
get(String, boolean, java.util.Map)
User object by its id or full name.
create - If true, this method will never return null for valid input
(by creating a new User object if none exists.)
If false, this method will return null if User object
with the given name doesn't exist.
public static User get(String idOrFullName,
boolean create,
Map context)
User object by its id or full name.
create - If true, this method will never return null for valid input
(by creating a new User object if none exists.)
If false, this method will return null if User object
with the given name doesn't exist.context - contextual environment this user idOfFullName was retrieved from,
that can help resolve the user ID@Nonnull public static User get(String idOrFullName)
User object by its id or full name.
@CheckForNull public static User current()
User object representing the currently logged-in user, or null
if the current user is anonymous.
public static Collection<User> getAll()
public static void reload()
public static void clear()
public String getDisplayName()
getDisplayName in interface ModelObject@WithBridgeMethods(value=java.util.List.class) public RunList getBuilds()
Builds that include changes by this user,
by the timestamp order.
TODO: do we need some index for this?
public Set<AbstractProject<?,?>> getProjects()
AbstractProjects that this user has committed to.
public String toString()
toString in class Objectprotected final XmlFile getConfigFile()
public void save()
throws IOException
save in interface SaveableIOException - if the persistence failed.
public void delete()
throws IOException
IOException - if we fail to delete.public Api getApi()
public void doConfigSubmit(org.kohsuke.stapler.StaplerRequest req,
org.kohsuke.stapler.StaplerResponse rsp)
throws IOException,
javax.servlet.ServletException,
Descriptor.FormException
IOException
javax.servlet.ServletException
Descriptor.FormException
public void doDoDelete(org.kohsuke.stapler.StaplerRequest req,
org.kohsuke.stapler.StaplerResponse rsp)
throws IOException,
javax.servlet.ServletException
IOException
javax.servlet.ServletException
public void doRssAll(org.kohsuke.stapler.StaplerRequest req,
org.kohsuke.stapler.StaplerResponse rsp)
throws IOException,
javax.servlet.ServletException
IOException
javax.servlet.ServletException
public void doRssFailed(org.kohsuke.stapler.StaplerRequest req,
org.kohsuke.stapler.StaplerResponse rsp)
throws IOException,
javax.servlet.ServletException
IOException
javax.servlet.ServletException
public void doRssLatest(org.kohsuke.stapler.StaplerRequest req,
org.kohsuke.stapler.StaplerResponse rsp)
throws IOException,
javax.servlet.ServletException
IOException
javax.servlet.ServletExceptionpublic ACL getACL()
AccessControlled
getACL in interface AccessControlledpublic void checkPermission(Permission permission)
AccessControlledgetACL().checkPermission(permission)
checkPermission in interface AccessControlledpublic boolean hasPermission(Permission permission)
AccessControlledgetACL().hasPermission(permission)
hasPermission in interface AccessControlledpublic boolean canDelete()
@Nonnull public List<String> getAuthorities()
Jenkins.ADMINISTER, or any problems arise, returns an empty list.
SecurityRealm.AUTHENTICATED_AUTHORITY and the username, if present, are omitted.
public Descriptor getDescriptorByName(String className)
DescriptorByNameOwnerDescriptors by its name to URL.
Implementation should always delegate to Jenkins.getDescriptorByName(String).
getDescriptorByName in interface DescriptorByNameOwnerclassName - Either Descriptor.getId() (recommended) or the short name.public Object getDynamic(String token)
public List<Action> getPropertyActions()
public List<Action> getTransientActions()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||