本文整理汇总了Java中com.atlassian.user.User类的典型用法代码示例。如果您正苦于以下问题:Java User类的具体用法?Java User怎么用?Java User使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
User类属于com.atlassian.user包,在下文中一共展示了User类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: checkAccess
import com.atlassian.user.User; //导入依赖的package包/类
public static boolean checkAccess(Attachment attachment, User user, boolean forEdit)
{
if (user == null)
{
return false;
}
PermissionManager permissionManager = (PermissionManager) ContainerManager.getComponent("permissionManager");
Permission permission = Permission.VIEW;
if (forEdit)
{
permission = Permission.EDIT;
}
boolean access = permissionManager.hasPermission(user, permission, attachment);
return access;
}
开发者ID:ONLYOFFICE,项目名称:onlyoffice-confluence,代码行数:19,代码来源:AttachmentUtil.java
示例2: addMembership
import com.atlassian.user.User; //导入依赖的package包/类
public boolean addMembership(User user)
{
try
{
Group group = getGreenPepperUserGroup();
getGroupManager().addMembership(group, user);
return true;
}
catch (Exception ex)
{
log.error("Adding membership of user '" + user.getName() + "'", ex);
return false;
}
}
开发者ID:strator-dev,项目名称:greenpepper,代码行数:17,代码来源:GreenPepperUserGroup.java
示例3: getRemoteUser
import com.atlassian.user.User; //导入依赖的package包/类
public User getRemoteUser()
{
HttpServletRequest request = ServletActionContext.getRequest();
if (request != null)
{
String remoteUserName = request.getRemoteUser();
if (remoteUserName != null)
{
return getUserAccessor().getUser(remoteUserName);
}
}
return AuthenticatedUserThreadLocal.getUser();
}
开发者ID:strator-dev,项目名称:greenpepper,代码行数:17,代码来源:ConfluenceGreenPepper.java
示例4: addMembership
import com.atlassian.user.User; //导入依赖的package包/类
/**
* <p>addMembership.</p>
*
* @param user a {@link com.atlassian.user.User} object.
* @return a boolean.
*/
public boolean addMembership(User user)
{
try
{
Group group = getGreenPepperUserGroup();
getGroupManager().addMembership(group, user);
return true;
}
catch (Exception ex)
{
log.error("Adding membership of user '" + user.getName() + "'", ex);
return false;
}
}
开发者ID:strator-dev,项目名称:greenpepper,代码行数:23,代码来源:GreenPepperUserGroup.java
示例5: enable
import com.atlassian.user.User; //导入依赖的package包/类
/**
* Returns a message if an exception occures.
* <p/>
*
* @param spaceKey
* Space Key
* @return a message if an exception occures.
* @throws com.greenpepper.server.GreenPepperServerException if any.
*/
public String enable(String spaceKey) throws GreenPepperServerException {
try {
if (!isServerReady()) {
return getText(SERVER_NOCONFIGURATION);
}
final User activeUser = getRemoteUser();
if (activeUser == null) {
return getText(ANONYMOUS_ACCESS_DENIED);
}
if (!getGreenPepperUserGroup().hasMembership(activeUser)) {
return getText(USER_NOTMEMBEROF_GREENPEPPERUSERS_GROUP);
}
Repository repository = getHomeRepository(spaceKey);
getGPServerService().getRegisteredRepository(repository);
return null;
} catch (GreenPepperServerException e) {
log.info(e.getMessage());
return getText(e.getId());
}
}
开发者ID:strator-dev,项目名称:greenpepper,代码行数:34,代码来源:ConfluenceGreenPepper.java
示例6: newFriendlyDateFormatter
import com.atlassian.user.User; //导入依赖的package包/类
protected FriendlyDateFormatter newFriendlyDateFormatter() {
// Get current user's timezone, or default one
User authUser = AuthenticatedUserThreadLocal.getUser();
TimeZone timeZone;
if (authUser == null) {
// anonymous
timeZone = TimeZone.getDefault();
} else {
ConfluenceUserPreferences prefs = userAccessor
.getConfluenceUserPreferences(authUser);
timeZone = prefs.getTimeZone();
}
// Build date formatter
DateFormatter dateFormatter = new DateFormatter(timeZone,
formatSettingsManager, localeManager);
// Build "friendly" date formatter
FriendlyDateFormatter friendlyDateFormatter = new FriendlyDateFormatter(
new Date(), dateFormatter);
return friendlyDateFormatter;
}
开发者ID:baloise,项目名称:dashboard-plus,代码行数:22,代码来源:StatusLightBasedMacro.java
示例7: newNumberFormatter
import com.atlassian.user.User; //导入依赖的package包/类
protected NumberFormat newNumberFormatter() {
// Get current user's timezone, or default one
User authUser = AuthenticatedUserThreadLocal.getUser();
NumberFormat result = null;
if (authUser != null) {
ConfluenceUserPreferences prefs = userAccessor
.getConfluenceUserPreferences(authUser);
if (prefs != null && prefs.getLocale() != null) {
result = NumberFormat.getNumberInstance(prefs.getLocale());
}
}
if (result == null) {
// anonymous
result = NumberFormat.getNumberInstance();
}
return result;
}
开发者ID:baloise,项目名称:dashboard-plus,代码行数:18,代码来源:StatusLightBasedMacro.java
示例8: getAccess
import com.atlassian.user.User; //导入依赖的package包/类
@Nonnull
@Override
public ViewAccess getAccess() {
return new ViewAccess() {
@Nonnull
@Override
public Visibility checkView(@Nullable User forUser, @Nullable User target) {
Visibility result = Visibility.forbidden;
for (final ElementModel elementModel : GroupSupport.this) {
final Visibility candidate = elementModel.getAccess().checkView(forUser, target);
if (Visibility.isBetterVisibility(candidate, result)) {
result = candidate;
}
}
return result;
}
};
}
开发者ID:echocat,项目名称:adam,代码行数:19,代码来源:GroupSupport.java
示例9: renderXhtml
import com.atlassian.user.User; //导入依赖的package包/类
@Nonnull
@HtmlSafe
protected String renderXhtml(@Nonnull ElementModel model, @Nullable User currentUser, @Nonnull Profile profile, @Nullable String value, @Nonnull String mode, @Nullable Hints hints) {
final Map<String, Object> context = defaultVelocityContext();
context.put("readOnly", !isRenderOfEditAllowedFor(model, currentUser, profile));
context.put("value", value);
context.put("elementModel", model);
context.put("currentUser", currentUser);
context.put("profile", profile);
context.put("wikiStyleRenderer", _wikiStyleRenderer);
context.put("renderContext", new RenderContext());
context.put("pageContext", new PageContext());
context.put("nodeId", nodeIdFor(model, profile));
context.put("elementRenderer", this);
context.put("hints", nonNullHints(hints));
context.put("enableUserLinkIfPossible", enableUserLinkIfPossible);
context.put("fullNameTagName", fullNameTagName);
final String templateName = getXhtmlTemplateNameFor(model, mode);
return getRenderedTemplate(templateName, context);
}
开发者ID:echocat,项目名称:adam,代码行数:21,代码来源:ElementRenderer.java
示例10: getHtml
import com.atlassian.user.User; //导入依赖的package包/类
@Override
public String getHtml(@Nullable Map<String, Object> context) {
final User currentUser = findCurrentUserOf(context);
final User user = findUserOf(context);
final Profile profile = findProfileFor(user);
final List<Group> groups = asImmutableList(_groupProvider);
final Locale locale = getLocaleFor(currentUser);
final Map<String, Object> velocityContext = defaultVelocityContext();
velocityContext.putAll(context);
velocityContext.put("currentUser", currentUser);
velocityContext.put("user", user);
velocityContext.put("profile", profile);
velocityContext.put("groups", groups);
velocityContext.put("elementRenderer", _elementRenderer);
velocityContext.put("groupRenderer", _groupRenderer);
velocityContext.put("localizationHelper", _localizationHelper);
velocityContext.put("locale", locale);
velocityContext.put("wikiStyleRenderer", _localeManager);
velocityContext.put("rendererContext", new RenderContext());
final String templateName = getTemplateNameFor(currentUser);
return getRenderedTemplate(templateName, velocityContext);
}
开发者ID:echocat,项目名称:adam,代码行数:26,代码来源:EditUserProfileWebPanel.java
示例11: tryExtractViewFrom
import com.atlassian.user.User; //导入依赖的package包/类
@Nullable
protected View tryExtractViewFrom(@Nullable String elements, @Nullable User currentUser) {
View result;
if (elements == null) {
result = _viewProvider.provideDefault();
} else {
final Matcher matcher = EXTRACT_VIEW_NAME_PATTERN.matcher(elements);
if (matcher.matches()) {
result = _viewProvider.provideBy(matcher.group(1));
if (result == null) {
result = _viewProvider.provideDefault();
}
} else {
result = null;
}
}
return result != null && result.getAccess().checkView(currentUser, null).isViewAllowed() ? result : null;
}
开发者ID:echocat,项目名称:adam,代码行数:19,代码来源:UserProfileMacro.java
示例12: getTemplateNameFor
import com.atlassian.user.User; //导入依赖的package包/类
@Nonnull
protected String getTemplateNameFor(@Nonnull Map<String, Object> context, @Nullable User user) {
final ConfluenceUser currentUser = AuthenticatedUserThreadLocal.get();
final String variant;
if ((user == null || !user.equals(currentUser)) && !_permissionManager.hasPermission(currentUser, VIEW, TARGET_PEOPLE_DIRECTORY)) {
variant = ".accessDenied";
} else {
final Object username = context.get("username");
if (username == null || username.toString().isEmpty()) {
variant = ".missingUsername";
} else if (context.get("user") == null) {
variant = ".unknownUser";
} else {
variant = "";
}
}
return TEMPLATE_NAME_PREFIX + variant + TEMPLATE_NAME_SUFFIX;
}
开发者ID:echocat,项目名称:adam,代码行数:19,代码来源:UserProfileMacro.java
示例13: renderViewXhtmlOfElementModelsFor
import com.atlassian.user.User; //导入依赖的package包/类
@Nonnull
protected Map<String, Object> renderViewXhtmlOfElementModelsFor(@Nonnull Column column, @Nullable User currentUser, @Nonnull Profile profile) {
final Map<String, Object> result = new LinkedHashMap<>();
for (final ColumnElementModel model : column) {
final Format format = model.getFormat();
final Object content;
if (format == Format.plain) {
content = profile.getValue(model);
} else if (format == Format.formatted) {
content = _elementRenderer.renderViewXhtml(model, currentUser, profile);
} else {
throw new IllegalArgumentException("Could not handle format " + format + " of " + column + ":" + model + ".");
}
result.put(model.getId(), content);
}
return Collections.unmodifiableMap(result);
}
开发者ID:echocat,项目名称:adam,代码行数:18,代码来源:ColumnRenderer.java
示例14: doAddRemoteUserToGreenPepperUserGroup
import com.atlassian.user.User; //导入依赖的package包/类
private void doAddRemoteUserToGreenPepperUserGroup()
{
final User remoteUser = this.getRemoteUser();
if (!gpUtil.getGreenPepperUserGroup().hasMembership(remoteUser))
{
gpUtil.getGreenPepperUserGroup().addMembership(remoteUser);
}
}
开发者ID:strator-dev,项目名称:greenpepper,代码行数:10,代码来源:DemoSpaceAction.java
示例15: checkPermissions
import com.atlassian.user.User; //导入依赖的package包/类
private void checkPermissions(Space space, String token) throws InvalidSessionException, NotPermittedException
{
User user = getUser(token);
List<String> permTypes = new ArrayList<String>();
permTypes.add(SpacePermission.VIEWSPACE_PERMISSION);
if(!gpUtil.getSpacePermissionManager().hasPermissionForSpace(user, permTypes, space))
{
throw new NotPermittedException();
}
}
开发者ID:strator-dev,项目名称:greenpepper,代码行数:11,代码来源:ConfluenceXmlRpcGreenPepperServiceImpl.java
示例16: hasMembership
import com.atlassian.user.User; //导入依赖的package包/类
public boolean hasMembership(User user)
{
try
{
Group group = getGreenPepperUserGroup();
return getGroupManager().hasMembership(group, user);
}
catch (Exception ex)
{
log.error("Verifying membership of user '" + user.getName() + "'", ex);
return false;
}
}
开发者ID:strator-dev,项目名称:greenpepper,代码行数:15,代码来源:GreenPepperUserGroup.java
示例17: enable
import com.atlassian.user.User; //导入依赖的package包/类
/**
* Returns a message if an exception occures.
* <p/>
* @param spaceKey Space Key
* @return a message if an exception occures.
* @throws GreenPepperServerException
*/
public String enable(String spaceKey) throws GreenPepperServerException
{
try
{
if (!isServerReady())
{
return getText(SERVER_NOCONFIGURATION);
}
/* BEGIN : COMMENT THIS FOR DEPLOYING TO GPS */
if (isCommercialLicense())
{
final User activeUser = getRemoteUser();
if (activeUser == null)
{
return getText(ANONYMOUS_ACCESS_DENIED);
}
if (!getGreenPepperUserGroup().hasMembership(activeUser))
{
return getText(USER_NOTMEMBEROF_GREENPEPPERUSERS_GROUP);
}
}
/* END : COMMENT THIS FOR DEPLOYING TO GPS */
Repository repository = getHomeRepository(spaceKey);
getGPServerService().getRegisteredRepository(repository);
return null;
}
catch (GreenPepperServerException e)
{
log.info(e.getMessage());
return getText(e.getId());
}
}
开发者ID:strator-dev,项目名称:greenpepper,代码行数:44,代码来源:ConfluenceGreenPepper.java
示例18: doAddRemoteUserToGreenPepperUserGroup
import com.atlassian.user.User; //导入依赖的package包/类
private void doAddRemoteUserToGreenPepperUserGroup()
{
final User remoteUser = this.getRemoteUser();
if (!gpUtil.getGreenPepperUserGroup().hasMembership(remoteUser))
{
gpUtil.getGreenPepperUserGroup().addMembership(remoteUser);
}
}
开发者ID:strator-dev,项目名称:greenpepper,代码行数:10,代码来源:DemoSpaceAction.java
示例19: hasMembership
import com.atlassian.user.User; //导入依赖的package包/类
/**
* <p>hasMembership.</p>
*
* @param user a {@link com.atlassian.user.User} object.
* @return a boolean.
*/
public boolean hasMembership(User user)
{
try
{
Group group = getGreenPepperUserGroup();
return getGroupManager().hasMembership(group, user);
}
catch (Exception ex)
{
log.error("Verifying membership of user '" + user.getName() + "'", ex);
return false;
}
}
开发者ID:strator-dev,项目名称:greenpepper,代码行数:21,代码来源:GreenPepperUserGroup.java
示例20: getRemoteUser
import com.atlassian.user.User; //导入依赖的package包/类
/**
* <p>getRemoteUser.</p>
*
* @return a {@link com.atlassian.user.User} object.
*/
public User getRemoteUser() {
HttpServletRequest request = ServletActionContext.getRequest();
if (request != null) {
String remoteUserName = request.getRemoteUser();
if (remoteUserName != null) {
return getUserAccessor().getUserIfAvailable(remoteUserName);
}
}
return AuthenticatedUserThreadLocal.getUser();
}
开发者ID:strator-dev,项目名称:greenpepper,代码行数:19,代码来源:ConfluenceGreenPepper.java
注:本文中的com.atlassian.user.User类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论