mirror of
https://github.com/jenkinsci/jenkins.git
synced 2026-11-15 13:02:19 +00:00
more concise and IMHO discoverable way to expose /me.
git-svn-id: https://hudson.dev.java.net/svn/hudson/trunk/hudson/main@20603 71c3de6d-444a-0410-be80-ed276b4c234a
This commit is contained in:
1 parent
0a5762b6d1
commit
1a5c805584
2 files changed
+11
-24
No files matched your search
@@ -3127,6 +3127,16 @@ public final class Hudson extends Node implements ItemGroup<TopLevelItem>, Stapl
|
||||
return ManagementLink.all();
|
||||
}
|
||||
|
||||
/**
|
||||
* Exposes the current user to <tt>/me</tt> URL.
|
||||
*/
|
||||
public User getMe() {
|
||||
User u = User.current();
|
||||
if (u == null)
|
||||
throw new AccessDeniedException("/me is not available when not logged in");
|
||||
return u;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the {@link Widget}s registered on this object.
|
||||
*
|
||||
|
||||
@@ -532,27 +532,4 @@ public class User extends AbstractModelObject implements AccessControlled, Savea
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Extension
|
||||
public static class Me implements RootAction, StaplerProxy {
|
||||
|
||||
public String getDisplayName() {
|
||||
return null;
|
||||
}
|
||||
|
||||
public String getIconFileName() {
|
||||
return null;
|
||||
}
|
||||
|
||||
public String getUrlName() {
|
||||
return "me";
|
||||
}
|
||||
|
||||
public Object getTarget() {
|
||||
if (User.current() == null) {
|
||||
throw new AccessDeniedException("/me is not available when not logged in");
|
||||
}
|
||||
return User.current();
|
||||
}
|
||||
|
||||
}}
|
||||
}
|
||||
Reference in new issue
Block a user