function
stringlengths 87
5.09k
| validationType
stringclasses 2
values | fixed
stringlengths 289
7.12k
|
|---|---|---|
private static ThreadPoolType org.jboss.weld.executor.ExecutorServicesFactory.initThreadPoolType(WeldConfiguration configuration) {
String threadPoolTypeString = configuration.getStringProperty(ConfigurationKey.EXECUTOR_THREAD_POOL_TYPE);
try {
ThreadPoolType threadPoolType = ThreadPoolType.valueOf(threadPoolTypeString);
if (System.getSecurityManager() != null && ThreadPoolType.COMMON == threadPoolType) {
threadPoolType = ThreadPoolType.FIXED;
BootstrapLogger.LOG.commonThreadPoolWithSecurityManagerEnabled(threadPoolType);
}
return threadPoolType;
} catch (Exception e) {
throw BootstrapLogger.LOG.invalidThreadPoolType(threadPoolTypeString);
}
}
|
conventional
|
private static ThreadPoolType<method*start>org.jboss.weld.executor.ExecutorServicesFactory.ThreadPoolType<method*end> initThreadPoolType(WeldConfiguration<method*start>org.jboss.weld.config.WeldConfiguration<method*end> configuration) {
String<method*start>java.lang.String<method*end> threadPoolTypeString = configuration.getStringProperty<method*start>org.jboss.weld.config.WeldConfiguration.getStringProperty<method*end>(ConfigurationKey.EXECUTOR_THREAD_POOL_TYPE<method*start>org.jboss.weld.config.ConfigurationKey.EXECUTOR_THREAD_POOL_TYPE<method*end>);
if (threadPoolTypeString.isEmpty<method*start>java.lang.String.isEmpty<method*end>()) {
// do not create ExecutorServices by default if we do not have the "modifyThreadGroup" permission
return Permissions.hasPermission<method*start>org.jboss.weld.util.Permissions.hasPermission<method*end>(Permissions.MODIFY_THREAD_GROUP<method*start>org.jboss.weld.util.Permissions.MODIFY_THREAD_GROUP<method*end>) ? ThreadPoolType.FIXED<method*start>org.jboss.weld.executor.ExecutorServicesFactory.ThreadPoolType.FIXED<method*end> : ThreadPoolType.NONE<method*start>org.jboss.weld.executor.ExecutorServicesFactory.ThreadPoolType.NONE<method*end>;
} else {
try {
ThreadPoolType<method*start>org.jboss.weld.executor.ExecutorServicesFactory.ThreadPoolType<method*end> threadPoolType = ThreadPoolType.valueOf<method*start>org.jboss.weld.executor.ExecutorServicesFactory.ThreadPoolType.valueOf<method*end>(threadPoolTypeString);
if (System.getSecurityManager<method*start>java.lang.System.getSecurityManager<method*end>() != null && ThreadPoolType.COMMON<method*start>org.jboss.weld.executor.ExecutorServicesFactory.ThreadPoolType.COMMON<method*end> == threadPoolType) {
threadPoolType = ThreadPoolType.FIXED<method*start>org.jboss.weld.executor.ExecutorServicesFactory.ThreadPoolType.FIXED<method*end>;
BootstrapLogger.LOG.commonThreadPoolWithSecurityManagerEnabled<method*start>org.jboss.weld.logging.BootstrapLogger.commonThreadPoolWithSecurityManagerEnabled<method*end>(threadPoolType);
}
return threadPoolType;
} catch (Exception<method*start>java.lang.Exception<method*end> e) {
throw BootstrapLogger.LOG.invalidThreadPoolType<method*start>org.jboss.weld.logging.BootstrapLogger.invalidThreadPoolType<method*end>(threadPoolTypeString);
}
}
}
|
@CommandDescription(aliases = { "bat", "batch" }, usage = "<file>", desc = "Executes a Spout batch file.")
public void batch(CommandSource source, CommandArguments args) throws CommandException {
String fileName = args.popString("file");
args.assertCompletelyParsed();
CommandBatch bat = engine.getFileSystem().getResource("batch://Spout/batches/" + fileName);
bat.execute(source);
source.sendMessage("Executed " + fileName + ".");
}
|
annotation
|
@CommandDescription(aliases<method*start>org.spout.api.command.annotated.CommandDescription.aliases<method*end> = { "bat", "batch" }, usage<method*start>org.spout.api.command.annotated.CommandDescription.usage<method*end> = "<file>", desc<method*start>org.spout.api.command.annotated.CommandDescription.desc<method*end> = "Executes a Spout batch file.")
@Permissible("spout.command.batch")
public void batch(CommandSource<method*start>org.spout.api.command.CommandSource<method*end> source, CommandArguments<method*start>org.spout.api.command.CommandArguments<method*end> args) throws CommandException<method*start>org.spout.api.exception.CommandException<method*end> {
String<method*start>java.lang.String<method*end> fileName = args.popString<method*start>org.spout.api.command.CommandArguments.popString<method*end>("file");
args.assertCompletelyParsed<method*start>org.spout.api.command.CommandArguments.assertCompletelyParsed<method*end>();
if (!(source.hasPermission<method*start>org.spout.api.command.CommandSource.hasPermission<method*end>("spout.command.batch." + fileName))) {
throw new CommandException<method*start>org.spout.api.exception.CommandException<method*end>("You do not have permission to execute " + fileName);
}
CommandBatch bat = engine.getFileSystem<method*start>org.spout.engine.SpoutEngine.getFileSystem<method*end>().getResource<method*start>org.spout.api.resource.FileSystem.getResource<method*end>("batch://Spout/batches/" + fileName);
bat.execute<method*start>org.spout.api.command.CommandBatch.execute<method*end>(source);
source.sendMessage<method*start>org.spout.api.command.CommandSource.sendMessage<method*end>("Executed " + fileName + ".");
}
|
private boolean userAuthRequestHandler(HttpServletRequest request, HttpServletResponse response) {
User user = SecurityUtils.getAuthenticatedUser(userAuth);
String reqUri = request.getRequestURI();
String method = request.getMethod();
App parentApp;
if (userAuth instanceof JWTAuthentication) {
parentApp = ((JWTAuthentication) userAuth).getApp();
} else {
parentApp = SecurityUtils.getAuthenticatedApp();
}
if (userAuth != null) {
if (user == null) {
Object[] fail = doAppChecks(parentApp, request);
if (fail == null) {
return true;
} else {
RestUtils.returnStatusResponse(response, (Integer) fail[0], (String) fail[1]);
return false;
}
} else if (user.getActive()) {
if (parentApp == null) {
parentApp = Para.getDAO().read(App.id(user.getAppid()));
}
RestUtils.returnStatusResponse(response, HttpServletResponse.SC_FORBIDDEN, Utils.formatMessage("You don't have permission to access this resource. [user: {0}, resource: {1} {2}]", user.getId(), method, reqUri));
return false;
}
}
RestUtils.returnStatusResponse(response, HttpServletResponse.SC_UNAUTHORIZED, Utils.formatMessage("You don't have permission to access this resource. [{0} {1}]", method, reqUri));
return false;
}
|
conventional
|
private boolean userAuthRequestHandler(HttpServletRequest<method*start>javax.servlet.http.HttpServletRequest<method*end> request, HttpServletResponse<method*start>javax.servlet.http.HttpServletResponse<method*end> response) {
Authentication<method*start>org.springframework.security.core.Authentication<method*end> userAuth = SecurityContextHolder.getContext<method*start>org.springframework.security.core.context.SecurityContextHolder.getContext<method*end>().getAuthentication<method*start>org.springframework.security.core.context.SecurityContext.getAuthentication<method*end>();
User user = SecurityUtils.getAuthenticatedUser<method*start>com.erudika.para.security.SecurityUtils.getAuthenticatedUser<method*end>(userAuth);
String<method*start>java.lang.String<method*end> reqUri = request.getRequestURI<method*start>javax.servlet.http.HttpServletRequest.getRequestURI<method*end>();
String<method*start>java.lang.String<method*end> method = request.getMethod<method*start>javax.servlet.http.HttpServletRequest.getMethod<method*end>();
App parentApp;
if (userAuth instanceof JWTAuthentication) {
parentApp = ((JWTAuthentication) userAuth).getApp<method*start>com.erudika.para.security.JWTAuthentication.getApp<method*end>();
} else {
parentApp = SecurityUtils.getAuthenticatedApp<method*start>com.erudika.para.security.SecurityUtils.getAuthenticatedApp<method*end>();
}
if (userAuth != null) {
if (user == null) {
// special case: app authenticated with JWT token (admin token)
Object<method*start>java.lang.Object<method*end>[] fail = doAppChecks<method*start>com.erudika.para.security.RestAuthFilter.doAppChecks<method*end>(parentApp, request);
if (fail == null) {
return true;
} else {
RestUtils.returnStatusResponse<method*start>com.erudika.para.rest.RestUtils.returnStatusResponse<method*end>(response, (Integer<method*start>java.lang.Integer<method*end>) fail[0], (String<method*start>java.lang.String<method*end>) fail[1]);
return false;
}
} else if (user.getActive<method*start>com.erudika.para.core.User.getActive<method*end>()) {
if (parentApp == null) {
parentApp = Para.getDAO<method*start>com.erudika.para.Para.getDAO<method*end>().read<method*start>com.erudika.para.persistence.DAO.read<method*end>(App.id<method*start>com.erudika.para.core.App.id<method*end>(user.getAppid<method*start>com.erudika.para.core.User.getAppid<method*end>()));
}
if (hasPermission<method*start>com.erudika.para.security.RestAuthFilter.hasPermission<method*end>(parentApp, user, request)) {
return true;
} else {
RestUtils.returnStatusResponse<method*start>com.erudika.para.rest.RestUtils.returnStatusResponse<method*end>(response, HttpServletResponse.SC_FORBIDDEN<method*start>javax.servlet.http.HttpServletResponse.SC_FORBIDDEN<method*end>, Utils.formatMessage<method*start>com.erudika.para.utils.Utils.formatMessage<method*end>("You don't have permission to access this resource. " + "[user: {0}, resource: {1} {2}]", user.getId<method*start>com.erudika.para.core.User.getId<method*end>(), method, reqUri));
return false;
}
}
}
RestUtils.returnStatusResponse<method*start>com.erudika.para.rest.RestUtils.returnStatusResponse<method*end>(response, HttpServletResponse.SC_UNAUTHORIZED<method*start>javax.servlet.http.HttpServletResponse.SC_UNAUTHORIZED<method*end>, Utils.formatMessage<method*start>com.erudika.para.utils.Utils.formatMessage<method*end>("You don't have permission to access this resource. [{0} {1}]", method, reqUri));
return false;
}
|
protected IPersonAttributes getVisiblePerson(final principal, final person, final generallyPermittedAttributes) {
final permittedAttributes = person.getName().equals(principal.getKey()) ? getPermittedOwnAttributes(principal, generallyPermittedAttributes) : generallyPermittedAttributes;
final visibleAttributes = new HashMap<>();
for (attr : person.getAttributes().keySet()) {
visibleAttributes.put(attr, person.getAttributeValues(attr));
}
final visiblePerson = new NamedPersonImpl(person.getName(), visibleAttributes);
return visiblePerson;
}
|
conventional
|
protected IPersonAttributes<method*start>org.apereo.services.persondir.IPersonAttributes<method*end> getVisiblePerson(final IAuthorizationPrincipal<method*start>org.apereo.portal.security.IAuthorizationPrincipal<method*end> principal, final IPersonAttributes<method*start>org.apereo.services.persondir.IPersonAttributes<method*end> person, final Set<method*start>java.util.Set<method*end><String<method*start>java.lang.String<method*end>> generallyPermittedAttributes) {
// has permission or deny through one of the contained groups.
if (person.getName<method*start>org.apereo.services.persondir.IPersonAttributes.getName<method*end>() != null && principal.hasPermission<method*start>org.apereo.portal.security.IAuthorizationPrincipal.hasPermission<method*end>(IPermission.PORTAL_USERS<method*start>org.apereo.portal.security.IPermission.PORTAL_USERS<method*end>, IPermission.VIEW_USER_ACTIVITY<method*start>org.apereo.portal.security.IPermission.VIEW_USER_ACTIVITY<method*end>, person.getName<method*start>org.apereo.services.persondir.IPersonAttributes.getName<method*end>())) {
// If the user has permission, filter the person attributes according
// to the specified permitted attributes; the collection of permitted
// attributes can be different based on whether the user is trying to
// access information about him/herself.
final Set<method*start>java.util.Set<method*end><String<method*start>java.lang.String<method*end>> permittedAttributes = person.getName<method*start>org.apereo.services.persondir.IPersonAttributes.getName<method*end>().equals(principal.getKey<method*start>org.apereo.portal.security.IAuthorizationPrincipal.getKey<method*end>()) ? getPermittedOwnAttributes(principal, generallyPermittedAttributes) : generallyPermittedAttributes;
final Map<method*start>java.util.Map<method*end><String<method*start>java.lang.String<method*end>, List<method*start>java.util.List<method*end><Object<method*start>java.lang.Object<method*end>>> visibleAttributes = new HashMap<method*start>java.util.HashMap<method*end><>();
for (String<method*start>java.lang.String<method*end> attr : person.getAttributes<method*start>org.apereo.services.persondir.IPersonAttributes.getAttributes<method*end>().keySet()) {
if (permittedAttributes.contains<method*start>java.util.Set.contains<method*end>(attr)) {
visibleAttributes.put<method*start>java.util.Map.put<method*end>(attr, person.getAttributeValues<method*start>org.apereo.services.persondir.IPersonAttributes.getAttributeValues<method*end>(attr));
}
}
// use the filtered attribute list to create and return a new
// person object
final IPersonAttributes<method*start>org.apereo.services.persondir.IPersonAttributes<method*end> visiblePerson = new NamedPersonImpl<method*start>org.apereo.services.persondir.support.NamedPersonImpl<method*end>(person.getName<method*start>org.apereo.services.persondir.IPersonAttributes.getName<method*end>(), visibleAttributes);
return visiblePerson;
} else {
logger.debug<method*start>org.slf4j.Logger.debug<method*end>("Principal " + principal.getKey<method*start>org.apereo.portal.security.IAuthorizationPrincipal.getKey<method*end>() + " does not have permissions to view user " + person.getName<method*start>org.apereo.services.persondir.IPersonAttributes.getName<method*end>());
return null;
}
}
|
public void onReceive(Context<method*start>android.content.Context<method*end> context, Intent<method*start>android.content.Intent<method*end> data) {
if (!ACTION_INSTALL_SHORTCUT.equals<method*start>java.lang.String.equals<method*end>(data.getAction<method*start>android.content.Intent.getAction<method*end>())) {
return;
}
PendingInstallShortcutInfo<method*start>com.android.launcher3.InstallShortcutReceiver.PendingInstallShortcutInfo<method*end> info = createPendingInfo<method*start>com.android.launcher3.InstallShortcutReceiver.createPendingInfo<method*end>(context, data);
if (info != null) {
if (!info.isLauncherActivity<method*start>com.android.launcher3.InstallShortcutReceiver.PendingInstallShortcutInfo.isLauncherActivity<method*end>()) {
queuePendingShortcutInfo<method*start>com.android.launcher3.InstallShortcutReceiver.queuePendingShortcutInfo<method*end>(info, context);
}
}
|
conventional
|
public void onReceive(Context<method*start>android.content.Context<method*end> context, Intent<method*start>android.content.Intent<method*end> data) {
if (!ACTION_INSTALL_SHORTCUT.equals<method*start>java.lang.String.equals<method*end>(data.getAction<method*start>android.content.Intent.getAction<method*end>())) {
return;
}
PendingInstallShortcutInfo<method*start>com.android.launcher3.InstallShortcutReceiver.PendingInstallShortcutInfo<method*end> info = createPendingInfo<method*start>com.android.launcher3.InstallShortcutReceiver.createPendingInfo<method*end>(context, data);
if (info != null) {
if (!info.isLauncherActivity<method*start>com.android.launcher3.InstallShortcutReceiver.PendingInstallShortcutInfo.isLauncherActivity<method*end>()) {
// Since its a custom shortcut, verify that it is safe to launch.
if (!new PackageManagerHelper<method*start>com.android.launcher3.util.PackageManagerHelper<method*end>(context).hasPermissionForActivity<method*start>com.android.launcher3.util.PackageManagerHelper.hasPermissionForActivity<method*end>(info.launchIntent<method*start>com.android.launcher3.InstallShortcutReceiver.PendingInstallShortcutInfo.launchIntent<method*end>, null)) {
// Target cannot be launched, or requires some special permission to launch
Log.e<method*start>android.util.Log.e<method*end>(TAG, "Ignoring malicious intent " + info.launchIntent.toUri<method*start>android.content.Intent.toUri<method*end>(0));
return;
}
}
queuePendingShortcutInfo<method*start>com.android.launcher3.InstallShortcutReceiver.queuePendingShortcutInfo<method*end>(info, context);
}
}
|
public void onReceive(Context android.content.Context context, Intent android.content.Intent data) {
if (!ACTION_INSTALL_SHORTCUT.equals(data.getAction())) {
return;
}
PendingInstallShortcutInfo info = createPendingInfo(context, data);
if (info != null) {
queuePendingShortcutInfo(info, context);
}
}
|
conventional
|
public void onReceive(Context<method*start>android.content.Context<method*end> context, Intent<method*start>android.content.Intent<method*end> data) {
if (!ACTION_INSTALL_SHORTCUT.equals<method*start>java.lang.String.equals<method*end>(data.getAction<method*start>android.content.Intent.getAction<method*end>())) {
return;
}
PendingInstallShortcutInfo<method*start>xyz.klinker.blur.launcher3.InstallShortcutReceiver.PendingInstallShortcutInfo<method*end> info = createPendingInfo<method*start>xyz.klinker.blur.launcher3.InstallShortcutReceiver.createPendingInfo<method*end>(context, data);
if (info != null) {
if (!info.isLauncherActivity<method*start>xyz.klinker.blur.launcher3.InstallShortcutReceiver.PendingInstallShortcutInfo.isLauncherActivity<method*end>()) {
// Since its a custom shortcut, verify that it is safe to launch.
if (!PackageManagerHelper.hasPermissionForActivity<method*start>xyz.klinker.blur.launcher3.util.PackageManagerHelper.hasPermissionForActivity<method*end>(context, info.launchIntent<method*start>xyz.klinker.blur.launcher3.InstallShortcutReceiver.PendingInstallShortcutInfo.launchIntent<method*end>, null)) {
// Target cannot be launched, or requires some special permission to launch
Log.e<method*start>android.util.Log.e<method*end>(TAG, "Ignoring malicious intent " + info.launchIntent.toUri<method*start>android.content.Intent.toUri<method*end>(0));
return;
}
}
queuePendingShortcutInfo<method*start>xyz.klinker.blur.launcher3.InstallShortcutReceiver.queuePendingShortcutInfo<method*end>(info, context);
}
}
|
public boolean canEditUser(IPerson<method*start>org.apereo.portal.security.IPerson<method*end> currentUser, String<method*start>java.lang.String<method*end> target) {
if (!isLocalAccount<method*start>org.apereo.portal.portlets.account.UserAccountHelper.isLocalAccount<method*end>(target)) {
return false;
}
EntityIdentifier<method*start>org.apereo.portal.EntityIdentifier<method*end> ei = currentUser.getEntityIdentifier<method*start>org.apereo.portal.security.IPerson.getEntityIdentifier<method*end>();
IAuthorizationPrincipal<method*start>org.apereo.portal.security.IAuthorizationPrincipal<method*end> ap = AuthorizationServiceFacade.instance<method*start>org.apereo.portal.services.AuthorizationServiceFacade.instance<method*end>().newPrincipal<method*start>org.apereo.portal.services.AuthorizationServiceFacade.newPrincipal<method*end>(ei.getKey<method*start>org.apereo.portal.EntityIdentifier.getKey<method*end>(), ei.getType<method*start>org.apereo.portal.EntityIdentifier.getType<method*end>());
return true;
}
|
conventional
|
public boolean canEditUser(IPerson<method*start>org.apereo.portal.security.IPerson<method*end> currentUser, String<method*start>java.lang.String<method*end> target) {
// first check to see if this is a local user
if (!isLocalAccount<method*start>org.apereo.portal.portlets.account.UserAccountHelper.isLocalAccount<method*end>(target)) {
return false;
}
EntityIdentifier<method*start>org.apereo.portal.EntityIdentifier<method*end> ei = currentUser.getEntityIdentifier<method*start>org.apereo.portal.security.IPerson.getEntityIdentifier<method*end>();
IAuthorizationPrincipal<method*start>org.apereo.portal.security.IAuthorizationPrincipal<method*end> ap = AuthorizationServiceFacade.instance<method*start>org.apereo.portal.services.AuthorizationServiceFacade.instance<method*end>().newPrincipal<method*start>org.apereo.portal.services.AuthorizationServiceFacade.newPrincipal<method*end>(ei.getKey<method*start>org.apereo.portal.EntityIdentifier.getKey<method*end>(), ei.getType<method*start>org.apereo.portal.EntityIdentifier.getType<method*end>());
// edit their own account
if (currentUser.getName<method*start>org.apereo.portal.security.IPerson.getName<method*end>().equals<method*start>java.lang.String.equals<method*end>(target) && ap.hasPermission<method*start>org.apereo.portal.security.IAuthorizationPrincipal.hasPermission<method*end>("UP_USERS", "EDIT_USER", "SELF")) {
return true;
} else // otherwise determine if the user has permission to edit the account
if (ap.hasPermission<method*start>org.apereo.portal.security.IAuthorizationPrincipal.hasPermission<method*end>("UP_USERS", "EDIT_USER", target)) {
return true;
} else {
return false;
}
}
|
private void displayPingOther(CommandSender<method*start>org.bukkit.command.CommandSender<method*end> sender, Command<method*start>org.bukkit.command.Command<method*end> command, String<method*start>java.lang.String<method*end> playerName) {
RollingOverHistory<method*start>com.github.games647.lagmonitor.util.RollingOverHistory<method*end> sampleHistory = plugin.getPingManager().getHistory(playerName);
if (sampleHistory == null || !canSee<method*start>com.github.games647.lagmonitor.command.minecraft.PingCommand.canSee<method*end>(sender, playerName)) {
sendError<method*start>com.github.games647.lagmonitor.command.LagCommand.sendError<method*end>(sender, "No data for that player " + playerName);
return;
}
int lastPing = (int) sampleHistory.getLastSample();
sender.sendMessage(ChatColor<method*start>org.bukkit.ChatColor<method*end>.WHITE + playerName + PRIMARY_COLOR<method*start>com.github.games647.lagmonitor.command.LagCommand.PRIMARY_COLOR<method*end> + "'s ping is: " + ChatColor<method*start>org.bukkit.ChatColor<method*end>.DARK_GREEN + lastPing + "ms");
float pingAverage = LagUtils<method*start>com.github.games647.lagmonitor.util.LagUtils<method*end>.round(sampleHistory.getAverage());
sender.sendMessage(PRIMARY_COLOR<method*start>com.github.games647.lagmonitor.command.LagCommand.PRIMARY_COLOR<method*end> + "Average: " + ChatColor<method*start>org.bukkit.ChatColor<method*end>.DARK_GREEN + pingAverage + "ms");
}
|
conventional
|
private void displayPingOther(CommandSender<method*start>org.bukkit.command.CommandSender<method*end> sender, Command<method*start>org.bukkit.command.Command<method*end> command, String<method*start>java.lang.String<method*end> playerName) {
if (sender.hasPermission(command.getPermission() + ".other")) {
RollingOverHistory<method*start>com.github.games647.lagmonitor.util.RollingOverHistory<method*end> sampleHistory = plugin.getPingManager().getHistory(playerName);
if (sampleHistory == null || !canSee<method*start>com.github.games647.lagmonitor.command.minecraft.PingCommand.canSee<method*end>(sender, playerName)) {
sendError<method*start>com.github.games647.lagmonitor.command.LagCommand.sendError<method*end>(sender, "No data for that player " + playerName);
return;
}
int lastPing = (int) sampleHistory.getLastSample();
sender.sendMessage(ChatColor<method*start>org.bukkit.ChatColor<method*end>.WHITE + playerName + PRIMARY_COLOR<method*start>com.github.games647.lagmonitor.command.LagCommand.PRIMARY_COLOR<method*end> + "'s ping is: " + ChatColor<method*start>org.bukkit.ChatColor<method*end>.DARK_GREEN + lastPing + "ms");
float pingAverage = LagUtils<method*start>com.github.games647.lagmonitor.util.LagUtils<method*end>.round(sampleHistory.getAverage());
sender.sendMessage(PRIMARY_COLOR<method*start>com.github.games647.lagmonitor.command.LagCommand.PRIMARY_COLOR<method*end> + "Average: " + ChatColor<method*start>org.bukkit.ChatColor<method*end>.DARK_GREEN + pingAverage + "ms");
} else {
sendError<method*start>com.github.games647.lagmonitor.command.LagCommand.sendError<method*end>(sender, "You don't have enough permission");
}
}
|
private void validate(JoinPoint<method*start>org.aspectj.lang.JoinPoint<method*end> proceedingJoinPoint, HasPermission<method*start>com.sequenceiq.cloudbreak.workspace.repository.HasPermission<method*end> annotation) {
if (annotation == null) {
throw new IllegalArgumentException<method*start>java.lang.IllegalArgumentException<method*end>(format<method*start>java.lang.String.format<method*end>("HasPermission should be added to %s class.", proceedingJoinPoint.getSignature<method*start>org.aspectj.lang.JoinPoint.getSignature<method*end>().getDeclaringTypeName<method*start>org.aspectj.lang.Signature.getDeclaringTypeName<method*end>()));
}
throw new IllegalArgumentException<method*start>java.lang.IllegalArgumentException<method*end>("Write permission is enabled with Pre condition only.");
}
int length = proceedingJoinPoint.getArgs<method*start>org.aspectj.lang.JoinPoint.getArgs<method*end>().length<method*start>java.lang.Object[].length<method*end>;
if (length < annotation.targetIndex<method*start>com.sequenceiq.cloudbreak.workspace.repository.HasPermission.targetIndex<method*end>()) {
throw new IllegalArgumentException<method*start>java.lang.IllegalArgumentException<method*end>(format<method*start>java.lang.String.format<method*end>("The argument count [%s] cannot be less than the target index[%s]", length, annotation.targetIndex<method*start>com.sequenceiq.cloudbreak.workspace.repository.HasPermission.targetIndex<method*end>()));
}
}
|
conventional
|
private void validate(JoinPoint<method*start>org.aspectj.lang.JoinPoint<method*end> proceedingJoinPoint, HasPermission<method*start>com.sequenceiq.cloudbreak.workspace.repository.HasPermission<method*end> annotation) {
if (annotation == null) {
throw new IllegalArgumentException<method*start>java.lang.IllegalArgumentException<method*end>(format<method*start>java.lang.String.format<method*end>("HasPermission should be added to %s class.", proceedingJoinPoint.getSignature<method*start>org.aspectj.lang.JoinPoint.getSignature<method*end>().getDeclaringTypeName<method*start>org.aspectj.lang.Signature.getDeclaringTypeName<method*end>()));
}
if (annotation.permission<method*start>com.sequenceiq.cloudbreak.workspace.repository.HasPermission.permission<method*end>() == PermissionType.WRITE<method*start>com.sequenceiq.cloudbreak.workspace.repository.PermissionType.WRITE<method*end> && annotation.condition<method*start>com.sequenceiq.cloudbreak.workspace.repository.HasPermission.condition<method*end>() != ConditionType.PRE<method*start>com.sequenceiq.cloudbreak.workspace.repository.ConditionType.PRE<method*end>) {
throw new IllegalArgumentException<method*start>java.lang.IllegalArgumentException<method*end>("Write permission is enabled with Pre condition only.");
}
int length = proceedingJoinPoint.getArgs<method*start>org.aspectj.lang.JoinPoint.getArgs<method*end>().length<method*start>java.lang.Object[].length<method*end>;
if (length < annotation.targetIndex<method*start>com.sequenceiq.cloudbreak.workspace.repository.HasPermission.targetIndex<method*end>()) {
throw new IllegalArgumentException<method*start>java.lang.IllegalArgumentException<method*end>(format<method*start>java.lang.String.format<method*end>("The argument count [%s] cannot be less than the target index[%s]", length, annotation.targetIndex<method*start>com.sequenceiq.cloudbreak.workspace.repository.HasPermission.targetIndex<method*end>()));
}
}
|
static ArgumentBuilder<method*start>com.mojang.brigadier.builder.ArgumentBuilder<method*end><CommandSource<method*start>net.minecraft.command.CommandSource<method*end>, ?> register() {
return
Commands.literal<method*start>net.minecraft.command.Commands.literal<method*end>("dimensions").executes(ctx -> {
ctx.getSource<method*start>clojure.tools.analyzer.utils.ctx.getSource<method*end>().sendFeedback(new TranslationTextComponent<method*start>net.minecraft.util.text.TranslationTextComponent<method*end>("commands.forge.dimensions.list"), true);
Map<method*start>java.util.Map<method*end><String<method*start>java.lang.String<method*end>, List<String<method*start>java.lang.String<method*end>>> types = new HashMap<method*start>java.util.HashMap<method*end><>();
for (DimensionType<method*start>net.minecraft.world.dimension.DimensionType<method*end> dim : DimensionType.getAll<method*start>net.minecraft.world.dimension.DimensionType.getAll<method*end>()) {
String<method*start>java.lang.String<method*end> key = dim.getModType<method*start>net.minecraft.world.dimension.DimensionType.getModType<method*end>() == null ? "Vanilla" : dim.getModType<method*start>net.minecraft.world.dimension.DimensionType.getModType<method*end>().getRegistryName().toString();
types.computeIfAbsent<method*start>java.util.Map.computeIfAbsent<method*end>(key, k -> new ArrayList<method*start>java.util.ArrayList<method*end><>()).add<method*start>java.util.List.add<method*end>(DimensionType.getKey<method*start>net.minecraft.world.dimension.DimensionType.getKey<method*end>(dim).toString());
}
types.keySet<method*start>java.util.Map.keySet<method*end>().stream<method*start>java.util.Set.stream<method*end>().sorted<method*start>java.util.stream.Stream.sorted<method*end>().forEach<method*start>java.util.stream.Stream.forEach<method*end>(key -> {
ctx.getSource<method*start>clojure.tools.analyzer.utils.ctx.getSource<method*end>().sendFeedback(new StringTextComponent<method*start>net.minecraft.util.text.StringTextComponent<method*end>(key + ": " + types.get<method*start>java.util.Map.get<method*end>(key).stream<method*start>java.util.List.stream<method*end>().sorted<method*start>java.util.stream.Stream.sorted<method*end>().collect<method*start>java.util.stream.Stream.collect<method*end>(Collectors.joining<method*start>java.util.stream.Collectors.joining<method*end>(", "))), true);
});
return 0;
});
}
|
conventional
|
static ArgumentBuilder<method*start>com.mojang.brigadier.builder.ArgumentBuilder<method*end><CommandSource<method*start>net.minecraft.command.CommandSource<method*end>, ?> register() {
return // permission
Commands.literal<method*start>net.minecraft.command.Commands.literal<method*end>("dimensions").requires(cs -> cs.hasPermissionLevel<method*start>com.applovin.impl.sdk.cs.hasPermissionLevel<method*end>(0)).executes(ctx -> {
ctx.getSource<method*start>clojure.tools.analyzer.utils.ctx.getSource<method*end>().sendFeedback(new TranslationTextComponent<method*start>net.minecraft.util.text.TranslationTextComponent<method*end>("commands.forge.dimensions.list"), true);
Map<method*start>java.util.Map<method*end><String<method*start>java.lang.String<method*end>, List<String<method*start>java.lang.String<method*end>>> types = new HashMap<method*start>java.util.HashMap<method*end><>();
for (DimensionType<method*start>net.minecraft.world.dimension.DimensionType<method*end> dim : DimensionType.getAll<method*start>net.minecraft.world.dimension.DimensionType.getAll<method*end>()) {
String<method*start>java.lang.String<method*end> key = dim.getModType<method*start>net.minecraft.world.dimension.DimensionType.getModType<method*end>() == null ? "Vanilla" : dim.getModType<method*start>net.minecraft.world.dimension.DimensionType.getModType<method*end>().getRegistryName().toString();
types.computeIfAbsent<method*start>java.util.Map.computeIfAbsent<method*end>(key, k -> new ArrayList<method*start>java.util.ArrayList<method*end><>()).add<method*start>java.util.List.add<method*end>(DimensionType.getKey<method*start>net.minecraft.world.dimension.DimensionType.getKey<method*end>(dim).toString());
}
types.keySet<method*start>java.util.Map.keySet<method*end>().stream<method*start>java.util.Set.stream<method*end>().sorted<method*start>java.util.stream.Stream.sorted<method*end>().forEach<method*start>java.util.stream.Stream.forEach<method*end>(key -> {
ctx.getSource<method*start>clojure.tools.analyzer.utils.ctx.getSource<method*end>().sendFeedback(new StringTextComponent<method*start>net.minecraft.util.text.StringTextComponent<method*end>(key + ": " + types.get<method*start>java.util.Map.get<method*end>(key).stream<method*start>java.util.List.stream<method*end>().sorted<method*start>java.util.stream.Stream.sorted<method*end>().collect<method*start>java.util.stream.Stream.collect<method*end>(Collectors.joining<method*start>java.util.stream.Collectors.joining<method*end>(", "))), true);
});
return 0;
});
}
|
private static boolean onBlockHutPlaced(final World<method*start>net.minecraft.world.World<method*end> world, @NotNull final EntityPlayer<method*start>net.minecraft.entity.player.EntityPlayer<method*end> player, final BlockPos<method*start>net.minecraft.util.math.BlockPos<method*end> pos) {
final IColony<method*start>com.minecolonies.api.colony.IColony<method*end> colony = IColonyManager.getInstance<method*start>com.minecolonies.api.colony.IColonyManager.getInstance<method*end>().getIColony<method*start>com.minecolonies.api.colony.IColonyManager.getIColony<method*end>(world, pos);
if (colony<method*start>com.minecolonies.coremod.colony.buildings.AbstractCitizenAssignable.colony<method*end> == null) {
// Not in a colony
if (IColonyManager.getInstance<method*start>com.minecolonies.api.colony.IColonyManager.getInstance<method*end>().getIColonyByOwner<method*start>com.minecolonies.api.colony.IColonyManager.getIColonyByOwner<method*end>(world, player) == null) {
LanguageHandler.sendPlayerMessage<method*start>com.minecolonies.api.util.LanguageHandler.sendPlayerMessage<method*end>(player, "tile.blockHut.messageNoTownHall");
} else {
LanguageHandler.sendPlayerMessage<method*start>com.minecolonies.api.util.LanguageHandler.sendPlayerMessage<method*end>(player, "tile.blockHut.messageTooFarFromTownHall");
}
return false;
}
}
|
annotation
|
private static boolean onBlockHutPlaced(final World<method*start>net.minecraft.world.World<method*end> world, @NotNull final EntityPlayer<method*start>net.minecraft.entity.player.EntityPlayer<method*end> player, final BlockPos<method*start>net.minecraft.util.math.BlockPos<method*end> pos) {
final IColony<method*start>com.minecolonies.api.colony.IColony<method*end> colony = IColonyManager.getInstance<method*start>com.minecolonies.api.colony.IColonyManager.getInstance<method*end>().getIColony<method*start>com.minecolonies.api.colony.IColonyManager.getIColony<method*end>(world, pos);
if (colony<method*start>com.minecolonies.coremod.colony.buildings.AbstractCitizenAssignable.colony<method*end> == null) {
// Not in a colony
if (IColonyManager.getInstance<method*start>com.minecolonies.api.colony.IColonyManager.getInstance<method*end>().getIColonyByOwner<method*start>com.minecolonies.api.colony.IColonyManager.getIColonyByOwner<method*end>(world, player) == null) {
LanguageHandler.sendPlayerMessage<method*start>com.minecolonies.api.util.LanguageHandler.sendPlayerMessage<method*end>(player, "tile.blockHut.messageNoTownHall");
} else {
LanguageHandler.sendPlayerMessage<method*start>com.minecolonies.api.util.LanguageHandler.sendPlayerMessage<method*end>(player, "tile.blockHut.messageTooFarFromTownHall");
}
return false;
} else if (!colony.getPermissions<method*start>com.minecolonies.api.colony.IColony.getPermissions<method*end>().hasPermission<method*start>com.minecolonies.api.colony.permissions.IPermissions.hasPermission<method*end>(player, Action.PLACE_HUTS<method*start>com.minecolonies.api.colony.permissions.Action.PLACE_HUTS<method*end>)) {
// No permission to place hut in colony
LanguageHandler.sendPlayerMessage<method*start>com.minecolonies.api.util.LanguageHandler.sendPlayerMessage<method*end>(player, "tile.blockHut.messageNoPermission", colony.getName<method*start>com.minecolonies.api.colony.IColony.getName<method*end>());
return false;
} else {
return true;
}
}
|
@Override
public void onExecute(CommandSender sender, String[] args) {
if (sender instanceof Player) {
PlayerProfile.get((Player) sender, profile -> profile.sendStats(sender));
} else {
SlimefunPlugin.getLocal().sendMessage(sender, "messages.only-players", true);
}
}
|
annotation
|
@Override
public void onExecute(CommandSender<method*start>org.bukkit.command.CommandSender<method*end> sender, String<method*start>java.lang.String<method*end>[] args) {
if (args.length<method*start>java.lang.String[].length<method*end> > 1) {
if (sender.hasPermission<method*start>org.bukkit.command.CommandSender.hasPermission<method*end>("slimefun.stats.others") || sender instanceof ConsoleCommandSender<method*start>org.bukkit.command.ConsoleCommandSender<method*end>) {
Optional<method*start>java.util.Optional<method*end><Player<method*start>org.bukkit.entity.Player<method*end>> player = PlayerList.findByName<method*start>io.github.thebusybiscuit.cscorelib2.players.PlayerList.findByName<method*end>(args[1]);
if (player.isPresent<method*start>java.util.Optional.isPresent<method*end>()) {
PlayerProfile.get<method*start>me.mrCookieSlime.Slimefun.api.PlayerProfile.get<method*end>(player.get<method*start>java.util.Optional.get<method*end>(), profile -> profile.sendStats<method*start>profile.sendStats<method*end>(sender));
} else {
SlimefunPlugin.getLocal<method*start>me.mrCookieSlime.Slimefun.SlimefunPlugin.getLocal<method*end>().sendMessage(sender, "messages.not-online", true, msg -> msg.replace<method*start>msg.replace<method*end>("%player%", args[1]));
}
} else
SlimefunPlugin.getLocal<method*start>me.mrCookieSlime.Slimefun.SlimefunPlugin.getLocal<method*end>().sendMessage(sender, "messages.no-permission", true);
} else if (sender instanceof Player<method*start>org.bukkit.entity.Player<method*end>) {
PlayerProfile.get<method*start>me.mrCookieSlime.Slimefun.api.PlayerProfile.get<method*end>((Player<method*start>org.bukkit.entity.Player<method*end>) sender, profile -> profile.sendStats<method*start>profile.sendStats<method*end>(sender));
} else {
SlimefunPlugin.getLocal<method*start>me.mrCookieSlime.Slimefun.SlimefunPlugin.getLocal<method*end>().sendMessage(sender, "messages.only-players", true);
}
}
|
@VisibleForTesting
boolean hasReachedMaxLoggedInPlayersForIp(Player player, String ip) {
final String name = player.getName();
int count = 0;
for (Player onlinePlayer : bukkitService.getOnlinePlayers()) {
if (ip.equalsIgnoreCase(PlayerUtils.getPlayerIp(onlinePlayer)) && !onlinePlayer.getName().equals(name) && dataSource.isLogged(onlinePlayer.getName().toLowerCase())) {
++count;
}
}
return count >= service.getProperty(RestrictionSettings.MAX_LOGIN_PER_IP);
}
|
annotation
|
@VisibleForTesting<method*start>com.google.common.annotations.VisibleForTesting<method*end>
boolean hasReachedMaxLoggedInPlayersForIp(Player<method*start>org.bukkit.entity.Player<method*end> player, String<method*start>java.lang.String<method*end> ip) {
// Do not perform the check if player has multiple accounts permission or if IP is localhost
if (service.getProperty<method*start>fr.xephi.authme.service.CommonService.getProperty<method*end>(RestrictionSettings.MAX_LOGIN_PER_IP<method*start>fr.xephi.authme.settings.properties.RestrictionSettings.MAX_LOGIN_PER_IP<method*end>) <= 0 || service.hasPermission<method*start>fr.xephi.authme.service.CommonService.hasPermission<method*end>(player, PlayerStatePermission.ALLOW_MULTIPLE_ACCOUNTS<method*start>fr.xephi.authme.permission.PlayerStatePermission.ALLOW_MULTIPLE_ACCOUNTS<method*end>) || InternetProtocolUtils.isLoopbackAddress<method*start>fr.xephi.authme.util.InternetProtocolUtils.isLoopbackAddress<method*end>(ip)) {
return false;
}
// Count logged in players with same IP address
final String<method*start>java.lang.String<method*end> name = player.getName<method*start>org.bukkit.entity.Player.getName<method*end>();
int count = 0;
for (Player<method*start>org.bukkit.entity.Player<method*end> onlinePlayer : bukkitService.getOnlinePlayers<method*start>fr.xephi.authme.service.BukkitService.getOnlinePlayers<method*end>()) {
if (ip.equalsIgnoreCase<method*start>java.lang.String.equalsIgnoreCase<method*end>(PlayerUtils.getPlayerIp<method*start>fr.xephi.authme.util.PlayerUtils.getPlayerIp<method*end>(onlinePlayer)) && !onlinePlayer.getName<method*start>org.bukkit.entity.Player.getName<method*end>().equals(name) && dataSource.isLogged<method*start>fr.xephi.authme.datasource.DataSource.isLogged<method*end>(onlinePlayer.getName<method*start>org.bukkit.entity.Player.getName<method*end>().toLowerCase())) {
++count;
}
}
return count >= service.getProperty<method*start>fr.xephi.authme.service.CommonService.getProperty<method*end>(RestrictionSettings.MAX_LOGIN_PER_IP<method*start>fr.xephi.authme.settings.properties.RestrictionSettings.MAX_LOGIN_PER_IP<method*end>);
}
|
@Listener
public void onSignChange(ChangeSignEvent<method*start>org.spongepowered.api.event.block.tileentity.ChangeSignEvent<method*end> event, @First Player player) {
for (String<method*start>java.lang.String<method*end> line : getValidSigns<method*start>com.sk89q.craftbook.sponge.mechanics.types.SpongeSignMechanic.getValidSigns<method*end>()) {
if (SignUtil.getTextRaw<method*start>com.sk89q.craftbook.sponge.util.SignUtil.getTextRaw<method*end>(event.getText<method*start>org.spongepowered.api.event.block.tileentity.ChangeSignEvent.getText<method*end>(), 1).equalsIgnoreCase(line)) {
event.setCancelled<method*start>org.spongepowered.api.event.block.tileentity.ChangeSignEvent.setCancelled<method*end>(true);
return;
} else {
List<method*start>java.util.List<method*end><Text<method*start>org.spongepowered.api.text.Text<method*end>> lines = event.getText<method*start>org.spongepowered.api.event.block.tileentity.ChangeSignEvent.getText<method*end>().lines().get();
lines.set<method*start>java.util.List.set<method*end>(1, Text.of<method*start>org.spongepowered.api.text.Text.of<method*end>(line));
if (!verifyLines<method*start>com.sk89q.craftbook.sponge.mechanics.types.SpongeSignMechanic.verifyLines<method*end>(event.getTargetTile<method*start>org.spongepowered.api.event.block.tileentity.ChangeSignEvent.getTargetTile<method*end>().getLocation(), lines, player)) {
event.setCancelled<method*start>org.spongepowered.api.event.block.tileentity.ChangeSignEvent.setCancelled<method*end>(true);
return;
}
event.getText<method*start>org.spongepowered.api.event.block.tileentity.ChangeSignEvent.getText<method*end>().set(Keys.SIGN_LINES<method*start>org.spongepowered.api.data.key.Keys.SIGN_LINES<method*end>, lines);
}
player.sendMessage<method*start>org.spongepowered.api.entity.living.player.Player.sendMessage<method*end>(Text.of<method*start>org.spongepowered.api.text.Text.of<method*end>(TextColors.YELLOW<method*start>org.spongepowered.api.text.format.TextColors.YELLOW<method*end>, "Created " + getName<method*start>com.sk89q.craftbook.sponge.mechanics.types.SpongeMechanic.getName<method*end>() + '!'));
break;
}
}
}
|
annotation
|
@Listener
public void onSignChange(ChangeSignEvent<method*start>org.spongepowered.api.event.block.tileentity.ChangeSignEvent<method*end> event, @First Player player) {
for (String<method*start>java.lang.String<method*end> line : getValidSigns<method*start>com.sk89q.craftbook.sponge.mechanics.types.SpongeSignMechanic.getValidSigns<method*end>()) {
if (SignUtil.getTextRaw<method*start>com.sk89q.craftbook.sponge.util.SignUtil.getTextRaw<method*end>(event.getText<method*start>org.spongepowered.api.event.block.tileentity.ChangeSignEvent.getText<method*end>(), 1).equalsIgnoreCase(line)) {
if (!getCreatePermission<method*start>com.sk89q.craftbook.sponge.mechanics.types.SpongeSignMechanic.getCreatePermission<method*end>().hasPermission<method*start>com.sk89q.craftbook.sponge.util.SpongePermissionNode.hasPermission<method*end>(player)) {
player.sendMessage<method*start>org.spongepowered.api.entity.living.player.Player.sendMessage<method*end>(Text.of<method*start>org.spongepowered.api.text.Text.of<method*end>(TextColors.RED<method*start>org.spongepowered.api.text.format.TextColors.RED<method*end>, "You do not have permission to create this mechanic!"));
event.setCancelled<method*start>org.spongepowered.api.event.block.tileentity.ChangeSignEvent.setCancelled<method*end>(true);
return;
} else {
List<method*start>java.util.List<method*end><Text<method*start>org.spongepowered.api.text.Text<method*end>> lines = event.getText<method*start>org.spongepowered.api.event.block.tileentity.ChangeSignEvent.getText<method*end>().lines().get();
lines.set<method*start>java.util.List.set<method*end>(1, Text.of<method*start>org.spongepowered.api.text.Text.of<method*end>(line));
if (!verifyLines<method*start>com.sk89q.craftbook.sponge.mechanics.types.SpongeSignMechanic.verifyLines<method*end>(event.getTargetTile<method*start>org.spongepowered.api.event.block.tileentity.ChangeSignEvent.getTargetTile<method*end>().getLocation(), lines, player)) {
event.setCancelled<method*start>org.spongepowered.api.event.block.tileentity.ChangeSignEvent.setCancelled<method*end>(true);
return;
}
event.getText<method*start>org.spongepowered.api.event.block.tileentity.ChangeSignEvent.getText<method*end>().set(Keys.SIGN_LINES<method*start>org.spongepowered.api.data.key.Keys.SIGN_LINES<method*end>, lines);
}
player.sendMessage<method*start>org.spongepowered.api.entity.living.player.Player.sendMessage<method*end>(Text.of<method*start>org.spongepowered.api.text.Text.of<method*end>(TextColors.YELLOW<method*start>org.spongepowered.api.text.format.TextColors.YELLOW<method*end>, "Created " + getName<method*start>com.sk89q.craftbook.sponge.mechanics.types.SpongeMechanic.getName<method*end>() + '!'));
break;
}
}
}
|
public static boolean isCallerInRole(String role) {
Subject subject = getSubject();
EJBContext ejbContext = getEJBContext();
if (ejbContext != null) {
// We're called from an EJB
// To ask for the permission, get the EJB name first.
// Unlike the Servlet container there's no automatic mapping
// to a global ("") name.
String ejbName = getCurrentEJBName(ejbContext);
if (ejbName != null) {
return hasPermission(subject, new EJBRoleRefPermission(ejbName, role));
}
// ejbContext
return ejbContext.isCallerInRole(role);
}
return false;
}
|
conventional
|
public static boolean isCallerInRole(String<method*start>java.lang.String<method*end> role) {
Subject<method*start>javax.security.auth.Subject<method*end> subject = getSubject();
if (hasPermission<method*start>org.glassfish.soteria.authorization.JACC.hasPermission<method*end>(subject, new WebRoleRefPermission<method*start>javax.security.jacc.WebRoleRefPermission<method*end>("", role))) {
return true;
}
EJBContext<method*start>javax.ejb.EJBContext<method*end> ejbContext = getEJBContext<method*start>org.glassfish.soteria.authorization.EJB.getEJBContext<method*end>();
if (ejbContext != null) {
// We're called from an EJB
// To ask for the permission, get the EJB name first.
// Unlike the Servlet container there's no automatic mapping
// to a global ("") name.
String<method*start>java.lang.String<method*end> ejbName = getCurrentEJBName<method*start>org.glassfish.soteria.authorization.EJB.getCurrentEJBName<method*end>(ejbContext);
if (ejbName != null) {
return hasPermission<method*start>org.glassfish.soteria.authorization.JACC.hasPermission<method*end>(subject, new EJBRoleRefPermission<method*start>javax.security.jacc.EJBRoleRefPermission<method*end>(ejbName, role));
}
// ejbContext
return ejbContext.isCallerInRole<method*start>javax.ejb.EJBContext.isCallerInRole<method*end>(role);
}
return false;
}
|
public static Map<method*start>java.util.Map<method*end><String<method*start>java.lang.String<method*end>, Object<method*start>java.lang.Object<method*end>> checkPermission(DispatchContext<method*start>org.apache.ofbiz.service.DispatchContext<method*end> ctx, Map<method*start>java.util.Map<method*end><String<method*start>java.lang.String<method*end>, ?> context) {
boolean hasPermission = true;
Map<method*start>java.util.Map<method*end><String<method*start>java.lang.String<method*end>, Object<method*start>java.lang.Object<method*end>> result = ServiceUtil.returnSuccess<method*start>org.apache.ofbiz.service.ServiceUtil.returnSuccess<method*end>();
result.put<method*start>java.util.Map.put<method*end>("hasPermission", hasPermission);
return result;
}
|
conventional
|
public static Map<method*start>java.util.Map<method*end><String<method*start>java.lang.String<method*end>, Object<method*start>java.lang.Object<method*end>> checkPermission(DispatchContext<method*start>org.apache.ofbiz.service.DispatchContext<method*end> ctx, Map<method*start>java.util.Map<method*end><String<method*start>java.lang.String<method*end>, ?> context) {
boolean hasPermission = false;
String<method*start>java.lang.String<method*end> mainAction = (String<method*start>java.lang.String<method*end>) context.get<method*start>java.util.Map.get<method*end>("mainAction");
if ("VIEW".equals<method*start>java.lang.String.equals<method*end>(mainAction)) {
if (DEFAULT_UID.equals<method*start>java.lang.String.equals<method*end>(context.get<method*start>java.util.Map.get<method*end>(LOGINID_PARAMETER_NAME))) {
hasPermission = true;
} else {
hasPermission = isValidGetId<method*start>org.apache.ofbiz.common.preferences.PreferenceWorker.isValidGetId<method*end>(ctx, context);
}
} else if ("CREATE~UPDATE~DELETE".contains<method*start>java.lang.String.contains<method*end>(mainAction)) {
hasPermission = isValidSetId<method*start>org.apache.ofbiz.common.preferences.PreferenceWorker.isValidSetId<method*end>(ctx, context);
} else {
hasPermission = false;
}
Map<method*start>java.util.Map<method*end><String<method*start>java.lang.String<method*end>, Object<method*start>java.lang.Object<method*end>> result = ServiceUtil.returnSuccess<method*start>org.apache.ofbiz.service.ServiceUtil.returnSuccess<method*end>();
result.put<method*start>java.util.Map.put<method*end>("hasPermission", hasPermission);
return result;
}
|
@Override<method*start>java.lang.Override<method*end>
public final int doWikiStartTag() {
for (final String<method*start>java.lang.String<method*end> perm : m_permissionList) {
final boolean hasPermission;
if (perm.charAt<method*start>java.lang.String.charAt<method*end>(0) == '!') {
hasPermission = !checkPermission(perm.substring<method*start>java.lang.String.substring<method*end>(1));
} else {
hasPermission = checkPermission(perm);
}
}
return SKIP_BODY<method*start>javax.servlet.jsp.tagext.TagSupport.SKIP_BODY<method*end>;
}
|
annotation
|
@Override<method*start>java.lang.Override<method*end>
public final int doWikiStartTag() {
for (final String<method*start>java.lang.String<method*end> perm : m_permissionList) {
final boolean hasPermission;
if (perm.charAt<method*start>java.lang.String.charAt<method*end>(0) == '!') {
hasPermission = !checkPermission(perm.substring<method*start>java.lang.String.substring<method*end>(1));
} else {
hasPermission = checkPermission(perm);
}
if (hasPermission) {
return EVAL_BODY_INCLUDE<method*start>javax.servlet.jsp.tagext.TagSupport.EVAL_BODY_INCLUDE<method*end>;
}
}
return SKIP_BODY<method*start>javax.servlet.jsp.tagext.TagSupport.SKIP_BODY<method*end>;
}
|
@Override
public void messageOnServerThread(final AssignUnassignMessage message, final EntityPlayerMP player) {
final IColony colony = IColonyManager.getInstance().getColonyByDimension(message.colonyId, message.dimension);
if (colony != null) {
final IBuilding building = colony.getBuildingManager().getBuilding(message.buildingId);
if (!(building instanceof BuildingHome)) {
return;
}
final ICitizenData citizen = colony.getCitizenManager().getCitizen(message.citizenID);
if (message.assign && !building.isFull() && !building.equals(citizen.getHomeBuilding())) {
if (citizen.getHomeBuilding() != null) {
citizen.getHomeBuilding().removeCitizen(citizen);
}
building.assignCitizen(citizen);
} else if (building.hasAssignedCitizen(citizen)) {
building.removeCitizen(citizen);
}
}
}
|
annotation
|
@Override
public void messageOnServerThread(final AssignUnassignMessage<method*start>com.minecolonies.coremod.network.messages.AssignUnassignMessage<method*end> message, final EntityPlayerMP<method*start>net.minecraft.entity.player.EntityPlayerMP<method*end> player) {
final IColony<method*start>com.minecolonies.api.colony.IColony<method*end> colony = IColonyManager<method*start>com.minecolonies.api.colony.IColonyManager<method*end>.getInstance().getColonyByDimension(message.colonyId, message.dimension);
if (colony<method*start>com.minecolonies.coremod.colony.buildings.AbstractCitizenAssignable.colony<method*end> != null) {
// Verify player has permission to change this huts settings
if (!colony<method*start>com.minecolonies.coremod.colony.buildings.AbstractCitizenAssignable.colony<method*end>.getPermissions().hasPermission(player, Action<method*start>com.minecolonies.api.colony.permissions.Action<method*end>.MANAGE_HUTS)) {
return;
}
final IBuilding building = colony<method*start>com.minecolonies.coremod.colony.buildings.AbstractCitizenAssignable.colony<method*end>.getBuildingManager().getBuilding(message.buildingId);
if (!(building instanceof BuildingHome<method*start>com.minecolonies.coremod.colony.buildings.workerbuildings.BuildingHome<method*end>)) {
return;
}
final ICitizenData<method*start>com.minecolonies.api.colony.ICitizenData<method*end> citizen = colony<method*start>com.minecolonies.coremod.colony.buildings.AbstractCitizenAssignable.colony<method*end>.getCitizenManager().getCitizen(message.citizenID);
if (message.assign && !building.isFull() && !building.equals(citizen.getHomeBuilding())) {
if (citizen.getHomeBuilding() != null) {
citizen.getHomeBuilding().removeCitizen(citizen);
}
building.assignCitizen(citizen);
} else if (building.hasAssignedCitizen(citizen)) {
building.removeCitizen(citizen);
}
}
}
|
private void appendPermissionsElement(Document<method*start>org.w3c.dom.Document<method*end> doc, Element<method*start>org.w3c.dom.Element<method*end> parentElement, Set<method*start>java.util.Set<method*end><DBMembershipItem<method*start>org.sakaiproject.api.app.messageforums.DBMembershipItem<method*end>> membershipItems) {
if (CollectionUtils.isNotEmpty<method*start>org.apache.commons.collections4.CollectionUtils.isNotEmpty<method*end>(membershipItems)) {
final Element<method*start>org.w3c.dom.Element<method*end> permissionsElement = doc.createElement<method*start>org.w3c.dom.Document.createElement<method*end>(PERMISSIONS);
for (DBMembershipItem<method*start>org.sakaiproject.api.app.messageforums.DBMembershipItem<method*end> membershipItem : membershipItems) {
final Element<method*start>org.w3c.dom.Element<method*end> permissionElement = doc.createElement<method*start>org.w3c.dom.Document.createElement<method*end>(PERMISSION);
permissionElement.setAttribute<method*start>org.w3c.dom.Element.setAttribute<method*end>(PERMISSION_TYPE, membershipItem.getType<method*start>org.sakaiproject.api.app.messageforums.DBMembershipItem.getType<method*end>().toString<method*start>java.lang.Integer.toString<method*end>());
permissionElement.setAttribute<method*start>org.w3c.dom.Element.setAttribute<method*end>(PERMISSION_NAME, membershipItem.getName<method*start>org.sakaiproject.api.app.messageforums.DBMembershipItem.getName<method*end>());
permissionElement.setAttribute<method*start>org.w3c.dom.Element.setAttribute<method*end>(PERMISSION_LEVEL_NAME, membershipItem.getPermissionLevelName<method*start>org.sakaiproject.api.app.messageforums.DBMembershipItem.getPermissionLevelName<method*end>());
List<method*start>java.util.List<method*end><String<method*start>java.lang.String<method*end>> customPerms = permissionManager.getCustomPermissions<method*start>org.sakaiproject.api.app.messageforums.PermissionLevelManager.getCustomPermissions<method*end>();
Element<method*start>org.w3c.dom.Element<method*end> customPermissions = doc.createElement<method*start>org.w3c.dom.Document.createElement<method*end>(CUSTOM_PERMISSIONS);
for (String<method*start>java.lang.String<method*end> name<method*start>javax.persistence.Table.name<method*end> : customPerms) {
String<method*start>java.lang.String<method*end> hasPermission = permissionManager.getCustomPermissionByName<method*start>org.sakaiproject.api.app.messageforums.PermissionLevelManager.getCustomPermissionByName<method*end>(name<method*start>javax.persistence.Table.name<method*end>, membershipItem.getPermissionLevel<method*start>org.sakaiproject.api.app.messageforums.DBMembershipItem.getPermissionLevel<method*end>()).toString<method*start>java.lang.Boolean.toString<method*end>();
customPermissions.setAttribute<method*start>org.w3c.dom.Element.setAttribute<method*end>(name<method*start>javax.persistence.Table.name<method*end>, hasPermission);
}
permissionElement.appendChild<method*start>org.w3c.dom.Element.appendChild<method*end>(customPermissions);
}
}
permissionsElement.appendChild<method*start>org.w3c.dom.Element.appendChild<method*end>(permissionElement);
}
parentElement.appendChild<method*start>org.w3c.dom.Element.appendChild<method*end>(permissionsElement);
}
}
|
conventional
|
private void appendPermissionsElement(Document<method*start>org.w3c.dom.Document<method*end> doc, Element<method*start>org.w3c.dom.Element<method*end> parentElement, Set<method*start>java.util.Set<method*end><DBMembershipItem<method*start>org.sakaiproject.api.app.messageforums.DBMembershipItem<method*end>> membershipItems) {
if (CollectionUtils.isNotEmpty<method*start>org.apache.commons.collections4.CollectionUtils.isNotEmpty<method*end>(membershipItems)) {
final Element<method*start>org.w3c.dom.Element<method*end> permissionsElement = doc.createElement<method*start>org.w3c.dom.Document.createElement<method*end>(PERMISSIONS);
for (DBMembershipItem<method*start>org.sakaiproject.api.app.messageforums.DBMembershipItem<method*end> membershipItem : membershipItems) {
final Element<method*start>org.w3c.dom.Element<method*end> permissionElement = doc.createElement<method*start>org.w3c.dom.Document.createElement<method*end>(PERMISSION);
permissionElement.setAttribute<method*start>org.w3c.dom.Element.setAttribute<method*end>(PERMISSION_TYPE, membershipItem.getType<method*start>org.sakaiproject.api.app.messageforums.DBMembershipItem.getType<method*end>().toString<method*start>java.lang.Integer.toString<method*end>());
permissionElement.setAttribute<method*start>org.w3c.dom.Element.setAttribute<method*end>(PERMISSION_NAME, membershipItem.getName<method*start>org.sakaiproject.api.app.messageforums.DBMembershipItem.getName<method*end>());
permissionElement.setAttribute<method*start>org.w3c.dom.Element.setAttribute<method*end>(PERMISSION_LEVEL_NAME, membershipItem.getPermissionLevelName<method*start>org.sakaiproject.api.app.messageforums.DBMembershipItem.getPermissionLevelName<method*end>());
if (PermissionLevelManager.PERMISSION_LEVEL_NAME_CUSTOM.equals<method*start>java.lang.String.equals<method*end>(membershipItem.getPermissionLevelName<method*start>org.sakaiproject.api.app.messageforums.DBMembershipItem.getPermissionLevelName<method*end>())) {
List<method*start>java.util.List<method*end><String<method*start>java.lang.String<method*end>> customPerms = permissionManager.getCustomPermissions<method*start>org.sakaiproject.api.app.messageforums.PermissionLevelManager.getCustomPermissions<method*end>();
if (CollectionUtils.isNotEmpty<method*start>org.apache.commons.collections4.CollectionUtils.isNotEmpty<method*end>(customPerms)) {
Element<method*start>org.w3c.dom.Element<method*end> customPermissions = doc.createElement<method*start>org.w3c.dom.Document.createElement<method*end>(CUSTOM_PERMISSIONS);
for (String<method*start>java.lang.String<method*end> name<method*start>javax.persistence.Table.name<method*end> : customPerms) {
String<method*start>java.lang.String<method*end> hasPermission = permissionManager.getCustomPermissionByName<method*start>org.sakaiproject.api.app.messageforums.PermissionLevelManager.getCustomPermissionByName<method*end>(name<method*start>javax.persistence.Table.name<method*end>, membershipItem.getPermissionLevel<method*start>org.sakaiproject.api.app.messageforums.DBMembershipItem.getPermissionLevel<method*end>()).toString<method*start>java.lang.Boolean.toString<method*end>();
customPermissions.setAttribute<method*start>org.w3c.dom.Element.setAttribute<method*end>(name<method*start>javax.persistence.Table.name<method*end>, hasPermission);
}
permissionElement.appendChild<method*start>org.w3c.dom.Element.appendChild<method*end>(customPermissions);
}
}
permissionsElement.appendChild<method*start>org.w3c.dom.Element.appendChild<method*end>(permissionElement);
}
parentElement.appendChild<method*start>org.w3c.dom.Element.appendChild<method*end>(permissionsElement);
}
}
|
@Override
public void onExecute(CommandSender<method*start>org.bukkit.command.CommandSender<method*end> sender, String<method*start>java.lang.String<method*end>[] args) {
if (args.length<method*start>java.lang.String[].length<method*end> == 2) {
if (player.getName<method*start>org.bukkit.OfflinePlayer.getName<method*end>() != null) {
SlimefunPlugin.getGPSNetwork<method*start>me.mrCookieSlime.Slimefun.SlimefunPlugin.getGPSNetwork<method*end>().getTeleleportationService().openTeleporterGUI((Player<method*start>org.bukkit.entity.Player<method*end>) sender, player.getUniqueId<method*start>org.bukkit.OfflinePlayer.getUniqueId<method*end>(), ((Player<method*start>org.bukkit.entity.Player<method*end>) sender).getLocation<method*start>org.bukkit.entity.Player.getLocation<method*end>().getBlock<method*start>org.bukkit.entity.Player.getBlock<method*end>().getRelative<method*start>org.bukkit.entity.Player.getRelative<method*end>(BlockFace.DOWN<method*start>org.bukkit.block.BlockFace.DOWN<method*end>), 999999999);
} else
SlimefunPlugin.getLocal<method*start>me.mrCookieSlime.Slimefun.SlimefunPlugin.getLocal<method*end>().sendMessage(sender, "messages.unknown-player", msg -> msg.replace<method*start>msg.replace<method*end>("%player%", args[1]));
} else
SlimefunPlugin.getLocal<method*start>me.mrCookieSlime.Slimefun.SlimefunPlugin.getLocal<method*end>().sendMessage(sender, "messages.no-permission");
} else
SlimefunPlugin.getLocal<method*start>me.mrCookieSlime.Slimefun.SlimefunPlugin.getLocal<method*end>().sendMessage(sender, "messages.usage", msg -> msg.replace<method*start>msg.replace<method*end>("%usage%", "/sf teleporter <Player>"));
}
|
annotation
|
@Override
public void onExecute(CommandSender<method*start>org.bukkit.command.CommandSender<method*end> sender, String<method*start>java.lang.String<method*end>[] args) {
if (args.length<method*start>java.lang.String[].length<method*end> == 2) {
if (sender.hasPermission<method*start>org.bukkit.command.CommandSender.hasPermission<method*end>("slimefun.command.teleporter") && sender instanceof Player<method*start>org.bukkit.entity.Player<method*end>) {
@SuppressWarnings("deprecation") OfflinePlayer<method*start>org.bukkit.OfflinePlayer<method*end> player = Bukkit.getOfflinePlayer<method*start>org.bukkit.Bukkit.getOfflinePlayer<method*end>(args[1]);
if (player.getName<method*start>org.bukkit.OfflinePlayer.getName<method*end>() != null) {
SlimefunPlugin.getGPSNetwork<method*start>me.mrCookieSlime.Slimefun.SlimefunPlugin.getGPSNetwork<method*end>().getTeleleportationService().openTeleporterGUI((Player<method*start>org.bukkit.entity.Player<method*end>) sender, player.getUniqueId<method*start>org.bukkit.OfflinePlayer.getUniqueId<method*end>(), ((Player<method*start>org.bukkit.entity.Player<method*end>) sender).getLocation<method*start>org.bukkit.entity.Player.getLocation<method*end>().getBlock<method*start>org.bukkit.entity.Player.getBlock<method*end>().getRelative<method*start>org.bukkit.entity.Player.getRelative<method*end>(BlockFace.DOWN<method*start>org.bukkit.block.BlockFace.DOWN<method*end>), 999999999);
} else
SlimefunPlugin.getLocal<method*start>me.mrCookieSlime.Slimefun.SlimefunPlugin.getLocal<method*end>().sendMessage(sender, "messages.unknown-player", msg -> msg.replace<method*start>msg.replace<method*end>("%player%", args[1]));
} else
SlimefunPlugin.getLocal<method*start>me.mrCookieSlime.Slimefun.SlimefunPlugin.getLocal<method*end>().sendMessage(sender, "messages.no-permission");
} else
SlimefunPlugin.getLocal<method*start>me.mrCookieSlime.Slimefun.SlimefunPlugin.getLocal<method*end>().sendMessage(sender, "messages.usage", msg -> msg.replace<method*start>msg.replace<method*end>("%usage%", "/sf teleporter <Player>"));
}
|
@Override
public boolean hasPatchPermission(Authentication authentication, Serializable targetId, String targetType, Patch patch) {
List<Operation> operations = patch.getOperations();
for (Operation op : operations) {
if (!op.getPath().contentEquals(EPersonOperationFactory.OPERATION_PASSWORD_CHANGE)) {
return false;
}
}
return true;
}
|
annotation
|
@Override<method*start>java.lang.Override<method*end>
public boolean hasPatchPermission(Authentication<method*start>org.springframework.security.core.Authentication<method*end> authentication, Serializable<method*start>java.io.Serializable<method*end> targetId, String<method*start>java.lang.String<method*end> targetType, Patch<method*start>org.dspace.app.rest.model.patch.Patch<method*end> patch) {
/**
* First verify that the user has write permission on the eperson.
*/
if (!hasPermission<method*start>org.dspace.app.rest.security.RestObjectPermissionEvaluatorPlugin.hasPermission<method*end>(authentication, targetId, targetType, "WRITE")) {
return false;
}
List<method*start>java.util.List<method*end><Operation<method*start>org.dspace.app.rest.model.patch.Operation<method*end>> operations = patch.getOperations<method*start>org.dspace.app.rest.model.patch.Patch.getOperations<method*end>();
/**
* The entire Patch request should be denied if it contains operations that are
* restricted to Dspace administrators. The authenticated user is currently allowed to
* update their own password.
*/
for (Operation<method*start>org.dspace.app.rest.model.patch.Operation<method*end> op : operations) {
if (!op.getPath<method*start>org.dspace.app.rest.model.patch.Operation.getPath<method*end>().contentEquals<method*start>java.lang.String.contentEquals<method*end>(EPersonOperationFactory.OPERATION_PASSWORD_CHANGE<method*start>org.dspace.app.rest.repository.patch.factories.EPersonOperationFactory.OPERATION_PASSWORD_CHANGE<method*end>)) {
return false;
}
}
return true;
}
|
protected List<method*start>java.util.List<method*end><IPortalDataType<method*start>org.apereo.portal.io.xml.IPortalDataType<method*end>> getAllowedTypes(PortletRequest<method*start>javax.portlet.PortletRequest<method*end> request, String<method*start>java.lang.String<method*end> activityName, Iterable<method*start>java.lang.Iterable<method*end><IPortalDataType<method*start>org.apereo.portal.io.xml.IPortalDataType<method*end>> dataTypes) {
final List<method*start>java.util.List<method*end><IPortalDataType<method*start>org.apereo.portal.io.xml.IPortalDataType<method*end>> results = new ArrayList<method*start>java.util.ArrayList<method*end><IPortalDataType<method*start>org.apereo.portal.io.xml.IPortalDataType<method*end>>();
for (IPortalDataType<method*start>org.apereo.portal.io.xml.IPortalDataType<method*end> type : dataTypes) {
final String<method*start>java.lang.String<method*end> typeId = type.getTypeId<method*start>org.apereo.portal.io.xml.IPortalDataType.getTypeId<method*end>();
results.add<method*start>java.util.List.add<method*end>(type);
}
}
return results;
}
|
conventional
|
protected List<method*start>java.util.List<method*end><IPortalDataType<method*start>org.apereo.portal.io.xml.IPortalDataType<method*end>> getAllowedTypes(PortletRequest<method*start>javax.portlet.PortletRequest<method*end> request, String<method*start>java.lang.String<method*end> activityName, Iterable<method*start>java.lang.Iterable<method*end><IPortalDataType<method*start>org.apereo.portal.io.xml.IPortalDataType<method*end>> dataTypes) {
// get the authorization principal representing the current user
final HttpServletRequest<method*start>javax.servlet.http.HttpServletRequest<method*end> httpServletRequest = this.portalRequestUtils.getPortletHttpRequest<method*start>org.apereo.portal.url.IPortalRequestUtils.getPortletHttpRequest<method*end>(request);
final IPerson person = personManager.getPerson<method*start>org.apereo.portal.security.IPersonManager.getPerson<method*end>(httpServletRequest);
final EntityIdentifier ei = person.getEntityIdentifier<method*start>org.apereo.portal.security.IPerson.getEntityIdentifier<method*end>();
final IAuthorizationPrincipal<method*start>org.apereo.portal.security.IAuthorizationPrincipal<method*end> ap = AuthorizationServiceFacade.instance<method*start>org.apereo.portal.services.AuthorizationServiceFacade.instance<method*end>().newPrincipal<method*start>org.apereo.portal.services.AuthorizationServiceFacade.newPrincipal<method*end>(ei.getKey<method*start>org.apereo.portal.EntityIdentifier.getKey<method*end>(), ei.getType<method*start>org.apereo.portal.EntityIdentifier.getType<method*end>());
// filter the list of configured import/export types by user permission
final List<method*start>java.util.List<method*end><IPortalDataType<method*start>org.apereo.portal.io.xml.IPortalDataType<method*end>> results = new ArrayList<method*start>java.util.ArrayList<method*end><IPortalDataType<method*start>org.apereo.portal.io.xml.IPortalDataType<method*end>>();
for (IPortalDataType<method*start>org.apereo.portal.io.xml.IPortalDataType<method*end> type : dataTypes) {
final String<method*start>java.lang.String<method*end> typeId = type.getTypeId<method*start>org.apereo.portal.io.xml.IPortalDataType.getTypeId<method*end>();
if (ap.hasPermission<method*start>org.apereo.portal.security.IAuthorizationPrincipal.hasPermission<method*end>(IPermission.PORTAL_SYSTEM<method*start>org.apereo.portal.security.IPermission.PORTAL_SYSTEM<method*end>, activityName, typeId)) {
results.add<method*start>java.util.List.add<method*end>(type);
}
}
return results;
}
|
@Override
public void messageOnServerThread(final SifterSettingsMessage message, final EntityPlayerMP player) {
final IColony colony = IColonyManager.getInstance().getColonyByDimension(message.colonyId, message.dimension);
if (colony != null) {
@Nullable final BuildingSifter building = colony.getBuildingManager().getBuilding(message.buildingId, BuildingSifter.class);
if (building != null) {
int qty = message.quantity;
if (qty > building.getMaxDailyQuantity()) {
qty = building.getMaxDailyQuantity();
player.sendMessage(new TextComponentTranslation("com.minecolonies.coremod.sifter.toomuch", qty));
}
building.setup(new ItemStorage(message.block), new ItemStorage(message.mesh), qty);
if (message.buy) {
InventoryUtils.reduceStackInItemHandler(new InvWrapper(player.inventory), message.mesh);
}
}
}
}
|
annotation
|
@Override
public void messageOnServerThread(final SifterSettingsMessage<method*start>com.minecolonies.coremod.network.messages.SifterSettingsMessage<method*end> message, final EntityPlayerMP<method*start>net.minecraft.entity.player.EntityPlayerMP<method*end> player) {
final IColony<method*start>com.minecolonies.api.colony.IColony<method*end> colony = IColonyManager<method*start>com.minecolonies.api.colony.IColonyManager<method*end>.getInstance().getColonyByDimension(message.colonyId, message.dimension);
if (colony<method*start>com.minecolonies.coremod.colony.buildings.AbstractCitizenAssignable.colony<method*end> != null) {
// Verify player has permission to change this huts settings
if (!colony<method*start>com.minecolonies.coremod.colony.buildings.AbstractCitizenAssignable.colony<method*end>.getPermissions().hasPermission(player, Action<method*start>com.minecolonies.api.colony.permissions.Action<method*end>.MANAGE_HUTS)) {
return;
}
@Nullable final BuildingSifter<method*start>com.minecolonies.coremod.colony.buildings.workerbuildings.BuildingSifter<method*end> building = colony<method*start>com.minecolonies.coremod.colony.buildings.AbstractCitizenAssignable.colony<method*end>.getBuildingManager().getBuilding(message.buildingId, BuildingSifter<method*start>com.minecolonies.coremod.colony.buildings.workerbuildings.BuildingSifter<method*end>.class);
if (building != null) {
int qty = message.quantity;
if (qty > building.getMaxDailyQuantity()) {
qty = building.getMaxDailyQuantity();
player.sendMessage(new TextComponentTranslation<method*start>net.minecraft.util.text.TextComponentTranslation<method*end>("com.minecolonies.coremod.sifter.toomuch", qty));
}
building.setup(new ItemStorage<method*start>com.minecolonies.api.crafting.ItemStorage<method*end>(message.block), new ItemStorage<method*start>com.minecolonies.api.crafting.ItemStorage<method*end>(message.mesh), qty);
if (message.buy) {
InventoryUtils.reduceStackInItemHandler(new InvWrapper<method*start>net.minecraftforge.items.wrapper.InvWrapper<method*end>(player.inventory), message.mesh);
}
}
}
}
|
@CommandDescription(aliases<method*start>org.spout.api.command.annotated.CommandDescription.aliases<method*end> = { "say", "chat" }, usage<method*start>org.spout.api.command.annotated.CommandDescription.usage<method*end> = "[message]", desc<method*start>org.spout.api.command.annotated.CommandDescription.desc<method*end> = "Say something!")
public void serverSay(CommandSource<method*start>org.spout.api.command.CommandSource<method*end> source, CommandArguments<method*start>org.spout.api.command.CommandArguments<method*end> args) throws CommandException<method*start>org.spout.api.exception.CommandException<method*end> {
String<method*start>java.lang.String<method*end> message = args.popRemainingStrings<method*start>org.spout.api.command.CommandArguments.popRemainingStrings<method*end>("message", source.getName<method*start>org.spout.api.command.CommandSource.getName<method*end>() + " has nothing to say!");
String<method*start>java.lang.String<method*end> name;
if (source instanceof Player<method*start>org.spout.api.entity.Player<method*end>) {
Player<method*start>org.spout.api.entity.Player<method*end> player = (Player<method*start>org.spout.api.entity.Player<method*end>) source;
PlayerChatEvent event = getEngine().getEventManager<method*start>org.spout.engine.SpoutEngine.getEventManager<method*end>().callEvent<method*start>org.spout.api.event.EventManager.callEvent<method*end>(new PlayerChatEvent(player, message));
if (event.isCancelled<method*start>org.spout.api.event.Event.isCancelled<method*end>()) {
return;
}
name = player.getDisplayName<method*start>org.spout.api.entity.Player.getDisplayName<method*end>();
message = event.getMessage<method*start>org.spout.api.event.player.PlayerChatEvent.getMessage<method*end>();
} else {
name = source.getName<method*start>org.spout.api.command.CommandSource.getName<method*end>();
}
getEngine().broadcastMessage<method*start>org.spout.engine.SpoutServer.broadcastMessage<method*end>("<" + name + "> " + message);
}
|
annotation
|
@CommandDescription(aliases<method*start>org.spout.api.command.annotated.CommandDescription.aliases<method*end> = { "say", "chat" }, usage<method*start>org.spout.api.command.annotated.CommandDescription.usage<method*end> = "[message]", desc<method*start>org.spout.api.command.annotated.CommandDescription.desc<method*end> = "Say something!")
public void serverSay(CommandSource<method*start>org.spout.api.command.CommandSource<method*end> source, CommandArguments<method*start>org.spout.api.command.CommandArguments<method*end> args) throws CommandException<method*start>org.spout.api.exception.CommandException<method*end> {
String<method*start>java.lang.String<method*end> message = args.popRemainingStrings<method*start>org.spout.api.command.CommandArguments.popRemainingStrings<method*end>("message", source.getName<method*start>org.spout.api.command.CommandSource.getName<method*end>() + " has nothing to say!");
if (!source.hasPermission<method*start>org.spout.api.command.CommandSource.hasPermission<method*end>("spout.chat.send")) {
throw new CommandException<method*start>org.spout.api.exception.CommandException<method*end>("You do not have permission to send chat messages");
}
String<method*start>java.lang.String<method*end> name;
if (source instanceof Player<method*start>org.spout.api.entity.Player<method*end>) {
Player<method*start>org.spout.api.entity.Player<method*end> player = (Player<method*start>org.spout.api.entity.Player<method*end>) source;
PlayerChatEvent event = getEngine().getEventManager<method*start>org.spout.engine.SpoutEngine.getEventManager<method*end>().callEvent<method*start>org.spout.api.event.EventManager.callEvent<method*end>(new PlayerChatEvent(player, message));
if (event.isCancelled<method*start>org.spout.api.event.Event.isCancelled<method*end>()) {
return;
}
name = player.getDisplayName<method*start>org.spout.api.entity.Player.getDisplayName<method*end>();
message = event.getMessage<method*start>org.spout.api.event.player.PlayerChatEvent.getMessage<method*end>();
} else {
name = source.getName<method*start>org.spout.api.command.CommandSource.getName<method*end>();
}
getEngine().broadcastMessage<method*start>org.spout.engine.SpoutServer.broadcastMessage<method*end>("<" + name + "> " + message);
}
|
@Override
public void checkPermission(String path, String actions) {
PathSupplier supplier = pathSupplierFor(absolutePathFor(path));
String[] actionsArray = actions.split(",");
checkPermission(workspace().getName(), supplier, actionsArray);
if (!hasPermissionOnExternalPath(supplier, actionsArray)) {
String absPath = supplier.getAbsolutePath().getString(namespaces());
throw new AccessDeniedException(JcrI18n.permissionDenied.text(absPath, actions));
}
}
|
annotation
|
@Override
public void checkPermission(String<method*start>java.lang.String<method*end> path, String<method*start>java.lang.String<method*end> actions) {
CheckArg.isNotEmpty<method*start>org.modeshape.common.util.CheckArg.isNotEmpty<method*end>(path, "path");
CheckArg.isNotEmpty<method*start>org.modeshape.common.util.CheckArg.isNotEmpty<method*end>(actions, "actions");
try {
PathSupplier supplier = pathSupplierFor(absolutePathFor(path));
String<method*start>java.lang.String<method*end>[] actionsArray = actions.split<method*start>java.lang.String.split<method*end>(",");
checkPermission(workspace().getName<method*start>org.modeshape.jcr.JcrWorkspace.getName<method*end>(), supplier, actionsArray);
if (!hasPermissionOnExternalPath(supplier, actionsArray)) {
String<method*start>java.lang.String<method*end> absPath = supplier.getAbsolutePath<method*start>org.modeshape.jcr.JcrSession.PathSupplier.getAbsolutePath<method*end>().getString<method*start>org.modeshape.jcr.value.Path.getString<method*end>(namespaces());
throw new AccessDeniedException<method*start>javax.jcr.AccessDeniedException<method*end>(JcrI18n.permissionDenied.text<method*start>org.modeshape.common.i18n.I18n.text<method*end>(absPath, actions));
}
} catch (RepositoryException<method*start>javax.jcr.RepositoryException<method*end> e) {
throw new AccessControlException<method*start>java.security.AccessControlException<method*end>(JcrI18n.permissionDenied.text<method*start>org.modeshape.common.i18n.I18n.text<method*end>(path, actions));
}
}
|
@Override
public void execute(CommandSender sender, String[] args) {
if (args.length == 0) {
sender.sendMessage(TextComponent.fromLegacyText(ChatColor.translateAlternateColorCodes('&', BridgeConfigurationProvider.load().getPrefix()) + "/cloudnet <command>"));
return;
}
String commandLine = String.join(" ", args);
if (sender instanceof ProxiedPlayer) {
CommandInfo commandInfo = CloudNetDriver.getInstance().getNodeInfoProvider().getConsoleCommand(commandLine);
sender.sendMessage(TextComponent.fromLegacyText(ChatColor.translateAlternateColorCodes('&', BridgeConfigurationProvider.load().getMessages().get("command-cloud-sub-command-no-permission").replace("%command%", commandLine))));
return;
}
}
}
String[] messages = CloudNetDriver.getInstance().sendCommandLine(commandLine);
if (messages != null) {
for (String message : messages) {
if (message != null) {
sender.sendMessage(TextComponent.fromLegacyText(ChatColor.translateAlternateColorCodes('&', BridgeConfigurationProvider.load().getPrefix() + message)));
}
}
}
}
|
annotation
|
@Override
public void execute(CommandSender<method*start>net.md_5.bungee.api.CommandSender<method*end> sender, String<method*start>java.lang.String<method*end>[] args) {
if (args.length == 0) {
sender.sendMessage(TextComponent<method*start>net.md_5.bungee.api.chat.TextComponent<method*end>.fromLegacyText(ChatColor<method*start>net.md_5.bungee.api.ChatColor<method*end>.translateAlternateColorCodes('&', BridgeConfigurationProvider.load().getPrefix()) + "/cloudnet <command>"));
return;
}
String<method*start>java.lang.String<method*end> commandLine = String<method*start>java.lang.String<method*end>.join(" ", args);
if (sender instanceof ProxiedPlayer<method*start>net.md_5.bungee.api.connection.ProxiedPlayer<method*end>) {
CommandInfo commandInfo = CloudNetDriver<method*start>de.dytanic.cloudnet.driver.CloudNetDriver<method*end>.getInstance().getNodeInfoProvider().getConsoleCommand(commandLine);
if (commandInfo != null && commandInfo.getPermission() != null) {
if (!sender.hasPermission(commandInfo.getPermission())) {
sender.sendMessage(TextComponent<method*start>net.md_5.bungee.api.chat.TextComponent<method*end>.fromLegacyText(ChatColor<method*start>net.md_5.bungee.api.ChatColor<method*end>.translateAlternateColorCodes('&', BridgeConfigurationProvider.load().getMessages().get("command-cloud-sub-command-no-permission").replace("%command%", commandLine))));
return;
}
}
}
String<method*start>java.lang.String<method*end>[] messages = CloudNetDriver<method*start>de.dytanic.cloudnet.driver.CloudNetDriver<method*end>.getInstance().sendCommandLine(commandLine);
if (messages != null) {
for (String<method*start>java.lang.String<method*end> message : messages) {
if (message != null) {
sender.sendMessage(TextComponent<method*start>net.md_5.bungee.api.chat.TextComponent<method*end>.fromLegacyText(ChatColor<method*start>net.md_5.bungee.api.ChatColor<method*end>.translateAlternateColorCodes('&', BridgeConfigurationProvider.load().getPrefix() + message)));
}
}
}
}
|
@WrapInTransaction
public Template<method*start>com.dotmarketing.portlets.templates.model.Template<method*end> saveTemplate(final IHTMLPage<method*start>com.dotmarketing.portlets.htmlpageasset.model.IHTMLPage<method*end> page, final User<method*start>com.liferay.portal.model.User<method*end> user, final PageForm<method*start>com.dotcms.rest.api.v1.page.PageForm<method*end> pageForm) throws BadRequestException<method*start>com.dotcms.rest.exception.BadRequestException<method*end>, DotDataException<method*start>com.dotmarketing.exception.DotDataException<method*end>, DotSecurityException<method*start>com.dotmarketing.exception.DotSecurityException<method*end> {
try {
final Host<method*start>com.dotmarketing.beans.Host<method*end> host = getHost<method*start>com.dotcms.rest.api.v1.page.PageResourceHelper.getHost<method*end>(pageForm.getHostId<method*start>com.dotcms.rest.api.v1.page.PageForm.getHostId<method*end>(), user);
final User<method*start>com.liferay.portal.model.User<method*end> systemUser = userAPI.getSystemUser<method*start>com.dotmarketing.business.UserAPI.getSystemUser<method*end>();
final Template<method*start>com.dotmarketing.portlets.templates.model.Template<method*end> template = getTemplate<method*start>com.dotcms.rest.api.v1.page.PageResourceHelper.getTemplate<method*end>(page, systemUser, pageForm);
final boolean hasPermission = template.isAnonymous<method*start>com.dotmarketing.portlets.templates.model.Template.isAnonymous<method*end>() ? permissionAPI.doesUserHavePermission<method*start>com.dotmarketing.business.PermissionAPI.doesUserHavePermission<method*end>(page, PermissionLevel.EDIT.getType<method*start>com.dotmarketing.business.PermissionLevel.getType<method*end>(), user) : permissionAPI.doesUserHavePermission<method*start>com.dotmarketing.business.PermissionAPI.doesUserHavePermission<method*end>(template, PermissionLevel.EDIT.getType<method*start>com.dotmarketing.business.PermissionLevel.getType<method*end>(), user);
template.setDrawed<method*start>com.dotmarketing.portlets.templates.model.Template.setDrawed<method*end>(true);
updateMultiTrees<method*start>com.dotcms.rest.api.v1.page.PageResourceHelper.updateMultiTrees<method*end>(page, pageForm);
return this.templateAPI.saveTemplate<method*start>com.dotmarketing.portlets.templates.business.TemplateAPI.saveTemplate<method*end>(template, host, user, false);
} catch (BadRequestException<method*start>com.dotcms.rest.exception.BadRequestException<method*end> | DotDataException<method*start>com.dotmarketing.exception.DotDataException<method*end> | DotSecurityException<method*start>com.dotmarketing.exception.DotSecurityException<method*end> e) {
throw new DotRuntimeException<method*start>com.dotmarketing.exception.DotRuntimeException<method*end>(e);
}
}
|
conventional
|
@WrapInTransaction
public Template<method*start>com.dotmarketing.portlets.templates.model.Template<method*end> saveTemplate(final IHTMLPage<method*start>com.dotmarketing.portlets.htmlpageasset.model.IHTMLPage<method*end> page, final User<method*start>com.liferay.portal.model.User<method*end> user, final PageForm<method*start>com.dotcms.rest.api.v1.page.PageForm<method*end> pageForm) throws BadRequestException<method*start>com.dotcms.rest.exception.BadRequestException<method*end>, DotDataException<method*start>com.dotmarketing.exception.DotDataException<method*end>, DotSecurityException<method*start>com.dotmarketing.exception.DotSecurityException<method*end> {
try {
final Host<method*start>com.dotmarketing.beans.Host<method*end> host = getHost<method*start>com.dotcms.rest.api.v1.page.PageResourceHelper.getHost<method*end>(pageForm.getHostId<method*start>com.dotcms.rest.api.v1.page.PageForm.getHostId<method*end>(), user);
final User<method*start>com.liferay.portal.model.User<method*end> systemUser = userAPI.getSystemUser<method*start>com.dotmarketing.business.UserAPI.getSystemUser<method*end>();
final Template<method*start>com.dotmarketing.portlets.templates.model.Template<method*end> template = getTemplate<method*start>com.dotcms.rest.api.v1.page.PageResourceHelper.getTemplate<method*end>(page, systemUser, pageForm);
final boolean hasPermission = template.isAnonymous<method*start>com.dotmarketing.portlets.templates.model.Template.isAnonymous<method*end>() ? permissionAPI.doesUserHavePermission<method*start>com.dotmarketing.business.PermissionAPI.doesUserHavePermission<method*end>(page, PermissionLevel.EDIT.getType<method*start>com.dotmarketing.business.PermissionLevel.getType<method*end>(), user) : permissionAPI.doesUserHavePermission<method*start>com.dotmarketing.business.PermissionAPI.doesUserHavePermission<method*end>(template, PermissionLevel.EDIT.getType<method*start>com.dotmarketing.business.PermissionLevel.getType<method*end>(), user);
if (!hasPermission) {
throw new DotSecurityException<method*start>com.dotmarketing.exception.DotSecurityException<method*end>("The user doesn't have permission to EDIT");
}
template.setDrawed<method*start>com.dotmarketing.portlets.templates.model.Template.setDrawed<method*end>(true);
updateMultiTrees<method*start>com.dotcms.rest.api.v1.page.PageResourceHelper.updateMultiTrees<method*end>(page, pageForm);
return this.templateAPI.saveTemplate<method*start>com.dotmarketing.portlets.templates.business.TemplateAPI.saveTemplate<method*end>(template, host, user, false);
} catch (BadRequestException<method*start>com.dotcms.rest.exception.BadRequestException<method*end> | DotDataException<method*start>com.dotmarketing.exception.DotDataException<method*end> | DotSecurityException<method*start>com.dotmarketing.exception.DotSecurityException<method*end> e) {
throw new DotRuntimeException<method*start>com.dotmarketing.exception.DotRuntimeException<method*end>(e);
}
}
|
@Listener
public void onBlockUpdate(NotifyNeighborBlockEvent event, @First LocatableBlock source) {
if (!redstoneFuel.getValue())
return;
if (!SignUtil.isSign(source.getLocation()))
return;
Location<World> block = source.getLocation();
Sign sign = (Sign) block.getTileEntity().get();
if (isMechanicSign(sign)) {
Player player = event.getCause().first(Player.class).orElse(null);
int newPower = BlockUtil.getBlockPowerLevel(block).orElse(0);
int oldPower = block.get(CraftBookKeys.LAST_POWER).orElse(0);
if (newPower != oldPower) {
if (newPower > oldPower) {
increaseMultiplier(sign, newPower - oldPower);
}
block.offer(new LastPowerData(newPower));
}
}
}
|
annotation
|
@Listener
public void onBlockUpdate(NotifyNeighborBlockEvent<method*start>org.spongepowered.api.event.block.NotifyNeighborBlockEvent<method*end> event, @First LocatableBlock source) {
if (!redstoneFuel.getValue<method*start>com.sk89q.craftbook.core.util.ConfigValue.getValue<method*end>())
return;
if (!SignUtil.isSign<method*start>com.sk89q.craftbook.sponge.util.SignUtil.isSign<method*end>(source.getLocation<method*start>org.spongepowered.api.world.LocatableBlock.getLocation<method*end>()))
return;
Location<method*start>org.spongepowered.api.world.Location<method*end><World<method*start>org.spongepowered.api.world.World<method*end>> block = source.getLocation<method*start>org.spongepowered.api.world.LocatableBlock.getLocation<method*end>();
Sign<method*start>org.spongepowered.api.block.tileentity.Sign<method*end> sign = (Sign<method*start>org.spongepowered.api.block.tileentity.Sign<method*end>) block.getTileEntity<method*start>org.spongepowered.api.world.Location<org.spongepowered.api.world.World>.getTileEntity<method*end>().get();
if (isMechanicSign<method*start>com.sk89q.craftbook.sponge.mechanics.types.SpongeSignMechanic.isMechanicSign<method*end>(sign)) {
Player player = event.getCause<method*start>org.spongepowered.api.event.block.NotifyNeighborBlockEvent.getCause<method*end>().first(Player.class).orElse(null);
if (player != null) {
if (!refuelPermissions.hasPermission<method*start>com.sk89q.craftbook.sponge.util.SpongePermissionNode.hasPermission<method*end>(player)) {
player.sendMessage<method*start>org.spongepowered.api.entity.living.player.Player.sendMessage<method*end>(Text.of<method*start>org.spongepowered.api.text.Text.of<method*end>("You don't have permission to refuel this mechanic!"));
return;
}
}
int newPower = BlockUtil.getBlockPowerLevel<method*start>com.sk89q.craftbook.sponge.util.BlockUtil.getBlockPowerLevel<method*end>(block).orElse<method*start>java.util.Optional.orElse<method*end>(0);
int oldPower = block.get<method*start>org.spongepowered.api.world.Location<org.spongepowered.api.world.World>.get<method*end>(CraftBookKeys.LAST_POWER<method*start>com.sk89q.craftbook.sponge.util.data.CraftBookKeys.LAST_POWER<method*end>).orElse(0);
if (newPower != oldPower) {
if (newPower > oldPower) {
increaseMultiplier<method*start>com.sk89q.craftbook.sponge.mechanics.CookingPot.increaseMultiplier<method*end>(sign, newPower - oldPower);
}
block.offer<method*start>org.spongepowered.api.world.Location<org.spongepowered.api.world.World>.offer<method*end>(new LastPowerData<method*start>com.sk89q.craftbook.sponge.util.data.mutable.LastPowerData<method*end>(newPower));
}
}
}
|
@Override
public void onExecute(CommandSender<method*start>org.bukkit.command.CommandSender<method*end> sender, String<method*start>java.lang.String<method*end>[] args) {
sender.sendMessage<method*start>org.bukkit.command.CommandSender.sendMessage<method*end>(ChatColors.color<method*start>io.github.thebusybiscuit.cscorelib2.chat.ChatColors.color<method*end>("&a" + Bukkit.getName<method*start>org.bukkit.Bukkit.getName<method*end>() + " &2" + ReflectionUtils.getVersion<method*start>io.github.thebusybiscuit.cscorelib2.reflection.ReflectionUtils.getVersion<method*end>()));
sender.sendMessage<method*start>org.bukkit.command.CommandSender.sendMessage<method*end>("");
sender.sendMessage<method*start>org.bukkit.command.CommandSender.sendMessage<method*end>(ChatColors.color<method*start>io.github.thebusybiscuit.cscorelib2.chat.ChatColors.color<method*end>("&aCS-CoreLib &2v" + CSCoreLib.getLib<method*start>me.mrCookieSlime.CSCoreLibPlugin.CSCoreLib.getLib<method*end>().getDescription().getVersion()));
sender.sendMessage<method*start>org.bukkit.command.CommandSender.sendMessage<method*end>(ChatColors.color<method*start>io.github.thebusybiscuit.cscorelib2.chat.ChatColors.color<method*end>("&aSlimefun &2v" + plugin.getDescription<method*start>me.mrCookieSlime.Slimefun.SlimefunPlugin.getDescription<method*end>().getVersion()));
sender.sendMessage<method*start>org.bukkit.command.CommandSender.sendMessage<method*end>("");
Collection<method*start>java.util.Collection<method*end><Plugin<method*start>org.bukkit.plugin.Plugin<method*end>> addons = SlimefunPlugin.getInstalledAddons<method*start>me.mrCookieSlime.Slimefun.SlimefunPlugin.getInstalledAddons<method*end>();
sender.sendMessage<method*start>org.bukkit.command.CommandSender.sendMessage<method*end>(ChatColors.color<method*start>io.github.thebusybiscuit.cscorelib2.chat.ChatColors.color<method*end>("&7Installed Addons &8(" + addons.size<method*start>java.util.Collection.size<method*end>() + ")"));
for (Plugin<method*start>org.bukkit.plugin.Plugin<method*end> plugin : addons) {
if (Bukkit.getPluginManager<method*start>org.bukkit.Bukkit.getPluginManager<method*end>().isPluginEnabled(plugin)) {
sender.sendMessage<method*start>org.bukkit.command.CommandSender.sendMessage<method*end>(ChatColors.color<method*start>io.github.thebusybiscuit.cscorelib2.chat.ChatColors.color<method*end>(" &a" + plugin.getName<method*start>org.bukkit.plugin.Plugin.getName<method*end>() + " &2v" + plugin.getDescription<method*start>org.bukkit.plugin.Plugin.getDescription<method*end>().getVersion()));
} else {
sender.sendMessage<method*start>org.bukkit.command.CommandSender.sendMessage<method*end>(ChatColors.color<method*start>io.github.thebusybiscuit.cscorelib2.chat.ChatColors.color<method*end>(" &c" + plugin.getName<method*start>org.bukkit.plugin.Plugin.getName<method*end>() + " &4v" + plugin.getDescription<method*start>org.bukkit.plugin.Plugin.getDescription<method*end>().getVersion()));
}
}
} else {
SlimefunPlugin.getLocal<method*start>me.mrCookieSlime.Slimefun.SlimefunPlugin.getLocal<method*end>().sendMessage(sender, "messages.no-permission", true);
}
}
|
annotation
|
@Override
public void onExecute(CommandSender<method*start>org.bukkit.command.CommandSender<method*end> sender, String<method*start>java.lang.String<method*end>[] args) {
if (sender.hasPermission<method*start>org.bukkit.command.CommandSender.hasPermission<method*end>("slimefun.command.versions") || sender instanceof ConsoleCommandSender<method*start>org.bukkit.command.ConsoleCommandSender<method*end>) {
sender.sendMessage<method*start>org.bukkit.command.CommandSender.sendMessage<method*end>(ChatColors.color<method*start>io.github.thebusybiscuit.cscorelib2.chat.ChatColors.color<method*end>("&a" + Bukkit.getName<method*start>org.bukkit.Bukkit.getName<method*end>() + " &2" + ReflectionUtils.getVersion<method*start>io.github.thebusybiscuit.cscorelib2.reflection.ReflectionUtils.getVersion<method*end>()));
sender.sendMessage<method*start>org.bukkit.command.CommandSender.sendMessage<method*end>("");
sender.sendMessage<method*start>org.bukkit.command.CommandSender.sendMessage<method*end>(ChatColors.color<method*start>io.github.thebusybiscuit.cscorelib2.chat.ChatColors.color<method*end>("&aCS-CoreLib &2v" + CSCoreLib.getLib<method*start>me.mrCookieSlime.CSCoreLibPlugin.CSCoreLib.getLib<method*end>().getDescription().getVersion()));
sender.sendMessage<method*start>org.bukkit.command.CommandSender.sendMessage<method*end>(ChatColors.color<method*start>io.github.thebusybiscuit.cscorelib2.chat.ChatColors.color<method*end>("&aSlimefun &2v" + plugin.getDescription<method*start>me.mrCookieSlime.Slimefun.SlimefunPlugin.getDescription<method*end>().getVersion()));
sender.sendMessage<method*start>org.bukkit.command.CommandSender.sendMessage<method*end>("");
Collection<method*start>java.util.Collection<method*end><Plugin<method*start>org.bukkit.plugin.Plugin<method*end>> addons = SlimefunPlugin.getInstalledAddons<method*start>me.mrCookieSlime.Slimefun.SlimefunPlugin.getInstalledAddons<method*end>();
sender.sendMessage<method*start>org.bukkit.command.CommandSender.sendMessage<method*end>(ChatColors.color<method*start>io.github.thebusybiscuit.cscorelib2.chat.ChatColors.color<method*end>("&7Installed Addons &8(" + addons.size<method*start>java.util.Collection.size<method*end>() + ")"));
for (Plugin<method*start>org.bukkit.plugin.Plugin<method*end> plugin : addons) {
if (Bukkit.getPluginManager<method*start>org.bukkit.Bukkit.getPluginManager<method*end>().isPluginEnabled(plugin)) {
sender.sendMessage<method*start>org.bukkit.command.CommandSender.sendMessage<method*end>(ChatColors.color<method*start>io.github.thebusybiscuit.cscorelib2.chat.ChatColors.color<method*end>(" &a" + plugin.getName<method*start>org.bukkit.plugin.Plugin.getName<method*end>() + " &2v" + plugin.getDescription<method*start>org.bukkit.plugin.Plugin.getDescription<method*end>().getVersion()));
} else {
sender.sendMessage<method*start>org.bukkit.command.CommandSender.sendMessage<method*end>(ChatColors.color<method*start>io.github.thebusybiscuit.cscorelib2.chat.ChatColors.color<method*end>(" &c" + plugin.getName<method*start>org.bukkit.plugin.Plugin.getName<method*end>() + " &4v" + plugin.getDescription<method*start>org.bukkit.plugin.Plugin.getDescription<method*end>().getVersion()));
}
}
} else {
SlimefunPlugin.getLocal<method*start>me.mrCookieSlime.Slimefun.SlimefunPlugin.getLocal<method*end>().sendMessage(sender, "messages.no-permission", true);
}
}
|
public static Boolean userIsAllowedToConfigure(String portalPageId, Map context) {
Boolean userIsAllowed = false;
if (UtilValidate.isNotEmpty(portalPageId)) {
GenericValue userLogin = (GenericValue) context.get("userLogin");
if (userLogin != null) {
String userLoginId = (String) userLogin.get("userLoginId");
Security security = (Security) context.get("security");
Boolean hasPortalAdminPermission = security.hasPermission("PORTALPAGE_ADMIN", userLogin);
try {
Delegator delegator = WidgetWorker.getDelegator(context);
GenericValue portalPage = EntityQuery.use(delegator).from("PortalPage").where("portalPageId", portalPageId).queryOne();
String ownerUserLoginId = (String) portalPage.get("ownerUserLoginId");
// Users with PORTALPAGE_ADMIN permission can configure every Portal Page
}
} catch (GenericEntityException e) {
return false;
}
}
}
return userIsAllowed;
}
|
conventional
|
public static Boolean<method*start>java.lang.Boolean<method*end> userIsAllowedToConfigure(String<method*start>java.lang.String<method*end> portalPageId, Map<method*start>java.util.Map<method*end><String<method*start>java.lang.String<method*end>, Object<method*start>java.lang.Object<method*end>> context) {
Boolean<method*start>java.lang.Boolean<method*end> userIsAllowed = false;
if (UtilValidate.isNotEmpty<method*start>org.apache.ofbiz.base.util.UtilValidate.isNotEmpty<method*end>(portalPageId)) {
GenericValue userLogin = (GenericValue) context.get<method*start>java.util.Map.get<method*end>("userLogin");
if (userLogin != null) {
String<method*start>java.lang.String<method*end> userLoginId = (String<method*start>java.lang.String<method*end>) userLogin.get<method*start>org.apache.ofbiz.entity.GenericEntity.get<method*end>("userLoginId");
Security security = (Security) context.get<method*start>java.util.Map.get<method*end>("security");
Boolean<method*start>java.lang.Boolean<method*end> hasPortalAdminPermission = security.hasPermission<method*start>org.apache.ofbiz.security.Security.hasPermission<method*end>("PORTALPAGE_ADMIN", userLogin);
try {
Delegator delegator = WidgetWorker.getDelegator<method*start>org.apache.ofbiz.widget.WidgetWorker.getDelegator<method*end>(context);
GenericValue portalPage = EntityQuery.use<method*start>org.apache.ofbiz.entity.util.EntityQuery.use<method*end>(delegator).from<method*start>org.apache.ofbiz.entity.util.EntityQuery.from<method*end>("PortalPage").where<method*start>org.apache.ofbiz.entity.util.EntityQuery.where<method*end>("portalPageId", portalPageId).queryOne<method*start>org.apache.ofbiz.entity.util.EntityQuery.queryOne<method*end>();
if (portalPage != null) {
String<method*start>java.lang.String<method*end> ownerUserLoginId = (String<method*start>java.lang.String<method*end>) portalPage.get<method*start>org.apache.ofbiz.entity.GenericEntity.get<method*end>("ownerUserLoginId");
// Users with PORTALPAGE_ADMIN permission can configure every Portal Page
userIsAllowed = (ownerUserLoginId.equals<method*start>java.lang.String.equals<method*end>(userLoginId) || hasPortalAdminPermission);
}
} catch (GenericEntityException<method*start>org.apache.ofbiz.entity.GenericEntityException<method*end> e) {
return false;
}
}
}
return userIsAllowed;
}
|
@SuppressLint("CheckResult")
private void checkPermissions() {
final String ENABLED = getResources().getString(R.string.enabled);
final String DISABLED = getResources().getString(R.string.disabled);
materialProgressBar.setVisibility(View.VISIBLE);
permissionsMainContainer.setVisibility(View.GONE);
for (ArrayMap.Entry<String, String> entry : REQUIRED_PERMISSIONS.entrySet()) {
Logger.debug("CheckPermissionsActivity permission: " + entry.getKey() + " / " + entry.getValue());
int id = getResources().getIdentifier(entry.getValue(), "id", "com.edotassi.amazmod");
TextView textView = findViewById(id);
textView.setText(ENABLED.toUpperCase());
textView.setTextColor(getResources().getColor(R.color.colorCharging));
} else {
textView.setText(DISABLED.toUpperCase());
textView.setTextColor(getResources().getColor(R.color.colorAccent));
}
}
permissionNotification.setText(ENABLED.toUpperCase());
permissionNotification.setTextColor(getResources().getColor(R.color.colorCharging));
permissionNotification.setText(DISABLED.toUpperCase());
permissionNotification.setTextColor(getResources().getColor(R.color.colorAccent));
}
materialProgressBar.setVisibility(View.GONE);
permissionsMainContainer.setVisibility(View.VISIBLE);
}
|
annotation
|
@SuppressLint<method*start>android.annotation.SuppressLint<method*end>("CheckResult")
private void checkPermissions() {
final String<method*start>java.lang.String<method*end> ENABLED = getResources<method*start>androidx.appcompat.app.AppCompatActivity.getResources<method*end>().getString<method*start>android.content.res.Resources.getString<method*end>(R.string<method*start>com.edotassi.amazmod.R.string<method*end>.enabled);
final String<method*start>java.lang.String<method*end> DISABLED = getResources<method*start>androidx.appcompat.app.AppCompatActivity.getResources<method*end>().getString<method*start>android.content.res.Resources.getString<method*end>(R.string<method*start>com.edotassi.amazmod.R.string<method*end>.disabled);
materialProgressBar.setVisibility<method*start>me.zhanghai.android.materialprogressbar.MaterialProgressBar.setVisibility<method*end>(View.VISIBLE<method*start>android.view.View.VISIBLE<method*end>);
permissionsMainContainer.setVisibility<method*start>android.view.View.setVisibility<method*end>(View.GONE<method*start>android.view.View.GONE<method*end>);
for (ArrayMap.Entry<method*start>java.util.Map.Entry<method*end><String<method*start>java.lang.String<method*end>, String<method*start>java.lang.String<method*end>> entry : REQUIRED_PERMISSIONS.entrySet<method*start>androidx.collection.ArrayMap.entrySet<method*end>()) {
Logger.debug<method*start>org.tinylog.Logger.debug<method*end>("CheckPermissionsActivity permission: " + entry.getKey<method*start>androidx.collection.ArrayMap.Entry<java.lang.String,java.lang.String>.getKey<method*end>() + " / " + entry.getValue<method*start>androidx.collection.ArrayMap.Entry<java.lang.String,java.lang.String>.getValue<method*end>());
int id = getResources<method*start>androidx.appcompat.app.AppCompatActivity.getResources<method*end>().getIdentifier<method*start>android.content.res.Resources.getIdentifier<method*end>(entry.getValue<method*start>androidx.collection.ArrayMap.Entry<java.lang.String,java.lang.String>.getValue<method*end>(), "id", "com.edotassi.amazmod");
TextView<method*start>android.widget.TextView<method*end> textView = findViewById<method*start>androidx.appcompat.app.AppCompatActivity.findViewById<method*end>(id);
if (Permissions.hasPermission<method*start>com.edotassi.amazmod.util.Permissions.hasPermission<method*end>(getApplicationContext<method*start>androidx.appcompat.app.AppCompatActivity.getApplicationContext<method*end>(), entry.getKey<method*start>androidx.collection.ArrayMap.Entry<java.lang.String,java.lang.String>.getKey<method*end>())) {
textView.setText<method*start>android.widget.TextView.setText<method*end>(ENABLED.toUpperCase<method*start>java.lang.String.toUpperCase<method*end>());
textView.setTextColor<method*start>android.widget.TextView.setTextColor<method*end>(getResources<method*start>androidx.appcompat.app.AppCompatActivity.getResources<method*end>().getColor<method*start>android.content.res.Resources.getColor<method*end>(R.color<method*start>com.edotassi.amazmod.R.color<method*end>.colorCharging));
} else {
textView.setText<method*start>android.widget.TextView.setText<method*end>(DISABLED.toUpperCase<method*start>java.lang.String.toUpperCase<method*end>());
textView.setTextColor<method*start>android.widget.TextView.setTextColor<method*end>(getResources<method*start>androidx.appcompat.app.AppCompatActivity.getResources<method*end>().getColor<method*start>android.content.res.Resources.getColor<method*end>(R.color<method*start>com.edotassi.amazmod.R.color<method*end>.colorAccent));
}
}
if (Permissions.hasNotificationAccess<method*start>com.edotassi.amazmod.util.Permissions.hasNotificationAccess<method*end>(getApplicationContext<method*start>androidx.appcompat.app.AppCompatActivity.getApplicationContext<method*end>())) {
permissionNotification.setText<method*start>android.widget.TextView.setText<method*end>(ENABLED.toUpperCase<method*start>java.lang.String.toUpperCase<method*end>());
permissionNotification.setTextColor<method*start>android.widget.TextView.setTextColor<method*end>(getResources<method*start>androidx.appcompat.app.AppCompatActivity.getResources<method*end>().getColor<method*start>android.content.res.Resources.getColor<method*end>(R.color<method*start>com.edotassi.amazmod.R.color<method*end>.colorCharging));
} else {
permissionNotification.setText<method*start>android.widget.TextView.setText<method*end>(DISABLED.toUpperCase<method*start>java.lang.String.toUpperCase<method*end>());
permissionNotification.setTextColor<method*start>android.widget.TextView.setTextColor<method*end>(getResources<method*start>androidx.appcompat.app.AppCompatActivity.getResources<method*end>().getColor<method*start>android.content.res.Resources.getColor<method*end>(R.color<method*start>com.edotassi.amazmod.R.color<method*end>.colorAccent));
}
materialProgressBar.setVisibility<method*start>me.zhanghai.android.materialprogressbar.MaterialProgressBar.setVisibility<method*end>(View.GONE<method*start>android.view.View.GONE<method*end>);
permissionsMainContainer.setVisibility<method*start>android.view.View.setVisibility<method*end>(View.VISIBLE<method*start>android.view.View.VISIBLE<method*end>);
}
|
@GET<method*start>javax.ws.rs.GET<method*end>
public Map<method*start>java.util.Map<method*end><String<method*start>java.lang.String<method*end>, ExternalType> getObjects(@QueryParam<method*start>javax.ws.rs.QueryParam<method*end>("permission") List<method*start>java.util.List<method*end><ObjectPermission.Type<method*start>org.apache.guacamole.net.auth.permission.ObjectPermission.Type<method*end>> permissions) throws GuacamoleException<method*start>org.apache.guacamole.GuacamoleException<method*end> {
Collection<method*start>java.util.Collection<method*end><String<method*start>java.lang.String<method*end>> identifiers = directory.getIdentifiers<method*start>org.apache.guacamole.net.auth.Directory.getIdentifiers<method*end>();
ObjectPermissionSet<method*start>org.apache.guacamole.net.auth.permission.ObjectPermissionSet<method*end> objectPermissions = getObjectPermissions(effective);
identifiers = objectPermissions.getAccessibleObjects<method*start>org.apache.guacamole.net.auth.permission.ObjectPermissionSet.getAccessibleObjects<method*end>(permissions, identifiers);
}
Map<method*start>java.util.Map<method*end><String<method*start>java.lang.String<method*end>, ExternalType> apiObjects = new HashMap<method*start>java.util.HashMap<method*end><String<method*start>java.lang.String<method*end>, ExternalType>();
for (InternalType object : directory.getAll<method*start>org.apache.guacamole.net.auth.Directory.getAll<method*end>(identifiers)) apiObjects.put<method*start>java.util.Map.put<method*end>(object.getIdentifier<method*start>org.apache.guacamole.net.auth.Identifiable.getIdentifier<method*end>(), translator.toExternalObject<method*start>org.apache.guacamole.rest.directory.DirectoryObjectTranslator.toExternalObject<method*end>(object));
return apiObjects;
}
|
annotation
|
@GET<method*start>javax.ws.rs.GET<method*end>
public Map<method*start>java.util.Map<method*end><String<method*start>java.lang.String<method*end>, ExternalType> getObjects(@QueryParam<method*start>javax.ws.rs.QueryParam<method*end>("permission") List<method*start>java.util.List<method*end><ObjectPermission.Type<method*start>org.apache.guacamole.net.auth.permission.ObjectPermission.Type<method*end>> permissions) throws GuacamoleException<method*start>org.apache.guacamole.GuacamoleException<method*end> {
// An admin user has access to all objects
Permissions<method*start>org.apache.guacamole.net.auth.Permissions<method*end> effective = userContext.self<method*start>org.apache.guacamole.net.auth.UserContext.self<method*end>().getEffectivePermissions<method*start>org.apache.guacamole.net.auth.User.getEffectivePermissions<method*end>();
SystemPermissionSet<method*start>org.apache.guacamole.auth.jdbc.permission.SystemPermissionSet<method*end> systemPermissions = effective.getSystemPermissions<method*start>org.apache.guacamole.net.auth.Permissions.getSystemPermissions<method*end>();
boolean isAdmin = systemPermissions.hasPermission<method*start>org.apache.guacamole.net.auth.permission.SystemPermissionSet.hasPermission<method*end>(SystemPermission.Type.ADMINISTER<method*start>org.apache.guacamole.net.auth.permission.SystemPermission.Type.ADMINISTER<method*end>);
// Filter objects, if requested
Collection<method*start>java.util.Collection<method*end><String<method*start>java.lang.String<method*end>> identifiers = directory.getIdentifiers<method*start>org.apache.guacamole.net.auth.Directory.getIdentifiers<method*end>();
if (!isAdmin && permissions != null && !permissions.isEmpty<method*start>java.util.List.isEmpty<method*end>()) {
ObjectPermissionSet<method*start>org.apache.guacamole.net.auth.permission.ObjectPermissionSet<method*end> objectPermissions = getObjectPermissions(effective);
identifiers = objectPermissions.getAccessibleObjects<method*start>org.apache.guacamole.net.auth.permission.ObjectPermissionSet.getAccessibleObjects<method*end>(permissions, identifiers);
}
// Translate each retrieved object into the corresponding external object
Map<method*start>java.util.Map<method*end><String<method*start>java.lang.String<method*end>, ExternalType> apiObjects = new HashMap<method*start>java.util.HashMap<method*end><String<method*start>java.lang.String<method*end>, ExternalType>();
for (InternalType object : directory.getAll<method*start>org.apache.guacamole.net.auth.Directory.getAll<method*end>(identifiers)) apiObjects.put<method*start>java.util.Map.put<method*end>(object.getIdentifier<method*start>org.apache.guacamole.net.auth.Identifiable.getIdentifier<method*end>(), translator.toExternalObject<method*start>org.apache.guacamole.rest.directory.DirectoryObjectTranslator.toExternalObject<method*end>(object));
return apiObjects;
}
|
@EventHandler(priority = EventPriority.HIGH)
public void onSignBreak(BlockBreakEvent event) {
if (event.isCancelled()) {
return;
}
Block block = event.getBlock();
// Check if it is a sign
if (Materials.isSign(block.getType())) {
// Check if the rent sign is really the same as a saved rent
RegionSign regionSign = SignsFeature.getSignByLocation(block.getLocation());
if (regionSign == null) {
return;
}
// Remove the sign of the rental region if the player has permission
regionSign.remove();
plugin.message(event.getPlayer(), "delsign-success", regionSign.getRegion());
} else {
// Cancel the breaking of the sign
event.setCancelled(true);
plugin.message(event.getPlayer(), "delsign-noPermission", regionSign.getRegion());
}
}
}
|
annotation
|
@EventHandler(priority = EventPriority<method*start>org.bukkit.event.EventPriority<method*end>.HIGH)
public void onSignBreak(BlockBreakEvent<method*start>org.bukkit.event.block.BlockBreakEvent<method*end> event) {
if (event.isCancelled()) {
return;
}
Block<method*start>org.bukkit.block.Block<method*end> block = event.getBlock();
// Check if it is a sign
if (Materials<method*start>me.wiefferink.areashop.tools.Materials<method*end>.isSign(block.getType())) {
// Check if the rent sign is really the same as a saved rent
RegionSign regionSign = SignsFeature.getSignByLocation(block.getLocation());
if (regionSign == null) {
return;
}
// Remove the sign of the rental region if the player has permission
if (event.getPlayer().hasPermission("areashop.delsign")) {
regionSign.remove();
plugin<method*start>me.wiefferink.areashop.features.RegionFeature.plugin<method*end>.message(event.getPlayer(), "delsign-success", regionSign.getRegion());
} else {
// Cancel the breaking of the sign
event.setCancelled(true);
plugin<method*start>me.wiefferink.areashop.features.RegionFeature.plugin<method*end>.message(event.getPlayer(), "delsign-noPermission", regionSign.getRegion());
}
}
}
|
@EventHandler(priority = EventPriority.MONITOR)
public void hideAbandonedServer(PlayerQuitEvent event) {
final Server local = minecraftService.getLocalServer();
for (Player player : event.getPlayer().getServer().getOnlinePlayers()) {
return;
}
logger.info("Reverting server visibility to " + local.startup_visibility() + " because nobody with permissions is online");
setVisibility(local.startup_visibility());
}
}
|
annotation
|
@EventHandler(priority = EventPriority<method*start>org.bukkit.event.EventPriority<method*end>.MONITOR)
public void hideAbandonedServer(PlayerQuitEvent<method*start>org.bukkit.event.player.PlayerQuitEvent<method*end> event) {
final Server<method*start>tc.oc.api.docs.Server<method*end> local = minecraftService.getLocalServer();
if (// If server was initially not public and
// server was made public a<method*start>tc.oc.api.docs.virtual.ServerDoc<method*end>nd
local.startup_visibility() != ServerDoc.Vi<method*start>tc.oc.api.docs.virtual.ServerDoc<method*end>sibility.PUBLIC && local.visibility() == ServerDoc.Visibility.PUBLIC && event.getPlayer().hasPermission(VISIBILITY_PERMISSION)) {
// ...check if there is still someone o<method*start>org.bukkit.entity.Player<method*end>nline with that permission
for (Player player : event.getPlayer().getServer().getOnlinePlayers()) {
// If someone else with perms is online, we're cool
if (player != event.getPlayer() && player.hasPermission(VISIBILITY_PERMISSION))
return;
}
// If nobody with perms is online, make the server non-public again
logger.info("Reverting server visibility to " + local.startup_visibility() + " because nobody with permissions is online");
setVisibility(local.startup_visibility());
}
}
|
@Override
public void execute(CommandSender sender, String[] args) {
if (args.length == 0) {
sender.sendMessage((BridgeConfigurationProvider.load().getPrefix().replace("&", "§")) + "/cloudnet <command>");
return;
}
StringBuilder stringBuilder = new StringBuilder();
for (String arg : args) {
stringBuilder.append(arg).append(" ");
}
if (sender instanceof Player) {
CommandInfo commandInfo = CloudNetDriver.getInstance().getNodeInfoProvider().getConsoleCommand(stringBuilder.toString());
sender.sendMessage(BridgeConfigurationProvider.load().getMessages().get("command-cloud-sub-command-no-permission").replace("%command%", stringBuilder).replace("&", "§"));
return;
}
}
}
String[] messages = CloudNetDriver.getInstance().sendCommandLine(stringBuilder.toString());
if (messages != null) {
for (String message : messages) {
if (message != null) {
sender.sendMessage(ChatColor.toANSI(BridgeConfigurationProvider.load().getPrefix() + message));
}
}
}
}
|
annotation
|
@Override
public void execute(CommandSender<method*start>io.gomint.proxprox.api.command.CommandSender<method*end> sender, String<method*start>java.lang.String<method*end>[] args) {
if (!sender.hasPermission("cloudnet.command.cloudnet")) {
return;
}
if (args.length == 0) {
sender.sendMessage((BridgeConfigurationProvider.load().getPrefix().replace("&", "§")) + "/cloudnet <command>");
return;
}
StringBuilder<method*start>java.lang.StringBuilder<method*end> stringBuilder = new StringBuilder<method*start>java.lang.StringBuilder<method*end>();
for (String<method*start>java.lang.String<method*end> arg : args) {
stringBuilder.append(arg).append(" ");
}
if (sender instanceof Player<method*start>io.gomint.proxprox.api.entity.Player<method*end>) {
CommandInfo commandInfo = CloudNetDriver<method*start>de.dytanic.cloudnet.driver.CloudNetDriver<method*end>.getInstance().getNodeInfoProvider().getConsoleCommand(stringBuilder.toString());
if (commandInfo != null && commandInfo.getPermission() != null) {
if (!sender.hasPermission(commandInfo.getPermission())) {
sender.sendMessage(BridgeConfigurationProvider.load().getMessages().get("command-cloud-sub-command-no-permission").replace("%command%", stringBuilder).replace("&", "§"));
return;
}
}
}
String<method*start>java.lang.String<method*end>[] messages = CloudNetDriver<method*start>de.dytanic.cloudnet.driver.CloudNetDriver<method*end>.getInstance().sendCommandLine(stringBuilder.toString());
if (messages != null) {
for (String<method*start>java.lang.String<method*end> message : messages) {
if (message != null) {
sender.sendMessage(ChatColor<method*start>io.gomint.proxprox.api.ChatColor<method*end>.toANSI(BridgeConfigurationProvider.load().getPrefix() + message));
}
}
}
}
|
@Override
public void execute(CommandSource source, String[] args) {
if (args.length == 0) {
source.sendMessage(TextComponent.of(BridgeConfigurationProvider.load().getPrefix().replace("&", "§") + "/cloudnet <command>"));
return;
}
String commandLine = String.join(" ", args);
if (source instanceof Player) {
CommandInfo commandInfo = CloudNetDriver.getInstance().getNodeInfoProvider().getConsoleCommand(commandLine);
source.sendMessage(TextComponent.of(BridgeConfigurationProvider.load().getMessages().get("command-cloud-sub-command-no-permission").replace("%command%", commandLine)));
return;
}
}
}
String[] messages = CloudNetDriver.getInstance().sendCommandLine(commandLine);
if (messages != null) {
for (String message : messages) {
if (message != null) {
source.sendMessage(TextComponent.of(BridgeConfigurationProvider.load().getPrefix().replace("&", "§") + message));
}
}
}
}
|
annotation
|
@Override
public void execute(@MaybePresent CommandSource source, @NonNull @MaybePresent String[] args) {
if (!source.hasPermission("cloudnet.command.cloudnet")) {
return;
}
if (args.length == 0) {
source.sendMessage(TextComponent<method*start>net.kyori.text.TextComponent<method*end>.of(BridgeConfigurationProvider.load().getPrefix().replace("&", "§") + "/cloudnet <command>"));
return;
}
String commandLine = String.join(" ", args);
if (source instanceof Player<method*start>com.velocitypowered.api.proxy.Player<method*end>) {
CommandInfo commandInfo = CloudNetDriver<method*start>de.dytanic.cloudnet.driver.CloudNetDriver<method*end>.getInstance().getNodeInfoProvider().getConsoleCommand(commandLine);
if (commandInfo != null && commandInfo.getPermission() != null) {
if (!source.hasPermission(commandInfo.getPermission())) {
source.sendMessage(TextComponent<method*start>net.kyori.text.TextComponent<method*end>.of(BridgeConfigurationProvider.load().getMessages().get("command-cloud-sub-command-no-permission").replace("%command%", commandLine)));
return;
}
}
}
String[] messages = CloudNetDriver<method*start>de.dytanic.cloudnet.driver.CloudNetDriver<method*end>.getInstance().sendCommandLine(commandLine);
if (messages != null) {
for (String message : messages) {
if (message != null) {
source.sendMessage(TextComponent<method*start>net.kyori.text.TextComponent<method*end>.of(BridgeConfigurationProvider.load().getPrefix().replace("&", "§") + message));
}
}
}
}
|
@Listener
public void onChangeSign(ChangeSignEvent<method*start>org.spongepowered.api.event.block.tileentity.ChangeSignEvent<method*end> event, @First Player player) {
ICType<method*start>com.sk89q.craftbook.sponge.mechanics.ics.ICType<method*end><? extends IC> icType = ICManager.getICType<method*start>com.sk89q.craftbook.sponge.mechanics.ics.ICManager.getICType<method*end>((event.getText<method*start>org.spongepowered.api.event.block.tileentity.ChangeSignEvent.getText<method*end>().lines().get(1)).toPlain());
if (icType == null)
return;
player.sendMessage<method*start>org.spongepowered.api.entity.living.player.Player.sendMessage<method*end>(Text.of<method*start>org.spongepowered.api.text.Text.of<method*end>(TextColors.RED<method*start>org.spongepowered.api.text.format.TextColors.RED<method*end>, "You don't have permission to create this IC!"));
} else {
List<method*start>java.util.List<method*end><Text<method*start>org.spongepowered.api.text.Text<method*end>> lines = event.getText<method*start>org.spongepowered.api.event.block.tileentity.ChangeSignEvent.getText<method*end>().lines().get();
lines.set<method*start>java.util.List.set<method*end>(0, Text.of<method*start>org.spongepowered.api.text.Text.of<method*end>(icType.getShorthand<method*start>com.sk89q.craftbook.sponge.mechanics.ics.ICType.getShorthand<method*end>().toUpperCase<method*start>java.lang.String.toUpperCase<method*end>()));
lines.set<method*start>java.util.List.set<method*end>(1, Text.of<method*start>org.spongepowered.api.text.Text.of<method*end>(SignUtil.getTextRaw<method*start>com.sk89q.craftbook.sponge.util.SignUtil.getTextRaw<method*end>(lines.get<method*start>java.util.List.get<method*end>(1)).toUpperCase<method*start>java.lang.String.toUpperCase<method*end>()));
try {
createICData<method*start>com.sk89q.craftbook.sponge.mechanics.ics.ICSocket.createICData<method*end>(event.getTargetTile<method*start>org.spongepowered.api.event.block.tileentity.ChangeSignEvent.getTargetTile<method*end>().getLocation(), lines, player);
player.sendMessage<method*start>org.spongepowered.api.entity.living.player.Player.sendMessage<method*end>(Text.of<method*start>org.spongepowered.api.text.Text.of<method*end>(TextColors.YELLOW<method*start>org.spongepowered.api.text.format.TextColors.YELLOW<method*end>, "Created " + icType.getName<method*start>com.sk89q.craftbook.sponge.mechanics.ics.ICType.getName<method*end>()));
event.getText<method*start>org.spongepowered.api.event.block.tileentity.ChangeSignEvent.getText<method*end>().set(Keys.SIGN_LINES<method*start>org.spongepowered.api.data.key.Keys.SIGN_LINES<method*end>, lines);
} catch (InvalidICException<method*start>com.sk89q.craftbook.sponge.mechanics.ics.InvalidICException<method*end> e) {
event.setCancelled<method*start>org.spongepowered.api.event.block.tileentity.ChangeSignEvent.setCancelled<method*end>(true);
player.sendMessage<method*start>org.spongepowered.api.entity.living.player.Player.sendMessage<method*end>(Text.of<method*start>org.spongepowered.api.text.Text.of<method*end>("Failed to create IC. " + e.getMessage<method*start>java.lang.Exception.getMessage<method*end>()));
}
}
}
|
annotation
|
@Listener
public void onChangeSign(ChangeSignEvent<method*start>org.spongepowered.api.event.block.tileentity.ChangeSignEvent<method*end> event, @First Player player) {
ICType<method*start>com.sk89q.craftbook.sponge.mechanics.ics.ICType<method*end><? extends IC> icType = ICManager.getICType<method*start>com.sk89q.craftbook.sponge.mechanics.ics.ICManager.getICType<method*end>((event.getText<method*start>org.spongepowered.api.event.block.tileentity.ChangeSignEvent.getText<method*end>().lines().get(1)).toPlain());
if (icType == null)
return;
if (!icType.getPermissionNode<method*start>com.sk89q.craftbook.sponge.mechanics.ics.ICType.getPermissionNode<method*end>().hasPermission<method*start>com.sk89q.craftbook.sponge.util.SpongePermissionNode.hasPermission<method*end>(player)) {
player.sendMessage<method*start>org.spongepowered.api.entity.living.player.Player.sendMessage<method*end>(Text.of<method*start>org.spongepowered.api.text.Text.of<method*end>(TextColors.RED<method*start>org.spongepowered.api.text.format.TextColors.RED<method*end>, "You don't have permission to create this IC!"));
} else {
List<method*start>java.util.List<method*end><Text<method*start>org.spongepowered.api.text.Text<method*end>> lines = event.getText<method*start>org.spongepowered.api.event.block.tileentity.ChangeSignEvent.getText<method*end>().lines().get();
lines.set<method*start>java.util.List.set<method*end>(0, Text.of<method*start>org.spongepowered.api.text.Text.of<method*end>(icType.getShorthand<method*start>com.sk89q.craftbook.sponge.mechanics.ics.ICType.getShorthand<method*end>().toUpperCase<method*start>java.lang.String.toUpperCase<method*end>()));
lines.set<method*start>java.util.List.set<method*end>(1, Text.of<method*start>org.spongepowered.api.text.Text.of<method*end>(SignUtil.getTextRaw<method*start>com.sk89q.craftbook.sponge.util.SignUtil.getTextRaw<method*end>(lines.get<method*start>java.util.List.get<method*end>(1)).toUpperCase<method*start>java.lang.String.toUpperCase<method*end>()));
try {
createICData<method*start>com.sk89q.craftbook.sponge.mechanics.ics.ICSocket.createICData<method*end>(event.getTargetTile<method*start>org.spongepowered.api.event.block.tileentity.ChangeSignEvent.getTargetTile<method*end>().getLocation(), lines, player);
player.sendMessage<method*start>org.spongepowered.api.entity.living.player.Player.sendMessage<method*end>(Text.of<method*start>org.spongepowered.api.text.Text.of<method*end>(TextColors.YELLOW<method*start>org.spongepowered.api.text.format.TextColors.YELLOW<method*end>, "Created " + icType.getName<method*start>com.sk89q.craftbook.sponge.mechanics.ics.ICType.getName<method*end>()));
event.getText<method*start>org.spongepowered.api.event.block.tileentity.ChangeSignEvent.getText<method*end>().set(Keys.SIGN_LINES<method*start>org.spongepowered.api.data.key.Keys.SIGN_LINES<method*end>, lines);
} catch (InvalidICException<method*start>com.sk89q.craftbook.sponge.mechanics.ics.InvalidICException<method*end> e) {
event.setCancelled<method*start>org.spongepowered.api.event.block.tileentity.ChangeSignEvent.setCancelled<method*end>(true);
player.sendMessage<method*start>org.spongepowered.api.entity.living.player.Player.sendMessage<method*end>(Text.of<method*start>org.spongepowered.api.text.Text.of<method*end>("Failed to create IC. " + e.getMessage<method*start>java.lang.Exception.getMessage<method*end>()));
}
}
}
|
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
CustomListRowPresenter presenter = new CustomListRowPresenter();
presenter.setHeaderPresenter(new RowHeaderPresenter());
mRowsAdapter = new ArrayObjectAdapter(presenter);
setSearchResultProvider(this);
setOnItemViewClickedListener(new ItemViewClickedListener());
// TODO: Set up speech recognizer for AndroidTV only.
// SpeechRecognitionCallback is not required and if not provided recognition will be
// handled using internal speech recognizer, in which case you must have RECORD_AUDIO
// permission.
setSpeechRecognitionCallback(() -> {
if (DEBUG)
Log.v(TAG, "recognizeSpeech");
try {
// Disabling speech recognizer so the fragment works on Fire TV.
// startActivityForResult(getRecognizerIntent(), REQUEST_SPEECH);
} catch (ActivityNotFoundException e) {
Log.e(TAG, "Cannot find activity for speech recognizer", e);
}
});
}
}
|
annotation
|
@Override
public void onCreate(Bundle<method*start>android.os.Bundle<method*end> savedInstanceState) {
super.onCreate<method*start>android.support.v17.leanback.app.SearchFragment.onCreate<method*end>(savedInstanceState);
CustomListRowPresenter presenter = new CustomListRowPresenter();
presenter.setHeaderPresenter<method*start>android.support.v17.leanback.widget.ListRowPresenter.setHeaderPresenter<method*end>(new RowHeaderPresenter<method*start>android.support.v17.leanback.widget.RowHeaderPresenter<method*end>());
mRowsAdapter = new ArrayObjectAdapter<method*start>android.support.v17.leanback.widget.ArrayObjectAdapter<method*end>(presenter);
setSearchResultProvider<method*start>android.support.v17.leanback.app.SearchFragment.setSearchResultProvider<method*end>(this);
setOnItemViewClickedListener<method*start>android.support.v17.leanback.app.SearchFragment.setOnItemViewClickedListener<method*end>(new ItemViewClickedListener<method*start>com.amazon.android.tv.tenfoot.ui.fragments.ContentSearchFragment.ItemViewClickedListener<method*end>());
// TODO: Set up speech recognizer for AndroidTV only.
if (!hasPermission<method*start>com.amazon.android.tv.tenfoot.ui.fragments.ContentSearchFragment.hasPermission<method*end>(Manifest.permission.RECORD_AUDIO<method*start>android.Manifest.permission.RECORD_AUDIO<method*end>)) {
// SpeechRecognitionCallback is not required and if not provided recognition will be
// handled using internal speech recognizer, in which case you must have RECORD_AUDIO
// permission.
setSpeechRecognitionCallback<method*start>android.support.v17.leanback.app.SearchFragment.setSpeechRecognitionCallback<method*end>(() -> {
if (DEBUG)
Log.v<method*start>android.util.Log.v<method*end>(TAG, "recognizeSpeech");
try {
// Disabling speech recognizer so the fragment works on Fire TV.
// startActivityForResult(getRecognizerIntent(), REQUEST_SPEECH);
} catch (ActivityNotFoundException<method*start>android.content.ActivityNotFoundException<method*end> e) {
Log.e<method*start>android.util.Log.e<method*end>(TAG, "Cannot find activity for speech recognizer", e);
}
});
}
}
|
@Override
public CommandResult execute(CommandSource src, CommandContext args) throws CommandException {
String id = args.getOne("id").get();
String namespace = args.getOne("namespace").orElse(((Player) src).getUniqueId().toString());
boolean personal = namespace.equals(((Player) src).getUniqueId().toString());
src.sendMessage(Text.of("You do not have permission to use this namespace!"));
return CommandResult.empty();
id = id.toLowerCase(Locale.ENGLISH);
File folder = new File(new File(CraftBookPlugin.inst().getWorkingDirectory(), "areas"), namespace);
File file = new File(folder, id + CopyManager.getFileSuffix());
if (!folder.exists() || !file.exists()) {
src.sendMessage(Text.of(TextColors.RED, "This area does not exist!"));
return CommandResult.empty();
}
file.delete();
src.sendMessage(Text.of(TextColors.YELLOW, "Area deleted!"));
return CommandResult.success();
}
|
annotation
|
@Override
public CommandResult<method*start>org.spongepowered.api.command.CommandResult<method*end> execute(CommandSource<method*start>org.spongepowered.api.command.CommandSource<method*end> src, CommandContext<method*start>org.spongepowered.api.command.args.CommandContext<method*end> args) throws CommandException<method*start>org.spongepowered.api.command.CommandException<method*end> {
String<method*start>java.lang.String<method*end> id = args.<String<method*start>java.lang.String<method*end>>getOne("id").get();
String<method*start>java.lang.String<method*end> namespace = args.<String<method*start>java.lang.String<method*end>>getOne("namespace").orElse(((Player<method*start>org.spongepowered.api.entity.living.player.Player<method*end>) src).getUniqueId().toString());
boolean personal = namespace.equals(((Player<method*start>org.spongepowered.api.entity.living.player.Player<method*end>) src).getUniqueId().toString());
if (!personal && !area.commandDeleteOtherPermissions.hasPermission(src)) {
src.sendMessage(Text<method*start>org.spongepowered.api.text.Text<method*end>.of("You do not have permission to use this namespace!"));
return CommandResult<method*start>org.spongepowered.api.command.CommandResult<method*end>.empty();
}
id = id.toLowerCase(Locale<method*start>java.util.Locale<method*end>.ENGLISH);
File<method*start>java.io.File<method*end> folder = new File<method*start>java.io.File<method*end>(new File<method*start>java.io.File<method*end>(CraftBookPlugin.inst().getWorkingDirectory(), "areas"), namespace);
File<method*start>java.io.File<method*end> file = new File<method*start>java.io.File<method*end>(folder, id + CopyManager.getFileSuffix());
if (!folder.exists() || !file.exists()) {
src.sendMessage(Text<method*start>org.spongepowered.api.text.Text<method*end>.of(TextColors<method*start>org.spongepowered.api.text.format.TextColors<method*end>.RED, "This area does not exist!"));
return CommandResult<method*start>org.spongepowered.api.command.CommandResult<method*end>.empty();
}
file.delete();
src.sendMessage(Text<method*start>org.spongepowered.api.text.Text<method*end>.of(TextColors<method*start>org.spongepowered.api.text.format.TextColors<method*end>.YELLOW, "Area deleted!"));
return CommandResult<method*start>org.spongepowered.api.command.CommandResult<method*end>.success();
}
|
@EventHandler(priority = EventPriority<method*start>org.bukkit.event.EventPriority<method*end>.NORMAL)
public void playerTeleport(PlayerTeleportEvent<method*start>org.bukkit.event.player.PlayerTeleportEvent<method*end> event) {
boolean allow = true;
for (Arena<method*start>com.garbagemule.MobArena.framework.Arena<method*end> arena : am.getArenas()) {
TeleportResponse<method*start>com.garbagemule.MobArena.listeners.MAGlobalListener.TeleportResponse<method*end> r = arena.getEventListener().onPlayerTeleport(event);
// If just one arena allows, uncancel and stop.
switch(r) {
case ALLOW:
event.setCancelled(false);
return;
case REJECT:
allow = false;
break;
default:
break;
}
}
event.setCancelled(true);
}
}
|
annotation
|
@EventHandler(priority = EventPriority<method*start>org.bukkit.event.EventPriority<method*end>.NORMAL)
public void playerTeleport(PlayerTeleportEvent<method*start>org.bukkit.event.player.PlayerTeleportEvent<method*end> event) {
if (!am<method*start>com.garbagemule.MobArena.listeners.MAGlobalListener.am<method*end>.isEnabled())
return;
boolean allow = true;
for (Arena<method*start>com.garbagemule.MobArena.framework.Arena<method*end> arena : am.getArenas()) {
TeleportResponse<method*start>com.garbagemule.MobArena.listeners.MAGlobalListener.TeleportResponse<method*end> r = arena.getEventListener().onPlayerTeleport(event);
// If just one arena allows, uncancel and stop.
switch(r) {
case ALLOW:
event.setCancelled(false);
return;
case REJECT:
allow = false;
break;
default:
break;
}
}
/*
* If we reach this point, no arena has specifically allowed the
* teleport, but one or more arenas may have rejected it, so we
* may have to cancel the event. If the player has the teleport
* override permission, however, we don't cancel.
*/
if (!allow && !event.getPlayer().hasPermission("mobarena.admin.teleport")) {
event.setCancelled(true);
}
}
|
@Override
public void messageOnServerThread(final ChangeFreeToInteractBlockMessage<method*start>com.minecolonies.coremod.network.messages.ChangeFreeToInteractBlockMessage<method*end> message, final EntityPlayerMP<method*start>net.minecraft.entity.player.EntityPlayerMP<method*end> player) {
final IColony<method*start>com.minecolonies.api.colony.IColony<method*end> colony = IColonyManager<method*start>com.minecolonies.api.colony.IColonyManager<method*end>.getInstance().getColonyByDimension(message.colonyId, message.dimension);
if (colony<method*start>com.minecolonies.coremod.colony.buildings.AbstractCitizenAssignable.colony<method*end> != null) {
LanguageHandler<method*start>com.minecolonies.api.util.LanguageHandler<method*end>.sendPlayerMessage(player, "com.minecolonies.coremod.item.permissionscepter.permission.deny");
return;
}
if (message.type == MessageType<method*start>com.minecolonies.coremod.network.messages.ChangeFreeToInteractBlockMessage.MessageType<method*end>.ADD_BLOCK) {
switch(message.mode) {
case LOCATION:
colony<method*start>com.minecolonies.coremod.colony.buildings.AbstractCitizenAssignable.colony<method*end>.addFreePosition(message.pos);
LanguageHandler<method*start>com.minecolonies.api.util.LanguageHandler<method*end>.sendPlayerMessage(player, "com.minecolonies.coremod.item.permissionscepter.addposition.success", message.pos.getX(), message.pos.getY(), message.pos.getZ());
break;
case BLOCK:
colony<method*start>com.minecolonies.coremod.colony.buildings.AbstractCitizenAssignable.colony<method*end>.addFreeBlock(message.block);
LanguageHandler<method*start>com.minecolonies.api.util.LanguageHandler<method*end>.sendPlayerMessage(player, "com.minecolonies.coremod.item.permissionscepter.addblock.success", message.block.getRegistryName());
break;
default:
}
} else {
switch(message.mode) {
case LOCATION:
colony<method*start>com.minecolonies.coremod.colony.buildings.AbstractCitizenAssignable.colony<method*end>.removeFreePosition(message.pos);
LanguageHandler<method*start>com.minecolonies.api.util.LanguageHandler<method*end>.sendPlayerMessage(player, "com.minecolonies.coremod.item.permissionscepter.removelocation.success", message.pos.getX(), message.pos.getY(), message.pos.getZ());
break;
case BLOCK:
colony<method*start>com.minecolonies.coremod.colony.buildings.AbstractCitizenAssignable.colony<method*end>.removeFreeBlock(message.block);
LanguageHandler<method*start>com.minecolonies.api.util.LanguageHandler<method*end>.sendPlayerMessage(player, "com.minecolonies.coremod.item.permissionscepter.removeblock.success", message.block.getRegistryName());
break;
default:
}
}
}
}
|
annotation
|
@Override
public void messageOnServerThread(final ChangeFreeToInteractBlockMessage<method*start>com.minecolonies.coremod.network.messages.ChangeFreeToInteractBlockMessage<method*end> message, final EntityPlayerMP<method*start>net.minecraft.entity.player.EntityPlayerMP<method*end> player) {
final IColony<method*start>com.minecolonies.api.colony.IColony<method*end> colony = IColonyManager<method*start>com.minecolonies.api.colony.IColonyManager<method*end>.getInstance().getColonyByDimension(message.colonyId, message.dimension);
if (colony<method*start>com.minecolonies.coremod.colony.buildings.AbstractCitizenAssignable.colony<method*end> != null) {
// Verify player has permission to change this huts settings
if (!colony<method*start>com.minecolonies.coremod.colony.buildings.AbstractCitizenAssignable.colony<method*end>.getPermissions().hasPermission(player, Action<method*start>com.minecolonies.api.colony.permissions.Action<method*end>.EDIT_PERMISSIONS)) {
LanguageHandler<method*start>com.minecolonies.api.util.LanguageHandler<method*end>.sendPlayerMessage(player, "com.minecolonies.coremod.item.permissionscepter.permission.deny");
return;
}
if (message.type == MessageType<method*start>com.minecolonies.coremod.network.messages.ChangeFreeToInteractBlockMessage.MessageType<method*end>.ADD_BLOCK) {
switch(message.mode) {
case LOCATION:
colony<method*start>com.minecolonies.coremod.colony.buildings.AbstractCitizenAssignable.colony<method*end>.addFreePosition(message.pos);
LanguageHandler<method*start>com.minecolonies.api.util.LanguageHandler<method*end>.sendPlayerMessage(player, "com.minecolonies.coremod.item.permissionscepter.addposition.success", message.pos.getX(), message.pos.getY(), message.pos.getZ());
break;
case BLOCK:
colony<method*start>com.minecolonies.coremod.colony.buildings.AbstractCitizenAssignable.colony<method*end>.addFreeBlock(message.block);
LanguageHandler<method*start>com.minecolonies.api.util.LanguageHandler<method*end>.sendPlayerMessage(player, "com.minecolonies.coremod.item.permissionscepter.addblock.success", message.block.getRegistryName());
break;
default:
}
} else {
switch(message.mode) {
case LOCATION:
colony<method*start>com.minecolonies.coremod.colony.buildings.AbstractCitizenAssignable.colony<method*end>.removeFreePosition(message.pos);
LanguageHandler<method*start>com.minecolonies.api.util.LanguageHandler<method*end>.sendPlayerMessage(player, "com.minecolonies.coremod.item.permissionscepter.removelocation.success", message.pos.getX(), message.pos.getY(), message.pos.getZ());
break;
case BLOCK:
colony<method*start>com.minecolonies.coremod.colony.buildings.AbstractCitizenAssignable.colony<method*end>.removeFreeBlock(message.block);
LanguageHandler<method*start>com.minecolonies.api.util.LanguageHandler<method*end>.sendPlayerMessage(player, "com.minecolonies.coremod.item.permissionscepter.removeblock.success", message.block.getRegistryName());
break;
default:
}
}
}
}
|
@Override
public void execute(final ViolationData<method*start>fr.neatmonster.nocheatplus.checks.ViolationData<method*end> violationData) {
final LogManager logManager = NCPAPIProvider.getNoCheatPlusAPI<method*start>fr.neatmonster.nocheatplus.NCPAPIProvider.getNoCheatPlusAPI<method*end>().getLogManager<method*start>fr.neatmonster.nocheatplus.components.NoCheatPlusAPI.getLogManager<method*end>();
final String<method*start>java.lang.String<method*end> message = getMessage<method*start>fr.neatmonster.nocheatplus.actions.types.ActionWithParameters.getMessage<method*end>(violationData);
final String<method*start>java.lang.String<method*end> messageNoColor = stripColor ? ColorUtil.removeColors<method*start>fr.neatmonster.nocheatplus.utilities.ColorUtil.removeColors<method*end>(message) : null;
final String<method*start>java.lang.String<method*end> messageWithColor = replaceColor ? ColorUtil.replaceColors<method*start>fr.neatmonster.nocheatplus.utilities.ColorUtil.replaceColors<method*end>(message) : null;
final ConfigFile<method*start>fr.neatmonster.nocheatplus.config.ConfigFile<method*end> configFile = checkActive ? ConfigManager.getConfigFile<method*start>fr.neatmonster.nocheatplus.config.ConfigManager.getConfigFile<method*end>() : null;
for (int i = 0; i < configs.length<method*start>fr.neatmonster.nocheatplus.actions.types.GenericLogAction.GenericLogActionConfig[].length<method*end>; i++) {
final GenericLogActionConfig config = configs[i];
if (checkActive && config.configPathActive<method*start>fr.neatmonster.nocheatplus.actions.types.GenericLogAction.GenericLogActionConfig.configPathActive<method*end> != null && !configFile.getBoolean<method*start>fr.neatmonster.nocheatplus.config.ConfigFile.getBoolean<method*end>(config.configPathActive<method*start>fr.neatmonster.nocheatplus.actions.types.GenericLogAction.GenericLogActionConfig.configPathActive<method*end>)) {
continue;
}
logManager.log<method*start>fr.neatmonster.nocheatplus.logging.LogManager.log<method*end>(config.streamID<method*start>fr.neatmonster.nocheatplus.actions.types.GenericLogAction.GenericLogActionConfig.streamID<method*end>, config.level<method*start>fr.neatmonster.nocheatplus.actions.types.GenericLogAction.GenericLogActionConfig.level<method*end>, config.chatColor<method*start>fr.neatmonster.nocheatplus.actions.types.GenericLogAction.GenericLogActionConfig.chatColor<method*end> ? messageWithColor : messageNoColor);
}
}
|
annotation
|
@Override<method*start>java.lang.Override<method*end>
public void execute(final ViolationData<method*start>fr.neatmonster.nocheatplus.checks.ViolationData<method*end> violationData) {
// TODO: Consider permission caching or removing the feature? [Besides, check earlier?]
final RegisteredPermission<method*start>fr.neatmonster.nocheatplus.permissions.RegisteredPermission<method*end> permissionSilent = violationData.getPermissionSilent<method*start>fr.neatmonster.nocheatplus.checks.ViolationData.getPermissionSilent<method*end>();
// TODO: Store PlayerData in ViolationData ? Must query cache here.
if (permissionSilent != null && DataManager.getPlayerData<method*start>fr.neatmonster.nocheatplus.players.DataManager.getPlayerData<method*end>(violationData.player<method*start>fr.neatmonster.nocheatplus.checks.ViolationData.player<method*end>).hasPermission(permissionSilent, violationData.player<method*start>fr.neatmonster.nocheatplus.checks.ViolationData.player<method*end>)) {
return;
}
final LogManager logManager = NCPAPIProvider.getNoCheatPlusAPI<method*start>fr.neatmonster.nocheatplus.NCPAPIProvider.getNoCheatPlusAPI<method*end>().getLogManager<method*start>fr.neatmonster.nocheatplus.components.NoCheatPlusAPI.getLogManager<method*end>();
final String<method*start>java.lang.String<method*end> message = getMessage<method*start>fr.neatmonster.nocheatplus.actions.types.ActionWithParameters.getMessage<method*end>(violationData);
final String<method*start>java.lang.String<method*end> messageNoColor = stripColor ? ColorUtil.removeColors<method*start>fr.neatmonster.nocheatplus.utilities.ColorUtil.removeColors<method*end>(message) : null;
final String<method*start>java.lang.String<method*end> messageWithColor = replaceColor ? ColorUtil.replaceColors<method*start>fr.neatmonster.nocheatplus.utilities.ColorUtil.replaceColors<method*end>(message) : null;
final ConfigFile<method*start>fr.neatmonster.nocheatplus.config.ConfigFile<method*end> configFile = checkActive ? ConfigManager.getConfigFile<method*start>fr.neatmonster.nocheatplus.config.ConfigManager.getConfigFile<method*end>() : null;
for (int i = 0; i < configs.length<method*start>fr.neatmonster.nocheatplus.actions.types.GenericLogAction.GenericLogActionConfig[].length<method*end>; i++) {
final GenericLogActionConfig config = configs[i];
if (checkActive && config.configPathActive<method*start>fr.neatmonster.nocheatplus.actions.types.GenericLogAction.GenericLogActionConfig.configPathActive<method*end> != null && !configFile.getBoolean<method*start>fr.neatmonster.nocheatplus.config.ConfigFile.getBoolean<method*end>(config.configPathActive<method*start>fr.neatmonster.nocheatplus.actions.types.GenericLogAction.GenericLogActionConfig.configPathActive<method*end>)) {
continue;
}
logManager.log<method*start>fr.neatmonster.nocheatplus.logging.LogManager.log<method*end>(config.streamID<method*start>fr.neatmonster.nocheatplus.actions.types.GenericLogAction.GenericLogActionConfig.streamID<method*end>, config.level<method*start>fr.neatmonster.nocheatplus.actions.types.GenericLogAction.GenericLogActionConfig.level<method*end>, config.chatColor<method*start>fr.neatmonster.nocheatplus.actions.types.GenericLogAction.GenericLogActionConfig.chatColor<method*end> ? messageWithColor : messageNoColor);
}
}
|
@AfterPermissionGranted(NeededPermissions)
private void requestNeededPermissions() {
String PREF_FIRST_START = "FirstStart";
SharedPreferences FirstStart = getApplicationContext().getSharedPreferences(PREF_FIRST_START, Context.MODE_PRIVATE);
long FirstStartTime = FirstStart.getLong(PREF_FIRST_START, 0);
// Already have permission, start ConversationsActivity
Log.d(Config.LOGTAG, "All permissions granted, starting " + getString(R.string.app_name) + "(" + FirstStartTime + ")");
Intent intent = new Intent(this, ConversationsActivity.class);
intent.putExtra(PREF_FIRST_START, FirstStartTime);
startActivity(intent);
overridePendingTransition(R.animator.fade_in, R.animator.fade_out);
finish();
// set first start to 0 if there are permissions to request
Log.d(Config.LOGTAG, "Requesting required permissions");
SharedPreferences.Editor editor = FirstStart.edit();
editor.putLong(PREF_FIRST_START, 0);
editor.commit();
// Do not have permissions, request them now
EasyPermissions.requestPermissions(this, getString(R.string.request_permissions_message), NeededPermissions, perms);
}
}
|
annotation
|
@AfterPermissionGranted(NeededPermissions)
private void requestNeededPermissions() {
String<method*start>java.lang.String<method*end> PREF_FIRST_START = "FirstStart";
SharedPreferences<method*start>android.content.SharedPreferences<method*end> FirstStart = getApplicationContext<method*start>androidx.appcompat.app.AppCompatActivity.getApplicationContext<method*end>().getSharedPreferences<method*start>android.content.Context.getSharedPreferences<method*end>(PREF_FIRST_START, Context.MODE_PRIVATE<method*start>android.content.Context.MODE_PRIVATE<method*end>);
long FirstStartTime = FirstStart.getLong<method*start>android.content.SharedPreferences.getLong<method*end>(PREF_FIRST_START, 0);
if (EasyPermissions.hasPermissions<method*start>pub.devrel.easypermissions.EasyPermissions.hasPermissions<method*end>(this, perms)) {
// Already have permission, start ConversationsActivity
Log.d<method*start>android.util.Log.d<method*end>(Config.LOGTAG<method*start>de.pixart.messenger.Config.LOGTAG<method*end>, "All permissions granted, starting " + getString<method*start>androidx.appcompat.app.AppCompatActivity.getString<method*end>(R.string<method*start>de.pixart.messenger.R.string<method*end>.app_name) + "(" + FirstStartTime + ")");
Intent<method*start>android.content.Intent<method*end> intent = new Intent<method*start>android.content.Intent<method*end>(this, ConversationsActivity.class);
intent.putExtra<method*start>android.content.Intent.putExtra<method*end>(PREF_FIRST_START, FirstStartTime);
startActivity<method*start>androidx.appcompat.app.AppCompatActivity.startActivity<method*end>(intent);
overridePendingTransition<method*start>androidx.appcompat.app.AppCompatActivity.overridePendingTransition<method*end>(R.animator<method*start>de.pixart.messenger.R.animator<method*end>.fade_in, R.animator<method*start>de.pixart.messenger.R.animator<method*end>.fade_out);
finish<method*start>androidx.appcompat.app.AppCompatActivity.finish<method*end>();
} else {
// set first start to 0 if there are permissions to request
Log.d<method*start>android.util.Log.d<method*end>(Config.LOGTAG<method*start>de.pixart.messenger.Config.LOGTAG<method*end>, "Requesting required permissions");
SharedPreferences.Editor<method*start>android.content.SharedPreferences.Editor<method*end> editor = FirstStart.edit<method*start>android.content.SharedPreferences.edit<method*end>();
editor.putLong<method*start>android.content.SharedPreferences.Editor.putLong<method*end>(PREF_FIRST_START, 0);
editor.commit<method*start>android.content.SharedPreferences.Editor.commit<method*end>();
// Do not have permissions, request them now
EasyPermissions.requestPermissions<method*start>pub.devrel.easypermissions.EasyPermissions.requestPermissions<method*end>(this, getString<method*start>androidx.appcompat.app.AppCompatActivity.getString<method*end>(R.string<method*start>de.pixart.messenger.R.string<method*end>.request_permissions_message), NeededPermissions, perms);
}
}
|
public Object decide(Authentication authentication, Object object, Collection<ConfigAttribute> config, Object returnedObject) throws AccessDeniedException {
if (returnedObject == null) {
// AclManager interface contract prohibits nulls
// As they have permission to null/nothing, grant access
logger.debug("Return object is null, skipping");
return null;
}
if (!getProcessDomainObjectClass().isAssignableFrom(returnedObject.getClass())) {
logger.debug("Return object is not applicable for this provider, skipping");
return returnedObject;
}
for (ConfigAttribute attr : config) {
if (!this.supports(attr)) {
continue;
}
logger.debug("Denying access");
throw new AccessDeniedException(messages.getMessage("AclEntryAfterInvocationProvider.noPermission", new Object[] { authentication.getName(), returnedObject }, "Authentication {0} has NO permissions to the domain object {1}"));
}
return returnedObject;
}
|
conventional
|
public Object<method*start>java.lang.Object<method*end> decide(Authentication<method*start>org.springframework.security.core.Authentication<method*end> authentication, Object<method*start>java.lang.Object<method*end> object, Collection<method*start>java.util.Collection<method*end><ConfigAttribute<method*start>org.springframework.security.access.ConfigAttribute<method*end>> config, Object<method*start>java.lang.Object<method*end> returnedObject) throws AccessDeniedException<method*start>org.springframework.security.access.AccessDeniedException<method*end> {
if (returnedObject == null) {
// AclManager interface contract prohibits nulls
// As they have permission to null/nothing, grant access
logger.debug<method*start>org.apache.commons.logging.Log.debug<method*end>("Return object is null, skipping");
return null;
}
if (!getProcessDomainObjectClass<method*start>org.springframework.security.acls.afterinvocation.AbstractAclProvider.getProcessDomainObjectClass<method*end>().isAssignableFrom<method*start>java.lang.Class.isAssignableFrom<method*end>(returnedObject.getClass<method*start>java.lang.Object.getClass<method*end>())) {
logger.debug<method*start>org.apache.commons.logging.Log.debug<method*end>("Return object is not applicable for this provider, skipping");
return returnedObject;
}
for (ConfigAttribute<method*start>org.springframework.security.access.ConfigAttribute<method*end> attr : config) {
if (!this.supports<method*start>org.springframework.security.acls.afterinvocation.AbstractAclProvider.supports<method*end>(attr)) {
continue;
}
if (hasPermission<method*start>org.springframework.security.acls.afterinvocation.AbstractAclProvider.hasPermission<method*end>(authentication, returnedObject)) {
return returnedObject;
}
logger.debug<method*start>org.apache.commons.logging.Log.debug<method*end>("Denying access");
throw new AccessDeniedException<method*start>org.springframework.security.access.AccessDeniedException<method*end>(messages.getMessage<method*start>org.springframework.context.support.MessageSourceAccessor.getMessage<method*end>("AclEntryAfterInvocationProvider.noPermission", new Object<method*start>java.lang.Object<method*end>[] { authentication.getName<method*start>org.springframework.security.core.Authentication.getName<method*end>(), returnedObject }, "Authentication {0} has NO permissions to the domain object {1}"));
}
return returnedObject;
}
|
public boolean onItemDelete(CommandSender sender, String itemKey) {
MageController controller = api.getController();
ItemData existing = controller.getItem(itemKey);
if (existing == null) {
sender.sendMessage(ChatColor.RED + "Unknown item: " + itemKey);
return true;
}
boolean hasPermission = true;
if (sender instanceof Player) {
Player player = (Player) sender;
}
sender.sendMessage(ChatColor.RED + "You don't have permission to delete " + itemKey);
return true;
}
File itemFolder = new File(controller.getConfigFolder(), "items");
File itemFile = new File(itemFolder, itemKey + ".yml");
if (!itemFile.exists()) {
sender.sendMessage(ChatColor.RED + "File doesn't exist: " + itemFile.getName());
return true;
}
itemFile.delete();
controller.unloadItemTemplate(itemKey);
sender.sendMessage("Deleted item " + itemKey);
return true;
}
|
conventional
|
public boolean onItemDelete(CommandSender<method*start>org.bukkit.command.CommandSender<method*end> sender, String<method*start>java.lang.String<method*end> itemKey) {
MageController<method*start>com.elmakers.mine.bukkit.api.magic.MageController<method*end> controller = api.getController();
ItemData existing = controller.getItem(itemKey);
if (existing == null) {
sender.sendMessage(ChatColor<method*start>org.bukkit.ChatColor<method*end>.RED + "Unknown item: " + itemKey);
return true;
}
boolean hasPermission = true;
if (sender instanceof Player<method*start>org.bukkit.entity.Player<method*end>) {
Player<method*start>org.bukkit.entity.Player<method*end> player = (Player<method*start>org.bukkit.entity.Player<method*end>) sender;
if (!player.hasPermission("Magic.item.overwrite")) {
if (player.hasPermission("Magic.item.overwrite_own")) {
String<method*start>java.lang.String<method*end> creatorId = existing.getCreatorId();
hasPermission = creatorId != null && creatorId.equalsIgnoreCase(player.getUniqueId().toString());
} else {
hasPermission = false;
}
}
}
if (!hasPermission) {
sender.sendMessage(ChatColor<method*start>org.bukkit.ChatColor<method*end>.RED + "You don't have permission to delete " + itemKey);
return true;
}
File<method*start>java.io.File<method*end> itemFolder = new File<method*start>java.io.File<method*end>(controller.getConfigFolder(), "items");
File<method*start>java.io.File<method*end> itemFile = new File<method*start>java.io.File<method*end>(itemFolder, itemKey + ".yml");
if (!itemFile.exists()) {
sender.sendMessage(ChatColor<method*start>org.bukkit.ChatColor<method*end>.RED + "File doesn't exist: " + itemFile.getName());
return true;
}
itemFile.delete();
controller.unloadItemTemplate(itemKey);
sender.sendMessage("Deleted item " + itemKey);
return true;
}
|
private static void invokeServiceListenerCallback(Bundle bundle, final EventListener l, Filter filter, Object acc, final EventObject event, final Dictionary oldProps) {
if ((bundle.getState() != Bundle.STARTING) && (bundle.getState() != Bundle.STOPPING) && (bundle.getState() != Bundle.ACTIVE)) {
return;
}
ServiceReference ref = ((ServiceEvent) event).getServiceReference();
boolean hasPermission = true;
boolean matched = (filter == null) || filter.match(((ServiceEvent) event).getServiceReference());
if (matched) {
((ServiceListener) l).serviceChanged((ServiceEvent) event);
} else if (((ServiceEvent) event).getType() == ServiceEvent.MODIFIED) {
if (filter.match(oldProps)) {
final ServiceEvent se = new ServiceEvent(ServiceEvent.MODIFIED_ENDMATCH, ((ServiceEvent) event).getServiceReference());
((ServiceListener) l).serviceChanged(se);
}
}
}
}
|
conventional
|
private static void invokeServiceListenerCallback(Bundle<method*start>org.osgi.framework.Bundle<method*end> bundle, final EventListener<method*start>java.util.EventListener<method*end> l, Filter<method*start>org.osgi.framework.Filter<method*end> filter, Object<method*start>java.lang.Object<method*end> acc, final EventObject<method*start>java.util.EventObject<method*end> event, final Dictionary<method*start>java.util.Dictionary<method*end><String<method*start>java.lang.String<method*end>, ?> oldProps) {
// STOPPING, and ACTIVE bundles.
if ((bundle.getState<method*start>org.osgi.framework.Bundle.getState<method*end>() != Bundle.STARTING<method*start>org.osgi.framework.Bundle.STARTING<method*end>) && (bundle.getState<method*start>org.osgi.framework.Bundle.getState<method*end>() != Bundle.STOPPING<method*start>org.osgi.framework.Bundle.STOPPING<method*end>) && (bundle.getState<method*start>org.osgi.framework.Bundle.getState<method*end>() != Bundle.ACTIVE<method*start>org.osgi.framework.Bundle.ACTIVE<method*end>)) {
return;
}
// Check that the bundle has permission to get at least
// one of the service interfaces; the objectClass property
// of the service stores its service interfaces.
ServiceReference<method*start>org.osgi.framework.ServiceReference<method*end> ref = ((ServiceEvent<method*start>org.osgi.framework.ServiceEvent<method*end>) event).getServiceReference<method*start>org.osgi.framework.ServiceEvent.getServiceReference<method*end>();
boolean hasPermission = true;
if (hasPermission) {
// Dispatch according to the filter.
boolean matched = (filter == null) || filter.match<method*start>org.osgi.framework.Filter.match<method*end>(((ServiceEvent<method*start>org.osgi.framework.ServiceEvent<method*end>) event).getServiceReference<method*start>org.osgi.framework.ServiceEvent.getServiceReference<method*end>());
if (matched) {
((ServiceListener<method*start>org.osgi.framework.ServiceListener<method*end>) l).serviceChanged<method*start>org.osgi.framework.ServiceListener.serviceChanged<method*end>((ServiceEvent<method*start>org.osgi.framework.ServiceEvent<method*end>) event);
} else // matched previously.
if (((ServiceEvent<method*start>org.osgi.framework.ServiceEvent<method*end>) event).getType<method*start>org.osgi.framework.ServiceEvent.getType<method*end>() == ServiceEvent.MODIFIED<method*start>org.osgi.framework.ServiceEvent.MODIFIED<method*end>) {
if (filter.match<method*start>org.osgi.framework.Filter.match<method*end>(oldProps)) {
final ServiceEvent<method*start>org.osgi.framework.ServiceEvent<method*end> se = new ServiceEvent<method*start>org.osgi.framework.ServiceEvent<method*end>(ServiceEvent.MODIFIED_ENDMATCH<method*start>org.osgi.framework.ServiceEvent.MODIFIED_ENDMATCH<method*end>, ((ServiceEvent<method*start>org.osgi.framework.ServiceEvent<method*end>) event).getServiceReference<method*start>org.osgi.framework.ServiceEvent.getServiceReference<method*end>());
((ServiceListener<method*start>org.osgi.framework.ServiceListener<method*end>) l).serviceChanged<method*start>org.osgi.framework.ServiceListener.serviceChanged<method*end>(se);
}
}
}
}
|
@Override
public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
if (args.length == 0) {
sender.sendMessage(Colors.PRIMARY_SHADOW + "Server is running " + Colors.PRIMARY + "Holographic Displays " + Colors.PRIMARY_SHADOW + "v" + HolographicDisplays.getInstance().getDescription().getVersion() + " by " + Colors.PRIMARY + "filoghost");
sender.sendMessage(Colors.PRIMARY_SHADOW + "Commands: " + Colors.PRIMARY + "/" + label + " help");
return true;
}
for (HologramSubCommand subCommand : subCommands) {
if (subCommand.isValidTrigger(args[0])) {
sender.sendMessage(Colors.ERROR + "You don't have permission.");
return true;
if (args.length - 1 >= subCommand.getMinimumArguments()) {
try {
subCommand.execute(sender, label, Arrays.copyOfRange(args, 1, args.length));
} catch (CommandException e) {
sender.sendMessage(Colors.ERROR + e.getMessage());
}
} else {
sender.sendMessage(Colors.ERROR + "Usage: /" + label + " " + subCommand.getName() + " " + subCommand.getPossibleArguments());
}
return true;
}
}
sender.sendMessage(Colors.ERROR + "Unknown sub-command. Type \"/" + label + " help\" for a list of commands.");
return true;
}
|
annotation
|
@Override
public boolean onCommand(CommandSender<method*start>org.bukkit.command.CommandSender<method*end> sender, Command<method*start>org.bukkit.command.Command<method*end> cmd, String<method*start>java.lang.String<method*end> label, String<method*start>java.lang.String<method*end>[] args) {
if (args.length == 0) {
sender.sendMessage(Colors.PRIMARY_SHADOW + "Server is running " + Colors.PRIMARY + "Holographic Displays " + Colors.PRIMARY_SHADOW + "v" + HolographicDisplays.getInstance().getDescription().getVersion() + " by " + Colors.PRIMARY + "filoghost");
if (sender.hasPermission(Strings.BASE_PERM + "help")) {
sender.sendMessage(Colors.PRIMARY_SHADOW + "Commands: " + Colors.PRIMARY + "/" + label + " help");
}
return true;
}
for (HologramSubCommand subCommand : subCommands) {
if (subCommand.isValidTrigger(args[0])) {
if (!subCommand.hasPermission(sender)) {
sender.sendMessage(Colors.ERROR + "You don't have permission.");
return true;
}
if (args.length - 1 >= subCommand.getMinimumArguments()) {
try {
subCommand.execute(sender, label, Arrays<method*start>java.util.Arrays<method*end>.copyOfRange(args, 1, args.length));
} catch (CommandException<method*start>com.gmail.filoghost.holographicdisplays.exception.CommandException<method*end> e) {
sender.sendMessage(Colors.ERROR + e.getMessage());
}
} else {
sender.sendMessage(Colors.ERROR + "Usage: /" + label + " " + subCommand.getName() + " " + subCommand.getPossibleArguments());
}
return true;
}
}
sender.sendMessage(Colors.ERROR + "Unknown sub-command. Type \"/" + label + " help\" for a list of commands.");
return true;
}
|
@EventHandler(priority = EventPriority<method*start>org.bukkit.event.EventPriority<method*end>.MONITOR, ignoreCancelled = true)
public void partyJoin(PlayerJoinPartyEvent<method*start>tc.oc.pgm.events.PlayerJoinPartyEvent<method*end> event) {
if (event.getNewParty() instanceof MultiPlayerParty<method*start>tc.oc.pgm.match.MultiPlayerParty<method*end>) {
PlayerManager<method*start>com.github.rmsy.channels.PlayerManager<method*end> playerManager = channelsPlugin<method*start>tc.oc.pgm.channels.ChannelMatchModule.channelsPlugin<method*end>.getPlayerManager();
Player<method*start>org.bukkit.entity.Player<method*end> bukkitPlayer = event.getPlayer().getBukkit();
PartyChannel channel = partyChannels.get(event.getNewParty());
if (channel != null) {
// If the player is joining observers and they have the receive-all perm, let them listen to all channels
bukkitPlayer.addAttachment(getMatch<method*start>tc.oc.pgm.match.MatchModule.getMatch<method*end>().getPlugin<method*start>tc.oc.pgm.match.Match.getPlugin<method*end>()).setPermission(matchListeningPermission<method*start>tc.oc.pgm.channels.ChannelMatchModule.matchListeningPermission<method*end>, true);
// Give the player listening permission for the team's channel
bukkitPlayer.addAttachment(getMatch<method*start>tc.oc.pgm.match.MatchModule.getMatch<method*end>().getPlugin<method*start>tc.oc.pgm.match.Match.getPlugin<method*end>()).setPermission(channel.getListeningPermission(), true);
}
// If their sending channel was previously set to a team channel, switch it to the new team's channel
if (playerManager.getMembershipChannel(bukkitPlayer) instanceof PartyChannel) {
playerManager.setMembershipChannel(bukkitPlayer, channel);
}
}
}
updatePlayerChannel(event.getPlayer());
}
|
annotation
|
@EventHandler(priority = EventPriority<method*start>org.bukkit.event.EventPriority<method*end>.MONITOR, ignoreCancelled = true)
public void partyJoin(PlayerJoinPartyEvent<method*start>tc.oc.pgm.events.PlayerJoinPartyEvent<method*end> event) {
if (event.getNewParty() instanceof MultiPlayerParty<method*start>tc.oc.pgm.match.MultiPlayerParty<method*end>) {
PlayerManager<method*start>com.github.rmsy.channels.PlayerManager<method*end> playerManager = channelsPlugin<method*start>tc.oc.pgm.channels.ChannelMatchModule.channelsPlugin<method*end>.getPlayerManager();
Player<method*start>org.bukkit.entity.Player<method*end> bukkitPlayer = event.getPlayer().getBukkit();
PartyChannel channel = partyChannels.get(event.getNewParty());
if (channel != null) {
if (event.getNewParty().isObservingType() && bukkitPlayer.hasPermission(RECEIVE_ALL_PERMISSION)) {
// If the player is joining observers and they have the receive-all perm, let them listen to all channels
bukkitPlayer.addAttachment(getMatch<method*start>tc.oc.pgm.match.MatchModule.getMatch<method*end>().getPlugin<method*start>tc.oc.pgm.match.Match.getPlugin<method*end>()).setPermission(matchListeningPermission<method*start>tc.oc.pgm.channels.ChannelMatchModule.matchListeningPermission<method*end>, true);
} else if (bukkitPlayer.hasPermission(TEAM_RECEIVE_PERMISSION)) {
// Give the player listening permission for the team's channel
bukkitPlayer.addAttachment(getMatch<method*start>tc.oc.pgm.match.MatchModule.getMatch<method*end>().getPlugin<method*start>tc.oc.pgm.match.Match.getPlugin<method*end>()).setPermission(channel.getListeningPermission(), true);
}
// If their sending channel was previously set to a team channel, switch it to the new team's channel
if (playerManager.getMembershipChannel(bukkitPlayer) instanceof PartyChannel) {
playerManager.setMembershipChannel(bukkitPlayer, channel);
}
}
}
updatePlayerChannel(event.getPlayer());
}
|
public static Map<method*start>java.util.Map<method*end><String<method*start>java.lang.String<method*end>, Object<method*start>java.lang.Object<method*end>> importDelimitedFile(DispatchContext<method*start>org.apache.ofbiz.service.DispatchContext<method*end> dctx, Map<method*start>java.util.Map<method*end><String<method*start>java.lang.String<method*end>, Object<method*start>java.lang.Object<method*end>> context) {
Locale<method*start>java.util.Locale<method*end> locale = (Locale<method*start>java.util.Locale<method*end>) context.get<method*start>java.util.Map.get<method*end>("locale");
GenericValue userLogin = (GenericValue) context.get<method*start>java.util.Map.get<method*end>("userLogin");
return ServiceUtil.returnError<method*start>org.apache.ofbiz.service.ServiceUtil.returnError<method*end>(UtilProperties.getMessage<method*start>org.apache.ofbiz.base.util.UtilProperties.getMessage<method*end>(resource, "EntityExtServicePermissionNotGranted", locale));
}
String<method*start>java.lang.String<method*end> delimiter = (String<method*start>java.lang.String<method*end>) context.get<method*start>java.util.Map.get<method*end>("delimiter");
if (delimiter == null) {
// default delimiter is tab
delimiter = "\t";
}
long startTime = System.currentTimeMillis<method*start>java.lang.System.currentTimeMillis<method*end>();
File<method*start>java.io.File<method*end> file = (File<method*start>java.io.File<method*end>) context.get<method*start>java.util.Map.get<method*end>("file");
int records = 0;
try {
records = readEntityFile<method*start>org.apache.ofbiz.entityext.data.EntityDataServices.readEntityFile<method*end>(file, delimiter, delegator);
} catch (GeneralException<method*start>org.apache.ofbiz.base.util.GeneralException<method*end> e) {
return ServiceUtil.returnError<method*start>org.apache.ofbiz.service.ServiceUtil.returnError<method*end>(e.getMessage<method*start>org.apache.ofbiz.base.util.GeneralException.getMessage<method*end>());
} catch (FileNotFoundException<method*start>java.io.FileNotFoundException<method*end> e) {
return ServiceUtil.returnError<method*start>org.apache.ofbiz.service.ServiceUtil.returnError<method*end>(UtilProperties.getMessage<method*start>org.apache.ofbiz.base.util.UtilProperties.getMessage<method*end>(resource, "EntityExtFileNotFound", UtilMisc.toMap<method*start>org.apache.ofbiz.base.util.UtilMisc.toMap<method*end>("fileName", file.getName<method*start>java.io.File.getName<method*end>()), locale));
} catch (IOException<method*start>java.io.IOException<method*end> e) {
Debug.logError<method*start>org.apache.ofbiz.base.util.Debug.logError<method*end>(e, module);
return ServiceUtil.returnError<method*start>org.apache.ofbiz.service.ServiceUtil.returnError<method*end>(UtilProperties.getMessage<method*start>org.apache.ofbiz.base.util.UtilProperties.getMessage<method*end>(resource, "EntityExtProblemReadingFile", UtilMisc.toMap<method*start>org.apache.ofbiz.base.util.UtilMisc.toMap<method*end>("fileName", file.getName<method*start>java.io.File.getName<method*end>()), locale));
}
long endTime = System.currentTimeMillis<method*start>java.lang.System.currentTimeMillis<method*end>();
long runTime = endTime - startTime;
Debug.logInfo<method*start>org.apache.ofbiz.base.util.Debug.logInfo<method*end>("Imported/Updated [" + records + "] from : " + file.getAbsolutePath<method*start>java.io.File.getAbsolutePath<method*end>() + " [" + runTime + "ms]", module);
Map<method*start>java.util.Map<method*end><String<method*start>java.lang.String<method*end>, Object<method*start>java.lang.Object<method*end>> result = ServiceUtil.returnSuccess<method*start>org.apache.ofbiz.service.ServiceUtil.returnSuccess<method*end>();
result.put<method*start>java.util.Map.put<method*end>("records", records);
return result;
}
|
conventional
|
public static Map<method*start>java.util.Map<method*end><String<method*start>java.lang.String<method*end>, Object<method*start>java.lang.Object<method*end>> importDelimitedFile(DispatchContext<method*start>org.apache.ofbiz.service.DispatchContext<method*end> dctx, Map<method*start>java.util.Map<method*end><String<method*start>java.lang.String<method*end>, Object<method*start>java.lang.Object<method*end>> context) {
Delegator<method*start>org.apache.ofbiz.entity.Delegator<method*end> delegator = dctx.getDelegator<method*start>org.apache.ofbiz.service.DispatchContext.getDelegator<method*end>();
Security<method*start>org.apache.ofbiz.security.Security<method*end> security = dctx.getSecurity<method*start>org.apache.ofbiz.service.DispatchContext.getSecurity<method*end>();
Locale<method*start>java.util.Locale<method*end> locale = (Locale<method*start>java.util.Locale<method*end>) context.get<method*start>java.util.Map.get<method*end>("locale");
// check permission
GenericValue userLogin = (GenericValue) context.get<method*start>java.util.Map.get<method*end>("userLogin");
if (!security.hasPermission<method*start>org.apache.ofbiz.security.Security.hasPermission<method*end>("ENTITY_MAINT", userLogin)) {
return ServiceUtil.returnError<method*start>org.apache.ofbiz.service.ServiceUtil.returnError<method*end>(UtilProperties.getMessage<method*start>org.apache.ofbiz.base.util.UtilProperties.getMessage<method*end>(resource, "EntityExtServicePermissionNotGranted", locale));
}
String<method*start>java.lang.String<method*end> delimiter = (String<method*start>java.lang.String<method*end>) context.get<method*start>java.util.Map.get<method*end>("delimiter");
if (delimiter == null) {
// default delimiter is tab
delimiter = "\t";
}
long startTime = System.currentTimeMillis<method*start>java.lang.System.currentTimeMillis<method*end>();
File<method*start>java.io.File<method*end> file = (File<method*start>java.io.File<method*end>) context.get<method*start>java.util.Map.get<method*end>("file");
int records = 0;
try {
records = readEntityFile<method*start>org.apache.ofbiz.entityext.data.EntityDataServices.readEntityFile<method*end>(file, delimiter, delegator);
} catch (GeneralException<method*start>org.apache.ofbiz.base.util.GeneralException<method*end> e) {
return ServiceUtil.returnError<method*start>org.apache.ofbiz.service.ServiceUtil.returnError<method*end>(e.getMessage<method*start>org.apache.ofbiz.base.util.GeneralException.getMessage<method*end>());
} catch (FileNotFoundException<method*start>java.io.FileNotFoundException<method*end> e) {
return ServiceUtil.returnError<method*start>org.apache.ofbiz.service.ServiceUtil.returnError<method*end>(UtilProperties.getMessage<method*start>org.apache.ofbiz.base.util.UtilProperties.getMessage<method*end>(resource, "EntityExtFileNotFound", UtilMisc.toMap<method*start>org.apache.ofbiz.base.util.UtilMisc.toMap<method*end>("fileName", file.getName<method*start>java.io.File.getName<method*end>()), locale));
} catch (IOException<method*start>java.io.IOException<method*end> e) {
Debug.logError<method*start>org.apache.ofbiz.base.util.Debug.logError<method*end>(e, module);
return ServiceUtil.returnError<method*start>org.apache.ofbiz.service.ServiceUtil.returnError<method*end>(UtilProperties.getMessage<method*start>org.apache.ofbiz.base.util.UtilProperties.getMessage<method*end>(resource, "EntityExtProblemReadingFile", UtilMisc.toMap<method*start>org.apache.ofbiz.base.util.UtilMisc.toMap<method*end>("fileName", file.getName<method*start>java.io.File.getName<method*end>()), locale));
}
long endTime = System.currentTimeMillis<method*start>java.lang.System.currentTimeMillis<method*end>();
long runTime = endTime - startTime;
Debug.logInfo<method*start>org.apache.ofbiz.base.util.Debug.logInfo<method*end>("Imported/Updated [" + records + "] from : " + file.getAbsolutePath<method*start>java.io.File.getAbsolutePath<method*end>() + " [" + runTime + "ms]", module);
Map<method*start>java.util.Map<method*end><String<method*start>java.lang.String<method*end>, Object<method*start>java.lang.Object<method*end>> result = ServiceUtil.returnSuccess<method*start>org.apache.ofbiz.service.ServiceUtil.returnSuccess<method*end>();
result.put<method*start>java.util.Map.put<method*end>("records", records);
return result;
}
|
@Nonnull
@Override
public RestAction<method*start>net.dv8tion.jda.api.requests.RestAction<method*end><Invite<method*start>net.dv8tion.jda.api.entities.Invite<method*end>> expand() {
if (this.expanded<method*start>net.dv8tion.jda.internal.entities.InviteImpl.expanded<method*end>)
return new CompletedRestAction<method*start>net.dv8tion.jda.internal.requests.CompletedRestAction<method*end><>(getJDA<method*start>net.dv8tion.jda.internal.entities.InviteImpl.getJDA<method*end>(), this);
if (this.type<method*start>net.dv8tion.jda.internal.entities.InviteImpl.type<method*end> != Invite.InviteType.GUILD<method*start>net.dv8tion.jda.api.entities.Invite.InviteType.GUILD<method*end>)
throw new IllegalStateException<method*start>java.lang.IllegalStateException<method*end>("Only guild invites can be expanded");
final net.dv8tion.jda.api.entities.Guild<method*start>net.dv8tion.jda.api.entities.Guild<method*end> guild = this.api.getGuildById<method*start>net.dv8tion.jda.internal.JDAImpl.getGuildById<method*end>(this.guild.getIdLong<method*start>net.dv8tion.jda.api.entities.Invite.Guild.getIdLong<method*end>());
if (guild == null)
throw new UnsupportedOperationException<method*start>java.lang.UnsupportedOperationException<method*end>("You're not in the guild this invite points to");
final Member member = guild.getSelfMember<method*start>net.dv8tion.jda.api.entities.Guild.getSelfMember<method*end>();
Route.CompiledRoute<method*start>net.dv8tion.jda.internal.requests.Route.CompiledRoute<method*end> route;
final GuildChannel<method*start>net.dv8tion.jda.api.entities.GuildChannel<method*end> channel = this.channel.getType<method*start>net.dv8tion.jda.api.entities.Invite.Channel.getType<method*end>() == ChannelType.TEXT<method*start>net.dv8tion.jda.api.entities.ChannelType.TEXT<method*end> ? guild.getTextChannelById<method*start>net.dv8tion.jda.api.entities.Guild.getTextChannelById<method*end>(this.channel.getIdLong<method*start>net.dv8tion.jda.api.entities.Invite.Channel.getIdLong<method*end>()) : guild.getVoiceChannelById<method*start>net.dv8tion.jda.api.entities.Guild.getVoiceChannelById<method*end>(this.channel.getIdLong<method*start>net.dv8tion.jda.api.entities.Invite.Channel.getIdLong<method*end>());
route = Route.Invites.GET_CHANNEL_INVITES.compile<method*start>net.dv8tion.jda.internal.requests.Route.compile<method*end>(channel.getId<method*start>net.dv8tion.jda.api.entities.GuildChannel.getId<method*end>());
route = Route.Invites.GET_GUILD_INVITES.compile<method*start>net.dv8tion.jda.internal.requests.Route.compile<method*end>(guild.getId<method*start>net.dv8tion.jda.api.entities.Guild.getId<method*end>());
} else {
throw new InsufficientPermissionException(channel, Permission.MANAGE_CHANNEL<method*start>net.dv8tion.jda.api.Permission.MANAGE_CHANNEL<method*end>, "You don't have the permission to view the full invite info");
}
return new RestActionImpl<method*start>net.dv8tion.jda.internal.requests.RestActionImpl<method*end><>(this.api<method*start>net.dv8tion.jda.internal.entities.InviteImpl.api<method*end>, route, (response, request) -> {
final EntityBuilder entityBuilder = this.api.getEntityBuilder<method*start>net.dv8tion.jda.internal.JDAImpl.getEntityBuilder<method*end>();
final DataArray array = response.getArray<method*start>org.apache.storm.shade.ring.util.response.response.getArray<method*end>();
for (int i = 0; i < array.length<method*start>net.dv8tion.jda.api.utils.data.DataArray.length<method*end>(); i++) {
final DataObject object = array.getObject<method*start>net.dv8tion.jda.api.utils.data.DataArray.getObject<method*end>(i);
if (InviteImpl.this.code.equals<method*start>java.lang.String.equals<method*end>(object.getString<method*start>net.dv8tion.jda.api.utils.data.DataObject.getString<method*end>("code"))) {
return entityBuilder.createInvite<method*start>net.dv8tion.jda.internal.entities.EntityBuilder.createInvite<method*end>(object);
}
}
throw new IllegalStateException<method*start>java.lang.IllegalStateException<method*end>("Missing the invite in the channel/guild invite list");
});
}
|
annotation
|
@Nonnull
@Override
public RestAction<method*start>net.dv8tion.jda.api.requests.RestAction<method*end><Invite<method*start>net.dv8tion.jda.api.entities.Invite<method*end>> expand() {
if (this.expanded<method*start>net.dv8tion.jda.internal.entities.InviteImpl.expanded<method*end>)
return new CompletedRestAction<method*start>net.dv8tion.jda.internal.requests.CompletedRestAction<method*end><>(getJDA<method*start>net.dv8tion.jda.internal.entities.InviteImpl.getJDA<method*end>(), this);
if (this.type<method*start>net.dv8tion.jda.internal.entities.InviteImpl.type<method*end> != Invite.InviteType.GUILD<method*start>net.dv8tion.jda.api.entities.Invite.InviteType.GUILD<method*end>)
throw new IllegalStateException<method*start>java.lang.IllegalStateException<method*end>("Only guild invites can be expanded");
final net.dv8tion.jda.api.entities.Guild<method*start>net.dv8tion.jda.api.entities.Guild<method*end> guild = this.api.getGuildById<method*start>net.dv8tion.jda.internal.JDAImpl.getGuildById<method*end>(this.guild.getIdLong<method*start>net.dv8tion.jda.api.entities.Invite.Guild.getIdLong<method*end>());
if (guild == null)
throw new UnsupportedOperationException<method*start>java.lang.UnsupportedOperationException<method*end>("You're not in the guild this invite points to");
final Member member = guild.getSelfMember<method*start>net.dv8tion.jda.api.entities.Guild.getSelfMember<method*end>();
Route.CompiledRoute<method*start>net.dv8tion.jda.internal.requests.Route.CompiledRoute<method*end> route;
final GuildChannel<method*start>net.dv8tion.jda.api.entities.GuildChannel<method*end> channel = this.channel.getType<method*start>net.dv8tion.jda.api.entities.Invite.Channel.getType<method*end>() == ChannelType.TEXT<method*start>net.dv8tion.jda.api.entities.ChannelType.TEXT<method*end> ? guild.getTextChannelById<method*start>net.dv8tion.jda.api.entities.Guild.getTextChannelById<method*end>(this.channel.getIdLong<method*start>net.dv8tion.jda.api.entities.Invite.Channel.getIdLong<method*end>()) : guild.getVoiceChannelById<method*start>net.dv8tion.jda.api.entities.Guild.getVoiceChannelById<method*end>(this.channel.getIdLong<method*start>net.dv8tion.jda.api.entities.Invite.Channel.getIdLong<method*end>());
if (member.hasPermission<method*start>net.dv8tion.jda.api.entities.Member.hasPermission<method*end>(channel, Permission.MANAGE_CHANNEL<method*start>net.dv8tion.jda.api.Permission.MANAGE_CHANNEL<method*end>)) {
route = Route.Invites.GET_CHANNEL_INVITES.compile<method*start>net.dv8tion.jda.internal.requests.Route.compile<method*end>(channel.getId<method*start>net.dv8tion.jda.api.entities.GuildChannel.getId<method*end>());
} else if (member.hasPermission<method*start>net.dv8tion.jda.api.entities.Member.hasPermission<method*end>(Permission.MANAGE_SERVER<method*start>net.dv8tion.jda.api.Permission.MANAGE_SERVER<method*end>)) {
route = Route.Invites.GET_GUILD_INVITES.compile<method*start>net.dv8tion.jda.internal.requests.Route.compile<method*end>(guild.getId<method*start>net.dv8tion.jda.api.entities.Guild.getId<method*end>());
} else {
throw new InsufficientPermissionException(channel, Permission.MANAGE_CHANNEL<method*start>net.dv8tion.jda.api.Permission.MANAGE_CHANNEL<method*end>, "You don't have the permission to view the full invite info");
}
return new RestActionImpl<method*start>net.dv8tion.jda.internal.requests.RestActionImpl<method*end><>(this.api<method*start>net.dv8tion.jda.internal.entities.InviteImpl.api<method*end>, route, (response, request) -> {
final EntityBuilder entityBuilder = this.api.getEntityBuilder<method*start>net.dv8tion.jda.internal.JDAImpl.getEntityBuilder<method*end>();
final DataArray array = response.getArray<method*start>org.apache.storm.shade.ring.util.response.response.getArray<method*end>();
for (int i = 0; i < array.length<method*start>net.dv8tion.jda.api.utils.data.DataArray.length<method*end>(); i++) {
final DataObject object = array.getObject<method*start>net.dv8tion.jda.api.utils.data.DataArray.getObject<method*end>(i);
if (InviteImpl.this.code.equals<method*start>java.lang.String.equals<method*end>(object.getString<method*start>net.dv8tion.jda.api.utils.data.DataObject.getString<method*end>("code"))) {
return entityBuilder.createInvite<method*start>net.dv8tion.jda.internal.entities.EntityBuilder.createInvite<method*end>(object);
}
}
throw new IllegalStateException<method*start>java.lang.IllegalStateException<method*end>("Missing the invite in the channel/guild invite list");
});
}
|
public boolean getIsEditable() {
boolean result = false;
try {
CmsObject<method*start>org.opencms.file.CmsObject<method*end> cms;
if (m_cms.getRequestContext<method*start>org.opencms.file.CmsObject.getRequestContext<method*end>().getCurrentProject().isOnlineProject()) {
cms = OpenCms.initCmsObject<method*start>org.opencms.main.OpenCms.initCmsObject<method*end>(m_cms<method*start>org.opencms.jsp.util.CmsJspContentAccessBean.m_cms<method*end>);
List<CmsProject> projects = OpenCms.getOrgUnitManager<method*start>org.opencms.main.OpenCms.getOrgUnitManager<method*end>().getAllAccessibleProjects<method*start>org.opencms.security.CmsOrgUnitManager.getAllAccessibleProjects<method*end>(cms, cms.getRequestContext<method*start>org.opencms.file.CmsObject.getRequestContext<method*end>().getOuFqn(), false);
if ((projects != null) && (projects.size<method*start>java.util.List.size<method*end>() > 0)) {
for (CmsProject p : projects) {
if (!p.isOnlineProject<method*start>org.opencms.file.CmsProject.isOnlineProject<method*end>()) {
cms.getRequestContext<method*start>org.opencms.file.CmsObject.getRequestContext<method*end>().setCurrentProject(p);
break;
}
}
}
} else {
cms = m_cms<method*start>org.opencms.jsp.util.CmsJspContentAccessBean.m_cms<method*end>;
}
result = cms.hasPermissions<method*start>org.opencms.file.CmsObject.hasPermissions<method*end>(m_resource, CmsPermissionSet.ACCESS_WRITE<method*start>org.opencms.security.CmsPermissionSet.ACCESS_WRITE<method*end>, false, CmsResourceFilter.ONLY_VISIBLE_NO_DELETED<method*start>org.opencms.file.CmsResourceFilter.ONLY_VISIBLE_NO_DELETED<method*end>);
CmsLock<method*start>org.opencms.lock.CmsLock<method*end> lock = cms.getLock<method*start>org.opencms.file.CmsObject.getLock<method*end>(m_resource);
if (!lock.isLockableBy<method*start>org.opencms.lock.CmsLock.isLockableBy<method*end>(cms.getRequestContext<method*start>org.opencms.file.CmsObject.getRequestContext<method*end>().getCurrentUser())) {
result = false;
}
} catch (CmsException<method*start>org.opencms.main.CmsException<method*end> e) {
}
return result;
}
|
conventional
|
public boolean getIsEditable() {
boolean result = false;
try {
CmsObject<method*start>org.opencms.file.CmsObject<method*end> cms;
if (m_cms.getRequestContext<method*start>org.opencms.file.CmsObject.getRequestContext<method*end>().getCurrentProject().isOnlineProject()) {
// we are in the online project, which means we must first switch to an offline project
// otherwise write permission checks will always return false
cms = OpenCms.initCmsObject<method*start>org.opencms.main.OpenCms.initCmsObject<method*end>(m_cms<method*start>org.opencms.jsp.util.CmsJspContentAccessBean.m_cms<method*end>);
List<CmsProject> projects = OpenCms.getOrgUnitManager<method*start>org.opencms.main.OpenCms.getOrgUnitManager<method*end>().getAllAccessibleProjects<method*start>org.opencms.security.CmsOrgUnitManager.getAllAccessibleProjects<method*end>(cms, cms.getRequestContext<method*start>org.opencms.file.CmsObject.getRequestContext<method*end>().getOuFqn(), false);
if ((projects != null) && (projects.size<method*start>java.util.List.size<method*end>() > 0)) {
// there is at least one project available
for (CmsProject p : projects) {
// need to iterate because the online project will be part of the result list
if (!p.isOnlineProject<method*start>org.opencms.file.CmsProject.isOnlineProject<method*end>()) {
cms.getRequestContext<method*start>org.opencms.file.CmsObject.getRequestContext<method*end>().setCurrentProject(p);
break;
}
}
}
} else {
// not in the online project, so just use the current project
cms = m_cms<method*start>org.opencms.jsp.util.CmsJspContentAccessBean.m_cms<method*end>;
}
result = cms.hasPermissions<method*start>org.opencms.file.CmsObject.hasPermissions<method*end>(m_resource, CmsPermissionSet.ACCESS_WRITE<method*start>org.opencms.security.CmsPermissionSet.ACCESS_WRITE<method*end>, false, CmsResourceFilter.ONLY_VISIBLE_NO_DELETED<method*start>org.opencms.file.CmsResourceFilter.ONLY_VISIBLE_NO_DELETED<method*end>);
if (result) {
// still need to check the lock status
CmsLock<method*start>org.opencms.lock.CmsLock<method*end> lock = cms.getLock<method*start>org.opencms.file.CmsObject.getLock<method*end>(m_resource);
if (!lock.isLockableBy<method*start>org.opencms.lock.CmsLock.isLockableBy<method*end>(cms.getRequestContext<method*start>org.opencms.file.CmsObject.getRequestContext<method*end>().getCurrentUser())) {
// resource is locked from a different user
result = false;
}
}
} catch (CmsException<method*start>org.opencms.main.CmsException<method*end> e) {
// should not happen, in case it does just assume not editable
}
return result;
}
|
@io.swagger.v3.oas.annotations<method*start>io.swagger.v3.oas.annotations<method*end>.Operation(operationId = "com.manydesigns.portofino.resourceactions.AbstractResourceAction#describeOperations", description = "Returns the list of operations that can be invoked via REST on this resource. " + "If the user doesn't have permission to invoke an operation, or a VISIBLE guard " + "doesn't pass, then the operation is excluded from the result. If an ENABLED guard " + "doesn't pass, the operation is included, but it is marked as not available.")
@ApiResponses({ @ApiResponse(responseCode = "200", description = "A list of operations (name, signature, available).") })
@Path<method*start>javax.ws.rs.Path<method*end>(":operations")
@GET
@Produces(MimeTypes.APPLICATION_JSON_UTF8<method*start>com.manydesigns.elements.util.MimeTypes.APPLICATION_JSON_UTF8<method*end>)
public List<method*start>java.util.List<method*end> describeOperations() {
HttpServletRequest<method*start>javax.servlet.http.HttpServletRequest<method*end> request = context.getRequest<method*start>com.manydesigns.portofino.resourceactions.ActionContext.getRequest<method*end>();
List<method*start>java.util.List<method*end><Operation<method*start>com.manydesigns.portofino.operations.Operation<method*end>> operations = Operations.getOperations<method*start>com.manydesigns.portofino.operations.Operations.getOperations<method*end>(getClass<method*start>com.manydesigns.portofino.resourceactions.AbstractResourceAction.getClass<method*end>());
List<method*start>java.util.List<method*end> result = new ArrayList<method*start>java.util.ArrayList<method*end>();
Subject<method*start>org.apache.shiro.subject.Subject<method*end> subject = SecurityUtils.getSubject<method*start>org.apache.shiro.SecurityUtils.getSubject<method*end>();
for (Operation<method*start>com.manydesigns.portofino.operations.Operation<method*end> operation : operations) {
logger.trace<method*start>org.slf4j.Logger.trace<method*end>("Operation: {}", operation);
Method<method*start>java.lang.reflect.Method<method*end> handler = operation.getMethod<method*start>org.jboss.internal.soa.esb.couriers.tx.InVMXAResource.operation.getMethod<method*end>();
boolean isAdmin = SecurityLogic.isAdministrator<method*start>com.manydesigns.portofino.security.SecurityLogic.isAdministrator<method*end>(request);
continue;
}
boolean visible = Operations.doGuardsPass<method*start>com.manydesigns.portofino.operations.Operations.doGuardsPass<method*end>(this, handler, GuardType.VISIBLE<method*start>com.manydesigns.portofino.operations.GuardType.VISIBLE<method*end>);
if (!visible) {
continue;
}
boolean available = Operations.doGuardsPass<method*start>com.manydesigns.portofino.operations.Operations.doGuardsPass<method*end>(this, handler, GuardType.ENABLED<method*start>com.manydesigns.portofino.operations.GuardType.ENABLED<method*end>);
Map<method*start>java.util.Map<method*end><String<method*start>java.lang.String<method*end>, Object> operationInfo = new HashMap<method*start>java.util.HashMap<method*end><>();
operationInfo.put<method*start>operationInfo.put<method*end>("name", operation.getName<method*start>org.jboss.internal.soa.esb.couriers.tx.InVMXAResource.operation.getName<method*end>());
operationInfo.put<method*start>operationInfo.put<method*end>("signature", operation.getSignature<method*start>org.jboss.internal.soa.esb.couriers.tx.InVMXAResource.operation.getSignature<method*end>());
operationInfo.put<method*start>operationInfo.put<method*end>("available", available);
result.add<method*start>org.apache.storm.generated.DistributedRPCInvocations.AsyncProcessor.result.add<method*end>(operationInfo);
}
return result;
}
|
conventional
|
@io.swagger.v3.oas.annotations<method*start>io.swagger.v3.oas.annotations<method*end>.Operation(operationId = "com.manydesigns.portofino.resourceactions.AbstractResourceAction#describeOperations", description = "Returns the list of operations that can be invoked via REST on this resource. " + "If the user doesn't have permission to invoke an operation, or a VISIBLE guard " + "doesn't pass, then the operation is excluded from the result. If an ENABLED guard " + "doesn't pass, the operation is included, but it is marked as not available.")
@ApiResponses({ @ApiResponse(responseCode = "200", description = "A list of operations (name, signature, available).") })
@Path<method*start>javax.ws.rs.Path<method*end>(":operations")
@GET
@Produces(MimeTypes.APPLICATION_JSON_UTF8<method*start>com.manydesigns.elements.util.MimeTypes.APPLICATION_JSON_UTF8<method*end>)
public List<method*start>java.util.List<method*end> describeOperations() {
HttpServletRequest<method*start>javax.servlet.http.HttpServletRequest<method*end> request = context.getRequest<method*start>com.manydesigns.portofino.resourceactions.ActionContext.getRequest<method*end>();
List<method*start>java.util.List<method*end><Operation<method*start>com.manydesigns.portofino.operations.Operation<method*end>> operations = Operations.getOperations<method*start>com.manydesigns.portofino.operations.Operations.getOperations<method*end>(getClass<method*start>com.manydesigns.portofino.resourceactions.AbstractResourceAction.getClass<method*end>());
List<method*start>java.util.List<method*end> result = new ArrayList<method*start>java.util.ArrayList<method*end>();
Subject<method*start>org.apache.shiro.subject.Subject<method*end> subject = SecurityUtils.getSubject<method*start>org.apache.shiro.SecurityUtils.getSubject<method*end>();
for (Operation<method*start>com.manydesigns.portofino.operations.Operation<method*end> operation : operations) {
logger.trace<method*start>org.slf4j.Logger.trace<method*end>("Operation: {}", operation);
Method<method*start>java.lang.reflect.Method<method*end> handler = operation.getMethod<method*start>org.jboss.internal.soa.esb.couriers.tx.InVMXAResource.operation.getMethod<method*end>();
boolean isAdmin = SecurityLogic.isAdministrator<method*start>com.manydesigns.portofino.security.SecurityLogic.isAdministrator<method*end>(request);
if (!isAdmin && ((actionInstance<method*start>com.manydesigns.portofino.resourceactions.AbstractResourceAction.actionInstance<method*end> != null && !SecurityLogic.hasPermissions<method*start>com.manydesigns.portofino.security.SecurityLogic.hasPermissions<method*end>(portofinoConfiguration<method*start>com.manydesigns.portofino.resourceactions.AbstractResourceAction.portofinoConfiguration<method*end>, operation.getMethod<method*start>org.jboss.internal.soa.esb.couriers.tx.InVMXAResource.operation.getMethod<method*end>(), getClass<method*start>com.manydesigns.portofino.resourceactions.AbstractResourceAction.getClass<method*end>(), actionInstance<method*start>com.manydesigns.portofino.resourceactions.AbstractResourceAction.actionInstance<method*end>, subject)) || !SecurityLogic.satisfiesRequiresAdministrator<method*start>com.manydesigns.portofino.security.SecurityLogic.satisfiesRequiresAdministrator<method*end>(request, this, handler))) {
continue;
}
boolean visible = Operations.doGuardsPass<method*start>com.manydesigns.portofino.operations.Operations.doGuardsPass<method*end>(this, handler, GuardType.VISIBLE<method*start>com.manydesigns.portofino.operations.GuardType.VISIBLE<method*end>);
if (!visible) {
continue;
}
boolean available = Operations.doGuardsPass<method*start>com.manydesigns.portofino.operations.Operations.doGuardsPass<method*end>(this, handler, GuardType.ENABLED<method*start>com.manydesigns.portofino.operations.GuardType.ENABLED<method*end>);
Map<method*start>java.util.Map<method*end><String<method*start>java.lang.String<method*end>, Object> operationInfo = new HashMap<method*start>java.util.HashMap<method*end><>();
operationInfo.put<method*start>operationInfo.put<method*end>("name", operation.getName<method*start>org.jboss.internal.soa.esb.couriers.tx.InVMXAResource.operation.getName<method*end>());
operationInfo.put<method*start>operationInfo.put<method*end>("signature", operation.getSignature<method*start>org.jboss.internal.soa.esb.couriers.tx.InVMXAResource.operation.getSignature<method*end>());
operationInfo.put<method*start>operationInfo.put<method*end>("available", available);
result.add<method*start>org.apache.storm.generated.DistributedRPCInvocations.AsyncProcessor.result.add<method*end>(operationInfo);
}
return result;
}
|
private void checkAuthorization(String repoPath, HttpServletReques request) throws FileRepositoryException {
try {
if (FILE_REPOSITORY_PER_WORKSPACE) {
Topic fileTopic = fetchFileTopic(repoPath);
if (fileTopic != null) {
String username = dmx.getPrivilegedAccess().getUsername(request);
long fileTopicId = fileTopic.getId();
throw new FileRepositoryException(userInfo(username) + " has no READ permission for " + "repository path \"" + repoPath + "\" (File topic ID=" + fileTopicId + ")", Status.UNAUTHORIZED);
throw new RuntimeException("Missing File topic for repository path \"" + repoPath + "\"");
}
}
} catch (FileRepositoryException e) {
throw e;
} catch (Exception e) {
throw new RuntimeException("Checking authorization for repository path \"" + repoPath + "\" failed", e);
}
}
|
conventional
|
private void checkAuthorization(String repoPath, HttpServletReques<method*start>java.lang.String<method*end>t request) throws FileReposit<method*start>javax.servlet.http.HttpServletRequest<method*end>oryException {
try {
if (FILE_REPOSITORY_PER_WORKSPACE) {
// We check authorization for the repository path by checking access to the corresponding File topic.
Topic fileTopic = fetchFileTopic(<method*start>systems.dmx.core.Topic<method*end>repoPath);
if (fileTopic != null) {
// We must perform access control for the fetchFileTopic() call manually here.
//
// Although the AccessControlPlugin's CheckTopicReadAccess kicks in, the request is *not* injected
// into the AccessControlPlugin letting fetchFileTopic() effectively run as "System".
//
// Note: checkAuthorization() is called (indirectly) from an OSGi HTTP service static resource
// HttpContext. JAX-RS is not involved here. That's why no JAX-RS injection takes place.
String username = dmx.getPrivilege<method*start>java.lang.String<method*end>dAccess().getUs<method*start>systems.dmx.core.osgi.PluginActivator.dmx<method*end>ername(request);
<method*start>systems.dmx.core.service.accesscontrol.PrivilegedAccess.getUsername<method*end> long fileTopicId = fileTopic.getId();
if (<method*start>systems.dmx.core.Topic.getId<method*end>!dmx.getPrivilegedAccess().hasPe<method*start>systems.dmx.core.osgi.PluginActivator.dmx<method*end>rmission(username, O<method*start>systems.dmx.core.service.CoreService.getPrivilegedAccess<method*end>peration.READ, f<method*start>systems.dmx.core.service.accesscontrol.PrivilegedAccess.hasPermission<method*end>ileTopicId)) {
<method*start>systems.dmx.core.service.accesscontrol.Operation.READ<method*end> throw new FileRepositoryException(userInfo(username) + " has <method*start>systems.dmx.files.FileRepositoryException<method*end>no READ p<method*start>systems.dmx.files.FilesPlugin.userInfo<method*end>ermission for " + "repository path \"" + repoPath + "\" (File topic ID=" + fileTopicId + ")", Status.UNAUTHORIZED);
<method*start>javax.ws.rs.core.Response.Status<method*end> }
} else {
throw new RuntimeException("Missing File topic for rep<method*start>java.lang.RuntimeException<method*end>ository path \"" + repoPath + "\"");
}
}
} catch (FileRepositoryException e) {
throw e;
} catch (Exception e) {
throw new <method*start>java.lang.Exception<method*end>RuntimeException("Checking authorization for<method*start>java.lang.RuntimeException<method*end> repository path \"" + repoPath + "\" failed", e);
}
}
|
@Override
public void onExecute(CommandSender<method*start>org.bukkit.command.CommandSender<method*end> sender, String<method*start>java.lang.String<method*end>[] args) {
if (args.length<method*start>java.lang.String[].length<method*end> == 3) {
Optional<method*start>java.util.Optional<method*end><Player<method*start>org.bukkit.entity.Player<method*end>> player = PlayerList.findByName<method*start>io.github.thebusybiscuit.cscorelib2.players.PlayerList.findByName<method*end>(args[1]);
if (player.isPresent<method*start>java.util.Optional.isPresent<method*end>()) {
Player<method*start>org.bukkit.entity.Player<method*end> p = player.get<method*start>java.util.Optional.get<method*end>();
PlayerProfile.get<method*start>me.mrCookieSlime.Slimefun.api.PlayerProfile.get<method*end>(p, profile -> {
if (args[2].equalsIgnoreCase<method*start>java.lang.String.equalsIgnoreCase<method*end>("all")) {
for (Research<method*start>me.mrCookieSlime.Slimefun.Objects.Research<method*end> res : SlimefunPlugin.getRegistry<method*start>me.mrCookieSlime.Slimefun.SlimefunPlugin.getRegistry<method*end>().getResearches()) {
if (!profile.hasUnlocked<method*start>profile.hasUnlocked<method*end>(res)) {
SlimefunPlugin.getLocal<method*start>me.mrCookieSlime.Slimefun.SlimefunPlugin.getLocal<method*end>().sendMessage(sender, "messages.give-research", true, msg -> msg.replace<method*start>msg.replace<method*end>(PLACEHOLDER_PLAYER, p.getName<method*start>org.bukkit.entity.Player.getName<method*end>()).replace(PLACEHOLDER_RESEARCH, res.getName<method*start>me.mrCookieSlime.Slimefun.Objects.Research.getName<method*end>(p)));
}
res.unlock<method*start>me.mrCookieSlime.Slimefun.Objects.Research.unlock<method*end>(p, true);
}
} else if (args[2].equalsIgnoreCase<method*start>java.lang.String.equalsIgnoreCase<method*end>("reset")) {
for (Research<method*start>me.mrCookieSlime.Slimefun.Objects.Research<method*end> res : SlimefunPlugin.getRegistry<method*start>me.mrCookieSlime.Slimefun.SlimefunPlugin.getRegistry<method*end>().getResearches()) {
profile.setResearched<method*start>profile.setResearched<method*end>(res, false);
}
SlimefunPlugin.getLocal<method*start>me.mrCookieSlime.Slimefun.SlimefunPlugin.getLocal<method*end>().sendMessage(p, "commands.research.reset", true, msg -> msg.replace<method*start>msg.replace<method*end>(PLACEHOLDER_PLAYER, args[1]));
} else {
Optional<method*start>java.util.Optional<method*end><Research<method*start>me.mrCookieSlime.Slimefun.Objects.Research<method*end>> research = getResearchFromString<method*start>io.github.thebusybiscuit.slimefun4.core.commands.subcommands.ResearchCommand.getResearchFromString<method*end>(args[2]);
if (research.isPresent<method*start>java.util.Optional.isPresent<method*end>()) {
research.get<method*start>java.util.Optional.get<method*end>().unlock<method*start>me.mrCookieSlime.Slimefun.Objects.Research.unlock<method*end>(p, true);
SlimefunPlugin.getLocal<method*start>me.mrCookieSlime.Slimefun.SlimefunPlugin.getLocal<method*end>().sendMessage(sender, "messages.give-research", true, msg -> msg.replace<method*start>msg.replace<method*end>(PLACEHOLDER_PLAYER, p.getName<method*start>org.bukkit.entity.Player.getName<method*end>()).replace(PLACEHOLDER_RESEARCH, research.get<method*start>java.util.Optional.get<method*end>().getName<method*start>me.mrCookieSlime.Slimefun.Objects.Research.getName<method*end>(p)));
} else {
SlimefunPlugin.getLocal<method*start>me.mrCookieSlime.Slimefun.SlimefunPlugin.getLocal<method*end>().sendMessage(sender, "messages.not-valid-research", true, msg -> msg.replace<method*start>msg.replace<method*end>(PLACEHOLDER_RESEARCH, args[2]));
}
}
});
} else {
SlimefunPlugin.getLocal<method*start>me.mrCookieSlime.Slimefun.SlimefunPlugin.getLocal<method*end>().sendMessage(sender, "messages.not-online", true, msg -> msg.replace<method*start>msg.replace<method*end>(PLACEHOLDER_PLAYER, args[1]));
}
} else
SlimefunPlugin.getLocal<method*start>me.mrCookieSlime.Slimefun.SlimefunPlugin.getLocal<method*end>().sendMessage(sender, "messages.no-permission", true);
} else {
SlimefunPlugin.getLocal<method*start>me.mrCookieSlime.Slimefun.SlimefunPlugin.getLocal<method*end>().sendMessage(sender, "messages.usage", true, msg -> msg.replace<method*start>msg.replace<method*end>("%usage%", "/sf research <Player> <all/reset/Research>"));
}
}
|
annotation
|
@Override
public void onExecute(CommandSender<method*start>org.bukkit.command.CommandSender<method*end> sender, String<method*start>java.lang.String<method*end>[] args) {
if (args.length<method*start>java.lang.String[].length<method*end> == 3) {
if (sender.hasPermission<method*start>org.bukkit.command.CommandSender.hasPermission<method*end>("slimefun.cheat.researches") || !(sender instanceof Player<method*start>org.bukkit.entity.Player<method*end>)) {
Optional<method*start>java.util.Optional<method*end><Player<method*start>org.bukkit.entity.Player<method*end>> player = PlayerList.findByName<method*start>io.github.thebusybiscuit.cscorelib2.players.PlayerList.findByName<method*end>(args[1]);
if (player.isPresent<method*start>java.util.Optional.isPresent<method*end>()) {
Player<method*start>org.bukkit.entity.Player<method*end> p = player.get<method*start>java.util.Optional.get<method*end>();
PlayerProfile.get<method*start>me.mrCookieSlime.Slimefun.api.PlayerProfile.get<method*end>(p, profile -> {
if (args[2].equalsIgnoreCase<method*start>java.lang.String.equalsIgnoreCase<method*end>("all")) {
for (Research<method*start>me.mrCookieSlime.Slimefun.Objects.Research<method*end> res : SlimefunPlugin.getRegistry<method*start>me.mrCookieSlime.Slimefun.SlimefunPlugin.getRegistry<method*end>().getResearches()) {
if (!profile.hasUnlocked<method*start>profile.hasUnlocked<method*end>(res)) {
SlimefunPlugin.getLocal<method*start>me.mrCookieSlime.Slimefun.SlimefunPlugin.getLocal<method*end>().sendMessage(sender, "messages.give-research", true, msg -> msg.replace<method*start>msg.replace<method*end>(PLACEHOLDER_PLAYER, p.getName<method*start>org.bukkit.entity.Player.getName<method*end>()).replace(PLACEHOLDER_RESEARCH, res.getName<method*start>me.mrCookieSlime.Slimefun.Objects.Research.getName<method*end>(p)));
}
res.unlock<method*start>me.mrCookieSlime.Slimefun.Objects.Research.unlock<method*end>(p, true);
}
} else if (args[2].equalsIgnoreCase<method*start>java.lang.String.equalsIgnoreCase<method*end>("reset")) {
for (Research<method*start>me.mrCookieSlime.Slimefun.Objects.Research<method*end> res : SlimefunPlugin.getRegistry<method*start>me.mrCookieSlime.Slimefun.SlimefunPlugin.getRegistry<method*end>().getResearches()) {
profile.setResearched<method*start>profile.setResearched<method*end>(res, false);
}
SlimefunPlugin.getLocal<method*start>me.mrCookieSlime.Slimefun.SlimefunPlugin.getLocal<method*end>().sendMessage(p, "commands.research.reset", true, msg -> msg.replace<method*start>msg.replace<method*end>(PLACEHOLDER_PLAYER, args[1]));
} else {
Optional<method*start>java.util.Optional<method*end><Research<method*start>me.mrCookieSlime.Slimefun.Objects.Research<method*end>> research = getResearchFromString<method*start>io.github.thebusybiscuit.slimefun4.core.commands.subcommands.ResearchCommand.getResearchFromString<method*end>(args[2]);
if (research.isPresent<method*start>java.util.Optional.isPresent<method*end>()) {
research.get<method*start>java.util.Optional.get<method*end>().unlock<method*start>me.mrCookieSlime.Slimefun.Objects.Research.unlock<method*end>(p, true);
SlimefunPlugin.getLocal<method*start>me.mrCookieSlime.Slimefun.SlimefunPlugin.getLocal<method*end>().sendMessage(sender, "messages.give-research", true, msg -> msg.replace<method*start>msg.replace<method*end>(PLACEHOLDER_PLAYER, p.getName<method*start>org.bukkit.entity.Player.getName<method*end>()).replace(PLACEHOLDER_RESEARCH, research.get<method*start>java.util.Optional.get<method*end>().getName<method*start>me.mrCookieSlime.Slimefun.Objects.Research.getName<method*end>(p)));
} else {
SlimefunPlugin.getLocal<method*start>me.mrCookieSlime.Slimefun.SlimefunPlugin.getLocal<method*end>().sendMessage(sender, "messages.not-valid-research", true, msg -> msg.replace<method*start>msg.replace<method*end>(PLACEHOLDER_RESEARCH, args[2]));
}
}
});
} else {
SlimefunPlugin.getLocal<method*start>me.mrCookieSlime.Slimefun.SlimefunPlugin.getLocal<method*end>().sendMessage(sender, "messages.not-online", true, msg -> msg.replace<method*start>msg.replace<method*end>(PLACEHOLDER_PLAYER, args[1]));
}
} else
SlimefunPlugin.getLocal<method*start>me.mrCookieSlime.Slimefun.SlimefunPlugin.getLocal<method*end>().sendMessage(sender, "messages.no-permission", true);
} else {
SlimefunPlugin.getLocal<method*start>me.mrCookieSlime.Slimefun.SlimefunPlugin.getLocal<method*end>().sendMessage(sender, "messages.usage", true, msg -> msg.replace<method*start>msg.replace<method*end>("%usage%", "/sf research <Player> <all/reset/Research>"));
}
}
|
private void onMessage(GuildMessageReceivedEvent<method*start>net.dv8tion.jda.api.events.message.guild.GuildMessageReceivedEvent<method*end> event) {
if (event.getAuthor().isFake())
return;
// Moderation features
DBGuild<method*start>net.kodehawa.mantarobot.db.entities.DBGuild<method*end> dbGuild = MantaroData<method*start>net.kodehawa.mantarobot.data.MantaroData<method*end>.db().getGuild(event.getGuild());
GuildData<method*start>net.kodehawa.mantarobot.db.entities.helpers.GuildData<method*end> guildData = dbGuild.getData();
// link protection
if (guildData.isLinkProtection() && !guildData.getLinkProtectionAllowedChannels().contains(event.getChannel().getId()) && !guildData.getLinkProtectionAllowedUsers().contains(event.getAuthor().getId())) {
// Has link protection enabled, let's check if they don't have admin stuff.
// Check if invite is valid. This is async because hasInvite uses complete sometimes.
threadPool.execute(() -> {
// If this message has an invite and it's not an invite to the same guild it was sent on, proceed to delete.
if (hasInvite(event.getJDA(), event.getGuild(), event.getMessage().getContentRaw())) {
Member<method*start>net.dv8tion.jda.api.entities.Member<method*end> bot = event.getGuild().getSelfMember();
actions.labels("link_block").inc();
User<method*start>net.dv8tion.jda.api.entities.User<method*end> author = event.getAuthor();
// Ignore myself.
if (event.getAuthor().getId().equals(event.getJDA().getSelfUser().getId())) {
return;
}
// Ignore log channel.
if (guildData.getGuildLogChannel() != null && event.getChannel().getId().equals(guildData.getGuildLogChannel())) {
return;
}
// Yes, I know the check previously done is redundant, but in case someone decides to change the laws of nature, it should do .
event.getMessage().delete().queue();
event.getChannel().sendMessage(EmoteReference<method*start>net.kodehawa.mantarobot.utils.commands.EmoteReference<method*end>.ERROR + "**You cannot advertise here.** Deleted invite link sent by **" + author.getName() + "#" + author.getDiscriminator() + "**.").queue();
} else {
event.getChannel().sendMessage(EmoteReference<method*start>net.kodehawa.mantarobot.utils.commands.EmoteReference<method*end>.ERROR + "I cannot remove the invite link because I don't have permission to delete messages!").queue();
}
}
});
}
}
}
|
conventional
|
private void onMessage(GuildMessageReceivedEvent<method*start>net.dv8tion.jda.api.events.message.guild.GuildMessageReceivedEvent<method*end> event) {
if (event.getAuthor().isFake())
return;
// Moderation features
DBGuild<method*start>net.kodehawa.mantarobot.db.entities.DBGuild<method*end> dbGuild = MantaroData<method*start>net.kodehawa.mantarobot.data.MantaroData<method*end>.db().getGuild(event.getGuild());
GuildData<method*start>net.kodehawa.mantarobot.db.entities.helpers.GuildData<method*end> guildData = dbGuild.getData();
// link protection
if (guildData.isLinkProtection() && !guildData.getLinkProtectionAllowedChannels().contains(event.getChannel().getId()) && !guildData.getLinkProtectionAllowedUsers().contains(event.getAuthor().getId())) {
// Has link protection enabled, let's check if they don't have admin stuff.
if (event.getMember() != null && !event.getMember().hasPermission(Permission<method*start>net.dv8tion.jda.api.Permission<method*end>.ADMINISTRATOR) && !event.getMember().hasPermission(Permission<method*start>net.dv8tion.jda.api.Permission<method*end>.MANAGE_SERVER)) {
// Check if invite is valid. This is async because hasInvite uses complete sometimes.
threadPool.execute(() -> {
// If this message has an invite and it's not an invite to the same guild it was sent on, proceed to delete.
if (hasInvite(event.getJDA(), event.getGuild(), event.getMessage().getContentRaw())) {
Member<method*start>net.dv8tion.jda.api.entities.Member<method*end> bot = event.getGuild().getSelfMember();
actions.labels("link_block").inc();
if (bot.hasPermission(event.getChannel(), Permission<method*start>net.dv8tion.jda.api.Permission<method*end>.MESSAGE_MANAGE) || bot.hasPermission(Permission<method*start>net.dv8tion.jda.api.Permission<method*end>.ADMINISTRATOR)) {
User<method*start>net.dv8tion.jda.api.entities.User<method*end> author = event.getAuthor();
// Ignore myself.
if (event.getAuthor().getId().equals(event.getJDA().getSelfUser().getId())) {
return;
}
// Ignore log channel.
if (guildData.getGuildLogChannel() != null && event.getChannel().getId().equals(guildData.getGuildLogChannel())) {
return;
}
// Yes, I know the check previously done is redundant, but in case someone decides to change the laws of nature, it should do .
event.getMessage().delete().queue();
event.getChannel().sendMessage(EmoteReference<method*start>net.kodehawa.mantarobot.utils.commands.EmoteReference<method*end>.ERROR + "**You cannot advertise here.** Deleted invite link sent by **" + author.getName() + "#" + author.getDiscriminator() + "**.").queue();
} else {
event.getChannel().sendMessage(EmoteReference<method*start>net.kodehawa.mantarobot.utils.commands.EmoteReference<method*end>.ERROR + "I cannot remove the invite link because I don't have permission to delete messages!").queue();
}
}
});
}
}
}
|
private boolean hasAccess(final PFUserDO<method*start>org.projectforge.framework.persistence.user.entities.PFUserDO<method*end> user, final GanttChartDO obj, final GanttAccess<method*start>org.projectforge.business.gantt.GanttAccess<method*end> access) {
if (accessChecker<method*start>org.projectforge.business.user.UserRightAccessCheck.accessChecker<method*end>.userEqualsToContextUser(obj.getOwner())) {
// Owner has always access:
return true;
}
if (access == null || access == GanttAccess<method*start>org.projectforge.business.gantt.GanttAccess<method*end>.OWNER) {
// No access defined, so only owner has access:
return false;
}
if (access.isIn(GanttAccess<method*start>org.projectforge.business.gantt.GanttAccess<method*end>.ALL, GanttAccess<method*start>org.projectforge.business.gantt.GanttAccess<method*end>.PROJECT_MANAGER)) {
if (obj.getTask() == null) {
// Task needed for these GanttAccess types, so no access:
return false;
}
// User has no task access:
return false;
}
if (access == GanttAccess<method*start>org.projectforge.business.gantt.GanttAccess<method*end>.ALL) {
// User has task access:
return true;
}
final TaskTree<method*start>org.projectforge.business.task.TaskTree<method*end> taskTree = TaskTreeHelper<method*start>org.projectforge.business.tasktree.TaskTreeHelper<method*end>.getTaskTree();
final ProjektDO<method*start>org.projectforge.business.fibu.ProjektDO<method*end> project = taskTree.getProjekt(obj.getTaskId());
if (project == null) {
// Project manager group not found:
return accessChecker.isUserMemberOfGroup(user, ProjectForgeGroup<method*start>org.projectforge.business.user.ProjectForgeGroup<method*end>.PROJECT_MANAGER);
}
// Users of the project manager group have access:
final UserGroupCache userGroupCache = TenantRegistryMap<method*start>org.projectforge.business.multitenancy.TenantRegistryMap<method*end>.getInstance().getTenantRegistry().getUserGroupCache();
return userGroupCache.isUserMemberOfGroup(user, project.getProjektManagerGroupId());
} else {
log.error("Unsupported GanttAccess type: " + access);
}
return false;
}
|
conventional
|
private boolean hasAccess(final PFUserDO<method*start>org.projectforge.framework.persistence.user.entities.PFUserDO<method*end> user, final GanttChartDO obj, final GanttAccess<method*start>org.projectforge.business.gantt.GanttAccess<method*end> access) {
if (accessChecker<method*start>org.projectforge.business.user.UserRightAccessCheck.accessChecker<method*end>.userEqualsToContextUser(obj.getOwner())) {
// Owner has always access:
return true;
}
if (access == null || access == GanttAccess<method*start>org.projectforge.business.gantt.GanttAccess<method*end>.OWNER) {
// No access defined, so only owner has access:
return false;
}
if (access.isIn(GanttAccess<method*start>org.projectforge.business.gantt.GanttAccess<method*end>.ALL, GanttAccess<method*start>org.projectforge.business.gantt.GanttAccess<method*end>.PROJECT_MANAGER)) {
if (obj.getTask() == null) {
// Task needed for these GanttAccess types, so no access:
return false;
}
if (!accessChecker.hasPermission(user, obj.getTaskId(), AccessType<method*start>org.projectforge.framework.access.AccessType<method*end>.TASKS, OperationType<method*start>org.projectforge.framework.access.OperationType<method*end>.SELECT, false)) {
// User has no task access:
return false;
}
if (access == GanttAccess<method*start>org.projectforge.business.gantt.GanttAccess<method*end>.ALL) {
// User has task access:
return true;
}
final TaskTree<method*start>org.projectforge.business.task.TaskTree<method*end> taskTree = TaskTreeHelper<method*start>org.projectforge.business.tasktree.TaskTreeHelper<method*end>.getTaskTree();
final ProjektDO<method*start>org.projectforge.business.fibu.ProjektDO<method*end> project = taskTree.getProjekt(obj.getTaskId());
if (project == null) {
// Project manager group not found:
return accessChecker.isUserMemberOfGroup(user, ProjectForgeGroup<method*start>org.projectforge.business.user.ProjectForgeGroup<method*end>.PROJECT_MANAGER);
}
// Users of the project manager group have access:
final UserGroupCache userGroupCache = TenantRegistryMap<method*start>org.projectforge.business.multitenancy.TenantRegistryMap<method*end>.getInstance().getTenantRegistry().getUserGroupCache();
return userGroupCache.isUserMemberOfGroup(user, project.getProjektManagerGroupId());
} else {
log.error("Unsupported GanttAccess type: " + access);
}
return false;
}
|
public static List<method*start>java.util.List<method*end><SecurityAccess<method*start>com.jaeksoft.searchlib.crawler.file.process.SecurityAccess<method*end>> getSecurity(FTPFile<method*start>org.apache.commons.net.ftp.FTPFile<method*end> ftpFile) {
List<method*start>java.util.List<method*end><SecurityAccess<method*start>com.jaeksoft.searchlib.crawler.file.process.SecurityAccess<method*end>> accesses = new ArrayList<method*start>java.util.ArrayList<method*end><>();
if (ftpFile == null)
return accesses;
SecurityAccess<method*start>com.jaeksoft.searchlib.crawler.file.process.SecurityAccess<method*end> access = new SecurityAccess<method*start>com.jaeksoft.searchlib.crawler.file.process.SecurityAccess<method*end>();
access.setGrant<method*start>com.jaeksoft.searchlib.crawler.file.process.SecurityAccess.setGrant<method*end>(SecurityAccess.Grant.ALLOW<method*start>com.jaeksoft.searchlib.crawler.file.process.SecurityAccess.Grant.ALLOW<method*end>);
access.setType<method*start>com.jaeksoft.searchlib.crawler.file.process.SecurityAccess.setType<method*end>(SecurityAccess.Type.USER<method*start>com.jaeksoft.searchlib.crawler.file.process.SecurityAccess.Type.USER<method*end>);
access.setId<method*start>com.jaeksoft.searchlib.crawler.file.process.SecurityAccess.setId<method*end>(ftpFile.getUser<method*start>org.apache.commons.net.ftp.FTPFile.getUser<method*end>());
accesses.add<method*start>java.util.List.add<method*end>(access);
}
SecurityAccess<method*start>com.jaeksoft.searchlib.crawler.file.process.SecurityAccess<method*end> access = new SecurityAccess<method*start>com.jaeksoft.searchlib.crawler.file.process.SecurityAccess<method*end>();
access.setGrant<method*start>com.jaeksoft.searchlib.crawler.file.process.SecurityAccess.setGrant<method*end>(SecurityAccess.Grant.ALLOW<method*start>com.jaeksoft.searchlib.crawler.file.process.SecurityAccess.Grant.ALLOW<method*end>);
access.setType<method*start>com.jaeksoft.searchlib.crawler.file.process.SecurityAccess.setType<method*end>(SecurityAccess.Type.GROUP<method*start>com.jaeksoft.searchlib.crawler.file.process.SecurityAccess.Type.GROUP<method*end>);
access.setId<method*start>com.jaeksoft.searchlib.crawler.file.process.SecurityAccess.setId<method*end>(ftpFile.getGroup<method*start>org.apache.commons.net.ftp.FTPFile.getGroup<method*end>());
accesses.add<method*start>java.util.List.add<method*end>(access);
}
return accesses;
}
|
annotation
|
public static List<method*start>java.util.List<method*end><SecurityAccess<method*start>com.jaeksoft.searchlib.crawler.file.process.SecurityAccess<method*end>> getSecurity(FTPFile<method*start>org.apache.commons.net.ftp.FTPFile<method*end> ftpFile) {
List<method*start>java.util.List<method*end><SecurityAccess<method*start>com.jaeksoft.searchlib.crawler.file.process.SecurityAccess<method*end>> accesses = new ArrayList<method*start>java.util.ArrayList<method*end><>();
if (ftpFile == null)
return accesses;
if (ftpFile.hasPermission<method*start>org.apache.commons.net.ftp.FTPFile.hasPermission<method*end>(FTPFile.USER_ACCESS<method*start>org.apache.commons.net.ftp.FTPFile.USER_ACCESS<method*end>, FTPFile.READ_PERMISSION<method*start>org.apache.commons.net.ftp.FTPFile.READ_PERMISSION<method*end>)) {
SecurityAccess<method*start>com.jaeksoft.searchlib.crawler.file.process.SecurityAccess<method*end> access = new SecurityAccess<method*start>com.jaeksoft.searchlib.crawler.file.process.SecurityAccess<method*end>();
access.setGrant<method*start>com.jaeksoft.searchlib.crawler.file.process.SecurityAccess.setGrant<method*end>(SecurityAccess.Grant.ALLOW<method*start>com.jaeksoft.searchlib.crawler.file.process.SecurityAccess.Grant.ALLOW<method*end>);
access.setType<method*start>com.jaeksoft.searchlib.crawler.file.process.SecurityAccess.setType<method*end>(SecurityAccess.Type.USER<method*start>com.jaeksoft.searchlib.crawler.file.process.SecurityAccess.Type.USER<method*end>);
access.setId<method*start>com.jaeksoft.searchlib.crawler.file.process.SecurityAccess.setId<method*end>(ftpFile.getUser<method*start>org.apache.commons.net.ftp.FTPFile.getUser<method*end>());
accesses.add<method*start>java.util.List.add<method*end>(access);
}
if (ftpFile.hasPermission<method*start>org.apache.commons.net.ftp.FTPFile.hasPermission<method*end>(FTPFile.GROUP_ACCESS<method*start>org.apache.commons.net.ftp.FTPFile.GROUP_ACCESS<method*end>, FTPFile.READ_PERMISSION<method*start>org.apache.commons.net.ftp.FTPFile.READ_PERMISSION<method*end>)) {
SecurityAccess<method*start>com.jaeksoft.searchlib.crawler.file.process.SecurityAccess<method*end> access = new SecurityAccess<method*start>com.jaeksoft.searchlib.crawler.file.process.SecurityAccess<method*end>();
access.setGrant<method*start>com.jaeksoft.searchlib.crawler.file.process.SecurityAccess.setGrant<method*end>(SecurityAccess.Grant.ALLOW<method*start>com.jaeksoft.searchlib.crawler.file.process.SecurityAccess.Grant.ALLOW<method*end>);
access.setType<method*start>com.jaeksoft.searchlib.crawler.file.process.SecurityAccess.setType<method*end>(SecurityAccess.Type.GROUP<method*start>com.jaeksoft.searchlib.crawler.file.process.SecurityAccess.Type.GROUP<method*end>);
access.setId<method*start>com.jaeksoft.searchlib.crawler.file.process.SecurityAccess.setId<method*end>(ftpFile.getGroup<method*start>org.apache.commons.net.ftp.FTPFile.getGroup<method*end>());
accesses.add<method*start>java.util.List.add<method*end>(access);
}
return accesses;
}
|
protected void randomRead(Session testSession, List allPaths, int cnt) throws RepositoryException {
boolean logout = false;
if (testSession == null) {
testSession = getTestSession();
logout = true;
}
try {
List permissionNames = ImmutableList.copyOf(Permissions.PERMISSION_NAMES.values());
int access = 0;
int noAccess = 0;
long start = System.currentTimeMillis();
for (int i = 0; i < cnt; i++) {
String path = getRandom(allPaths);
String permissionName = getRandom(permissionNames);
}
long end = System.currentTimeMillis();
if (doReport) {
System.out.println("Session " + testSession.getUserID() + " hasPermissions (granted = " + access + "; denied = " + noAccess + ") completed in " + (end - start));
}
} finally {
if (logout) {
logout(testSession);
}
}
}
|
conventional
|
protected void randomRead(Session<method*start>javax.jcr.Session<method*end> testSession, List<method*start>java.util.List<method*end><String<method*start>java.lang.String<method*end>> allPaths, int cnt) throws RepositoryException<method*start>javax.jcr.RepositoryException<method*end> {
boolean logout = false;
if (testSession == null) {
testSession = getTestSession<method*start>org.apache.jackrabbit.oak.benchmark.authorization.principalbased.PrinicipalBasedReadTest.getTestSession<method*end>();
logout = true;
}
try {
List<method*start>java.util.List<method*end><String<method*start>java.lang.String<method*end>> permissionNames = ImmutableList.copyOf<method*start>com.google.common.collect.ImmutableList.copyOf<method*end>(Permissions.PERMISSION_NAMES.values<method*start>java.util.Map.values<method*end>());
int access = 0;
int noAccess = 0;
long start = System.currentTimeMillis<method*start>java.lang.System.currentTimeMillis<method*end>();
for (int i = 0; i < cnt; i++) {
String<method*start>java.lang.String<method*end> path = getRandom<method*start>org.apache.jackrabbit.oak.benchmark.ReadDeepTreeTest.getRandom<method*end>(allPaths);
String<method*start>java.lang.String<method*end> permissionName = getRandom<method*start>org.apache.jackrabbit.oak.benchmark.ReadDeepTreeTest.getRandom<method*end>(permissionNames);
if (testSession.hasPermission<method*start>javax.jcr.Session.hasPermission<method*end>(path, permissionName)) {
access++;
} else {
noAccess++;
}
}
long end = System.currentTimeMillis<method*start>java.lang.System.currentTimeMillis<method*end>();
if (doReport) {
System.out.println<method*start>java.io.PrintStream.println<method*end>("Session " + testSession.getUserID<method*start>javax.jcr.Session.getUserID<method*end>() + " hasPermissions (granted = " + access + "; denied = " + noAccess + ") completed in " + (end - start));
}
} finally {
if (logout) {
logout(testSession);
}
}
}
|
@Override<method*start>java.lang.Override<method*end>
public void route(final ImmutableMessage<method*start>joynr.ImmutableMessage<method*end> message) {
accessController.hasConsumerPermission<method*start>io.joynr.accesscontrol.AccessController.hasConsumerPermission<method*end>(message, new HasConsumerPermissionCallback() {
@Override<method*start>java.lang.Override<method*end>
public void hasConsumerPermission(boolean hasPermission) {
CcMessageRouter<method*start>io.joynr.messaging.routing.CcMessageRouter<method*end>.super.route<method*start>io.joynr.messaging.routing.CcMessageRouter.super.route<method*end>(message);
} else {
logger.warn<method*start>org.slf4j.Logger.warn<method*end>("Dropping message {} from {} to {} because of insufficient access rights", message.getId<method*start>joynr.ImmutableMessage.getId<method*end>(), message.getSender<method*start>joynr.ImmutableMessage.getSender<method*end>(), message.getRecipient<method*start>joynr.ImmutableMessage.getRecipient<method*end>());
}
}
});
}
|
annotation
|
@Override<method*start>java.lang.Override<method*end>
public void route(final ImmutableMessage<method*start>joynr.ImmutableMessage<method*end> message) {
if (enableAccessControl<method*start>io.joynr.messaging.routing.CcMessageRouter.enableAccessControl<method*end>) {
accessController.hasConsumerPermission<method*start>io.joynr.accesscontrol.AccessController.hasConsumerPermission<method*end>(message, new HasConsumerPermissionCallback() {
@Override<method*start>java.lang.Override<method*end>
public void hasConsumerPermission(boolean hasPermission) {
if (hasPermission) {
CcMessageRouter<method*start>io.joynr.messaging.routing.CcMessageRouter<method*end>.super.route<method*start>io.joynr.messaging.routing.CcMessageRouter.super.route<method*end>(message);
} else {
logger.warn<method*start>org.slf4j.Logger.warn<method*end>("Dropping message {} from {} to {} because of insufficient access rights", message.getId<method*start>joynr.ImmutableMessage.getId<method*end>(), message.getSender<method*start>joynr.ImmutableMessage.getSender<method*end>(), message.getRecipient<method*start>joynr.ImmutableMessage.getRecipient<method*end>());
}
}
});
} else {
super.route<method*start>io.joynr.messaging.routing.AbstractMessageRouter.route<method*end>(message);
}
}
|
@Nonnull<method*start>javax.annotation.Nonnull<method*end>
@Override<method*start>java.lang.Override<method*end>
public MemberAction<method*start>net.dv8tion.jda.api.requests.restaction.MemberAction<method*end> addMember(@Nonnull<method*start>javax.annotation.Nonnull<method*end> String accessToken, @Nonnull<method*start>javax.annotation.Nonnull<method*end> String userId) {
Checks.notBlank<method*start>net.dv8tion.jda.internal.utils.Checks.notBlank<method*end>(accessToken, "Access-Token");
Checks.isSnowflake<method*start>net.dv8tion.jda.internal.utils.Checks.isSnowflake<method*end>(userId, "User ID");
Checks.check<method*start>net.dv8tion.jda.internal.utils.Checks.check<method*end>(getMemberById(userId) == null, "User is already in this guild");
throw new InsufficientPermissionException(this, Permission.CREATE_INSTANT_INVITE<method*start>net.dv8tion.jda.api.Permission.CREATE_INSTANT_INVITE<method*end>);
return new MemberActionImpl<method*start>net.dv8tion.jda.internal.requests.restaction.MemberActionImpl<method*end>(getJDA<method*start>net.dv8tion.jda.internal.entities.GuildImpl.getJDA<method*end>(), this, userId, accessToken);
}
|
annotation
|
@Nonnull<method*start>javax.annotation.Nonnull<method*end>
@Override<method*start>java.lang.Override<method*end>
public MemberAction<method*start>net.dv8tion.jda.api.requests.restaction.MemberAction<method*end> addMember(@Nonnull<method*start>javax.annotation.Nonnull<method*end> String accessToken, @Nonnull<method*start>javax.annotation.Nonnull<method*end> String userId) {
Checks.notBlank<method*start>net.dv8tion.jda.internal.utils.Checks.notBlank<method*end>(accessToken, "Access-Token");
Checks.isSnowflake<method*start>net.dv8tion.jda.internal.utils.Checks.isSnowflake<method*end>(userId, "User ID");
Checks.check<method*start>net.dv8tion.jda.internal.utils.Checks.check<method*end>(getMemberById(userId) == null, "User is already in this guild");
if (!getSelfMember<method*start>net.dv8tion.jda.internal.entities.GuildImpl.getSelfMember<method*end>().hasPermission<method*start>net.dv8tion.jda.api.entities.Member.hasPermission<method*end>(Permission.CREATE_INSTANT_INVITE<method*start>net.dv8tion.jda.api.Permission.CREATE_INSTANT_INVITE<method*end>))
throw new InsufficientPermissionException(this, Permission.CREATE_INSTANT_INVITE<method*start>net.dv8tion.jda.api.Permission.CREATE_INSTANT_INVITE<method*end>);
return new MemberActionImpl<method*start>net.dv8tion.jda.internal.requests.restaction.MemberActionImpl<method*end>(getJDA<method*start>net.dv8tion.jda.internal.entities.GuildImpl.getJDA<method*end>(), this, userId, accessToken);
}
|
protected void doFilter(HttpServletRequest request, HttpServletResponse response, FilterChain chain) throws IOException, ServletException {
Subject subject = SecurityUtils.getSubject();
try {
Repository repository = getRepository(request);
if (repository != null) {
boolean writeRequest = isWriteRequest(request);
logger.trace("{} access to repository {} for user {} granted", getActionAsString(writeRequest), repository.getName(), getUserName(subject));
chain.doFilter(request, response);
} else {
logger.info("{} access to repository {} for user {} denied", getActionAsString(writeRequest), repository.getName(), getUserName(subject));
sendAccessDenied(request, response, subject);
}
} else {
logger.debug("repository not found");
response.sendError(HttpServletResponse.SC_NOT_FOUND);
}
} catch (ArgumentIsInvalidException ex) {
if (logger.isTraceEnabled()) {
logger.trace("wrong request at ".concat(request.getRequestURI()).concat(" send redirect"), ex);
} else if (logger.isWarnEnabled()) {
logger.warn("wrong request at {} send redirect", request.getRequestURI());
}
response.sendRedirect(getRepositoryRootHelpUrl(request));
} catch (ScmSecurityException ex) {
logger.warn("user " + subject.getPrincipal() + " has not enough permissions", ex);
sendAccessDenied(request, response, subject);
}
}
|
annotation
|
@Override<method*start>java.lang.Override<method*end>
protected void doFilter(HttpServletRequest<method*start>javax.servlet.http.HttpServletRequest<method*end> request, HttpServletResponse<method*start>javax.servlet.http.HttpServletResponse<method*end> response, FilterChain<method*start>javax.servlet.FilterChain<method*end> chain) throws IOException<method*start>java.io.IOException<method*end>, ServletException<method*start>javax.servlet.ServletException<method*end> {
Subject<method*start>org.apache.shiro.subject.Subject<method*end> subject = SecurityUtils.getSubject<method*start>org.apache.shiro.SecurityUtils.getSubject<method*end>();
try {
Repository<method*start>sonia.scm.repository.Repository<method*end> repository = getRepository(request);
if (repository != null) {
boolean writeRequest = isWriteRequest(request);
if (hasPermission<method*start>sonia.scm.web.filter.PermissionFilter.hasPermission<method*end>(repository, writeRequest)) {
logger.trace<method*start>org.slf4j.Logger.trace<method*end>("{} access to repository {} for user {} granted", getActionAsString<method*start>sonia.scm.web.filter.PermissionFilter.getActionAsString<method*end>(writeRequest), repository.getName<method*start>sonia.scm.repository.Repository.getName<method*end>(), getUserName<method*start>sonia.scm.web.filter.PermissionFilter.getUserName<method*end>(subject));
chain.doFilter<method*start>javax.servlet.FilterChain.doFilter<method*end>(request, response);
} else {
logger.info<method*start>org.slf4j.Logger.info<method*end>("{} access to repository {} for user {} denied", getActionAsString<method*start>sonia.scm.web.filter.PermissionFilter.getActionAsString<method*end>(writeRequest), repository.getName<method*start>sonia.scm.repository.Repository.getName<method*end>(), getUserName<method*start>sonia.scm.web.filter.PermissionFilter.getUserName<method*end>(subject));
sendAccessDenied<method*start>sonia.scm.web.filter.PermissionFilter.sendAccessDenied<method*end>(request, response, subject);
}
} else {
logger.debug<method*start>org.slf4j.Logger.debug<method*end>("repository not found");
response.sendError<method*start>javax.servlet.http.HttpServletResponse.sendError<method*end>(HttpServletResponse.SC_NOT_FOUND<method*start>javax.servlet.http.HttpServletResponse.SC_NOT_FOUND<method*end>);
}
} catch (ArgumentIsInvalidException ex) {
if (logger.isTraceEnabled<method*start>org.slf4j.Logger.isTraceEnabled<method*end>()) {
logger.trace<method*start>org.slf4j.Logger.trace<method*end>("wrong request at ".concat<method*start>java.lang.String.concat<method*end>(request.getRequestURI<method*start>javax.servlet.http.HttpServletRequest.getRequestURI<method*end>()).concat<method*start>java.lang.String.concat<method*end>(" send redirect"), ex);
} else if (logger.isWarnEnabled<method*start>org.slf4j.Logger.isWarnEnabled<method*end>()) {
logger.warn<method*start>org.slf4j.Logger.warn<method*end>("wrong request at {} send redirect", request.getRequestURI<method*start>javax.servlet.http.HttpServletRequest.getRequestURI<method*end>());
}
response.sendRedirect<method*start>javax.servlet.http.HttpServletResponse.sendRedirect<method*end>(getRepositoryRootHelpUrl<method*start>sonia.scm.web.filter.PermissionFilter.getRepositoryRootHelpUrl<method*end>(request));
} catch (ScmSecurityException ex) {
logger.warn<method*start>org.slf4j.Logger.warn<method*end>("user " + subject.getPrincipal<method*start>org.apache.shiro.subject.Subject.getPrincipal<method*end>() + " has not enough permissions", ex);
sendAccessDenied<method*start>sonia.scm.web.filter.PermissionFilter.sendAccessDenied<method*end>(request, response, subject);
}
}
|
private void performWithPermissions(final FileAction<method*start>com.dropbox.core.examples.android.FilesActivity.FileAction<method*end> action) {
performAction(action);
return;
}
if (shouldDisplayRationaleForAction<method*start>com.dropbox.core.examples.android.FilesActivity.shouldDisplayRationaleForAction<method*end>(action)) {
new AlertDialog.Builder<method*start>android.support.v7.app.AlertDialog.Builder<method*end>(this).setMessage<method*start>android.support.v7.app.AlertDialog.Builder.setMessage<method*end>("This app requires storage access to download and upload files.").setPositiveButton<method*start>android.support.v7.app.AlertDialog.Builder.setPositiveButton<method*end>("OK", new DialogInterface.OnClickListener<method*start>android.content.DialogInterface.OnClickListener<method*end>() {
@Override<method*start>java.lang.Override<method*end>
public void onClick(DialogInterface<method*start>android.content.DialogInterface<method*end> dialog, int which) {
requestPermissionsForAction<method*start>com.dropbox.core.examples.android.FilesActivity.requestPermissionsForAction<method*end>(action);
}
}).setNegativeButton<method*start>android.support.v7.app.AlertDialog.Builder.setNegativeButton<method*end>("Cancel", null).create<method*start>android.support.v7.app.AlertDialog.Builder.create<method*end>().show<method*start>android.support.v7.app.AlertDialog.Builder.show<method*end>();
} else {
requestPermissionsForAction<method*start>com.dropbox.core.examples.android.FilesActivity.requestPermissionsForAction<method*end>(action);
}
}
|
conventional
|
private void performWithPermissions(final FileAction<method*start>com.dropbox.core.examples.android.FilesActivity.FileAction<method*end> action) {
if (hasPermissionsForAction<method*start>com.dropbox.core.examples.android.FilesActivity.hasPermissionsForAction<method*end>(action)) {
performAction(action);
return;
}
if (shouldDisplayRationaleForAction<method*start>com.dropbox.core.examples.android.FilesActivity.shouldDisplayRationaleForAction<method*end>(action)) {
new AlertDialog.Builder<method*start>android.support.v7.app.AlertDialog.Builder<method*end>(this).setMessage<method*start>android.support.v7.app.AlertDialog.Builder.setMessage<method*end>("This app requires storage access to download and upload files.").setPositiveButton<method*start>android.support.v7.app.AlertDialog.Builder.setPositiveButton<method*end>("OK", new DialogInterface.OnClickListener<method*start>android.content.DialogInterface.OnClickListener<method*end>() {
@Override<method*start>java.lang.Override<method*end>
public void onClick(DialogInterface<method*start>android.content.DialogInterface<method*end> dialog, int which) {
requestPermissionsForAction<method*start>com.dropbox.core.examples.android.FilesActivity.requestPermissionsForAction<method*end>(action);
}
}).setNegativeButton<method*start>android.support.v7.app.AlertDialog.Builder.setNegativeButton<method*end>("Cancel", null).create<method*start>android.support.v7.app.AlertDialog.Builder.create<method*end>().show<method*start>android.support.v7.app.AlertDialog.Builder.show<method*end>();
} else {
requestPermissionsForAction<method*start>com.dropbox.core.examples.android.FilesActivity.requestPermissionsForAction<method*end>(action);
}
}
|
@Nonnull
@Override
public AuditableRestAction<method*start>net.dv8tion.jda.api.requests.restaction.AuditableRestAction<method*end><Void<method*start>java.lang.Void<method*end>> delete() {
if (getGuild<method*start>net.dv8tion.jda.internal.entities.EmoteImpl.getGuild<method*end>() == null)
throw new IllegalStateException<method*start>java.lang.IllegalStateException<method*end>("The emote you are trying to delete is not an actual emote we have access to (it is fake)!");
if (managed<method*start>net.dv8tion.jda.internal.entities.EmoteImpl.managed<method*end>)
throw new UnsupportedOperationException<method*start>java.lang.UnsupportedOperationException<method*end>("You cannot delete a managed emote!");
throw new InsufficientPermissionException(getGuild(), Permission.MANAGE_EMOTES<method*start>net.dv8tion.jda.api.Permission.MANAGE_EMOTES<method*end>);
Route.CompiledRoute<method*start>net.dv8tion.jda.internal.requests.Route.CompiledRoute<method*end> route = Route.Emotes.DELETE_EMOTE.compile<method*start>net.dv8tion.jda.internal.requests.Route.compile<method*end>(getGuild().getId<method*start>net.dv8tion.jda.internal.entities.GuildImpl.getId<method*end>(), getId());
return new AuditableRestActionImpl<method*start>net.dv8tion.jda.internal.requests.restaction.AuditableRestActionImpl<method*end><>(getJDA(), route);
}
|
annotation
|
@Nonnull
@Override
public AuditableRestAction<method*start>net.dv8tion.jda.api.requests.restaction.AuditableRestAction<method*end><Void<method*start>java.lang.Void<method*end>> delete() {
if (getGuild<method*start>net.dv8tion.jda.internal.entities.EmoteImpl.getGuild<method*end>() == null)
throw new IllegalStateException<method*start>java.lang.IllegalStateException<method*end>("The emote you are trying to delete is not an actual emote we have access to (it is fake)!");
if (managed<method*start>net.dv8tion.jda.internal.entities.EmoteImpl.managed<method*end>)
throw new UnsupportedOperationException<method*start>java.lang.UnsupportedOperationException<method*end>("You cannot delete a managed emote!");
if (!getGuild().getSelfMember<method*start>net.dv8tion.jda.internal.entities.GuildImpl.getSelfMember<method*end>().hasPermission<method*start>net.dv8tion.jda.api.entities.Member.hasPermission<method*end>(Permission.MANAGE_EMOTES<method*start>net.dv8tion.jda.api.Permission.MANAGE_EMOTES<method*end>))
throw new InsufficientPermissionException(getGuild(), Permission.MANAGE_EMOTES<method*start>net.dv8tion.jda.api.Permission.MANAGE_EMOTES<method*end>);
Route.CompiledRoute<method*start>net.dv8tion.jda.internal.requests.Route.CompiledRoute<method*end> route = Route.Emotes.DELETE_EMOTE.compile<method*start>net.dv8tion.jda.internal.requests.Route.compile<method*end>(getGuild().getId<method*start>net.dv8tion.jda.internal.entities.GuildImpl.getId<method*end>(), getId());
return new AuditableRestActionImpl<method*start>net.dv8tion.jda.internal.requests.restaction.AuditableRestActionImpl<method*end><>(getJDA(), route);
}
|
public void configure(HttpSecurity<method*start>org.springframework.security.config.annotation.web.builders.HttpSecurity<method*end> http) throws Exception<method*start>java.lang.Exception<method*end> {
PassportSsoProperties<method*start>com.github.vole.passport.common.config.PassportSsoProperties<method*end> sso = this.applicationContext.getBean<method*start>org.springframework.context.ApplicationContext.getBean<method*end>(PassportSsoProperties<method*start>com.github.vole.passport.common.config.PassportSsoProperties<method*end>.class);
http.csrf<method*start>org.springframework.security.config.annotation.web.builders.HttpSecurity.csrf<method*end>().disable<method*start>org.springframework.security.config.annotation.web.configurers.CsrfConfigurer.disable<method*end>();
http.headers<method*start>org.springframework.security.config.annotation.web.builders.HttpSecurity.headers<method*end>().frameOptions<method*start>org.springframework.security.config.annotation.web.configurers.HeadersConfigurer.frameOptions<method*end>().disable();
// 去除security session管理
http.sessionManagement<method*start>org.springframework.security.config.annotation.web.builders.HttpSecurity.sessionManagement<method*end>().disable<method*start>org.springframework.security.config.annotation.web.configurers.SessionManagementConfigurer.disable<method*end>();
http.securityContext<method*start>org.springframework.security.config.annotation.web.builders.HttpSecurity.securityContext<method*end>().disable<method*start>org.springframework.security.config.annotation.web.configurers.SecurityContextConfigurer.disable<method*end>();
http.requestCache<method*start>org.springframework.security.config.annotation.web.builders.HttpSecurity.requestCache<method*end>().disable<method*start>org.springframework.security.config.annotation.web.configurers.RequestCacheConfigurer.disable<method*end>();
http.rememberMe<method*start>org.springframework.security.config.annotation.web.builders.HttpSecurity.rememberMe<method*end>().disable<method*start>org.springframework.security.config.annotation.web.configurers.RememberMeConfigurer.disable<method*end>();
http.apply<method*start>org.springframework.security.config.annotation.web.builders.HttpSecurity.apply<method*end>(new PassportClientAuthConfigurer<method*start>com.github.vole.passport.common.config.PassportSsoSecurityConfigurer.PassportClientAuthConfigurer<method*end>(authFilter<method*start>com.github.vole.passport.common.config.PassportSsoSecurityConfigurer.authFilter<method*end>(sso), ssoFilter<method*start>com.github.vole.passport.common.config.PassportSsoSecurityConfigurer.ssoFilter<method*end>(sso)));
addAuthenticationEntryPoint<method*start>com.github.vole.passport.common.config.PassportSsoSecurityConfigurer.addAuthenticationEntryPoint<method*end>(http, sso);
addLogoutSuccessHandler<method*start>com.github.vole.passport.common.config.PassportSsoSecurityConfigurer.addLogoutSuccessHandler<method*end>(http, sso);
String<method*start>java.lang.String<method*end>[] permissions = applicationContext.getBeanNamesForType<method*start>org.springframework.context.ApplicationContext.getBeanNamesForType<method*end>(AccessPermission<method*start>com.github.vole.passport.common.permission.AccessPermission<method*end>.class);
http.authorizeRequests<method*start>org.springframework.security.config.annotation.web.builders.HttpSecurity.authorizeRequests<method*end>().anyRequest<method*start>org.springframework.security.config.annotation.web.configurers.ExpressionUrlAuthorizationConfigurer<org.springframework.security.config.annotation.web.builders.HttpSecurity>.ExpressionInterceptUrlRegistry.anyRequest<method*end>().access(call);
}
}
|
conventional
|
public void configure(HttpSecurity<method*start>org.springframework.security.config.annotation.web.builders.HttpSecurity<method*end> http) throws Exception<method*start>java.lang.Exception<method*end> {
PassportSsoProperties<method*start>com.github.vole.passport.common.config.PassportSsoProperties<method*end> sso = this.applicationContext.getBean<method*start>org.springframework.context.ApplicationContext.getBean<method*end>(PassportSsoProperties<method*start>com.github.vole.passport.common.config.PassportSsoProperties<method*end>.class);
http.csrf<method*start>org.springframework.security.config.annotation.web.builders.HttpSecurity.csrf<method*end>().disable<method*start>org.springframework.security.config.annotation.web.configurers.CsrfConfigurer.disable<method*end>();
http.headers<method*start>org.springframework.security.config.annotation.web.builders.HttpSecurity.headers<method*end>().frameOptions<method*start>org.springframework.security.config.annotation.web.configurers.HeadersConfigurer.frameOptions<method*end>().disable();
// 去除security session管理
http.sessionManagement<method*start>org.springframework.security.config.annotation.web.builders.HttpSecurity.sessionManagement<method*end>().disable<method*start>org.springframework.security.config.annotation.web.configurers.SessionManagementConfigurer.disable<method*end>();
http.securityContext<method*start>org.springframework.security.config.annotation.web.builders.HttpSecurity.securityContext<method*end>().disable<method*start>org.springframework.security.config.annotation.web.configurers.SecurityContextConfigurer.disable<method*end>();
http.requestCache<method*start>org.springframework.security.config.annotation.web.builders.HttpSecurity.requestCache<method*end>().disable<method*start>org.springframework.security.config.annotation.web.configurers.RequestCacheConfigurer.disable<method*end>();
http.rememberMe<method*start>org.springframework.security.config.annotation.web.builders.HttpSecurity.rememberMe<method*end>().disable<method*start>org.springframework.security.config.annotation.web.configurers.RememberMeConfigurer.disable<method*end>();
http.apply<method*start>org.springframework.security.config.annotation.web.builders.HttpSecurity.apply<method*end>(new PassportClientAuthConfigurer<method*start>com.github.vole.passport.common.config.PassportSsoSecurityConfigurer.PassportClientAuthConfigurer<method*end>(authFilter<method*start>com.github.vole.passport.common.config.PassportSsoSecurityConfigurer.authFilter<method*end>(sso), ssoFilter<method*start>com.github.vole.passport.common.config.PassportSsoSecurityConfigurer.ssoFilter<method*end>(sso)));
addAuthenticationEntryPoint<method*start>com.github.vole.passport.common.config.PassportSsoSecurityConfigurer.addAuthenticationEntryPoint<method*end>(http, sso);
addLogoutSuccessHandler<method*start>com.github.vole.passport.common.config.PassportSsoSecurityConfigurer.addLogoutSuccessHandler<method*end>(http, sso);
String<method*start>java.lang.String<method*end>[] permissions = applicationContext.getBeanNamesForType<method*start>org.springframework.context.ApplicationContext.getBeanNamesForType<method*end>(AccessPermission<method*start>com.github.vole.passport.common.permission.AccessPermission<method*end>.class);
if (permissions != null && permissions.length<method*start>java.lang.String[].length<method*end> > 0) {
String<method*start>java.lang.String<method*end> beanName = permissions[0];
String<method*start>java.lang.String<method*end> call = "@" + beanName + "." + "hasPermission(request,authentication)";
http.authorizeRequests<method*start>org.springframework.security.config.annotation.web.builders.HttpSecurity.authorizeRequests<method*end>().anyRequest<method*start>org.springframework.security.config.annotation.web.configurers.ExpressionUrlAuthorizationConfigurer<org.springframework.security.config.annotation.web.builders.HttpSecurity>.ExpressionInterceptUrlRegistry.anyRequest<method*end>().access(call);
}
}
|
@Override
public void onRequestPermissionsResult(int requestCode, String[] permissions, int[] grantResults) {
switch(requestCode) {
case ALL_PERMISSIONS_RESULT:
for (String perms : permissionsToRequest) {
、 permissionsRejected.add(perms);
}
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
showMessageOKCancel("These permissions are mandatory for the application. Please allow access.", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
requestPermissions(permissionsRejected.toArray(new String[permissionsRejected.size()]), ALL_PERMISSIONS_RESULT);
}
}
});
return;
}
}
}
break;
}
}
|
annotation
|
@TargetApi<method*start>android.annotation.TargetApi<method*end>(Build.VERSION_CODES.M<method*start>android.os.Build.VERSION_CODES.M<method*end>)
@Override<method*start>java.lang.Override<method*end>
public void onRequestPermissionsResult(int requestCode, String<method*start>java.lang.String<method*end>[] permissions, int[] grantResults) {
switch(requestCode) {
case ALL_PERMISSIONS_RESULT<method*start>com.journaldev.androidfileprovidercameragallery.MainActivity.ALL_PERMISSIONS_RESULT<method*end>:
for (String<method*start>java.lang.String<method*end> perms : permissionsToRequest) {
if (!hasPermission(perms)) {
permissionsRejected.add<method*start>java.util.ArrayList.add<method*end>(perms);
}
}
if (permissionsRejected.size<method*start>java.util.ArrayList.size<method*end>() > 0) {
if (Build.VERSION.SDK_INT<method*start>android.os.Build.VERSION.SDK_INT<method*end> >= Build.VERSION_CODES.M<method*start>android.os.Build.VERSION_CODES.M<method*end>) {
if (shouldShowRequestPermissionRationale<method*start>android.support.v7.app.AppCompatActivity.shouldShowRequestPermissionRationale<method*end>(permissionsRejected.get<method*start>java.util.ArrayList.get<method*end>(0))) {
showMessageOKCancel("These permissions are mandatory for the application. Please allow access.", new DialogInterface.OnClickListener<method*start>android.content.DialogInterface.OnClickListener<method*end>() {
@Override<method*start>java.lang.Override<method*end>
public void onClick(DialogInterface<method*start>android.content.DialogInterface<method*end> dialog, int which) {
if (Build.VERSION.SDK_INT<method*start>android.os.Build.VERSION.SDK_INT<method*end> >= Build.VERSION_CODES.M<method*start>android.os.Build.VERSION_CODES.M<method*end>) {
requestPermissions<method*start>android.support.v7.app.AppCompatActivity.requestPermissions<method*end>(permissionsRejected.toArray<method*start>java.util.ArrayList.toArray<method*end>(new String<method*start>java.lang.String<method*end>[permissionsRejected.size<method*start>java.util.ArrayList.size<method*end>()]), ALL_PERMISSIONS_RESULT);
}
}
});
return;
}
}
}
break;
}
}
|
public static Map<java.util.Map<String, Object>> checkCopyPermission(DispatchContext ctx, Map<String, ?> context) {
boolean hasPermission = false;
GenericValue userLogin = (GenericValue) context.get("userLogin");
if (userLogin != null) {
String userLoginId = userLogin.getString("userLoginId");
// is an optional parameters which defaults to the logged on user
String userLoginIdArg = (String) context.get(LOGINID_PARAMETER_NAME);
// users can copy to their own preferences
hasPermission = true;
} else {
Security security = ctx.getSecurity();
hasPermission = security.hasPermission(ADMIN_PERMISSION, userLogin);
}
}
Map<String, Object> result = ServiceUtil.returnSuccess();
result.put("hasPermission", hasPermission);
return result;
}
|
conventional
|
public static Map<method*start>java.util.Map<method*end><String<method*start>java.lang.String<method*end>, Object<method*start>java.lang.Object<method*end>> checkCopyPermission(DispatchContext<method*start>org.apache.ofbiz.service.DispatchContext<method*end> ctx, Map<method*start>java.util.Map<method*end><String<method*start>java.lang.String<method*end>, ?> context) {
boolean hasPermission = false;
GenericValue<method*start>org.apache.ofbiz.entity.GenericValue<method*end> userLogin = (GenericValue<method*start>org.apache.ofbiz.entity.GenericValue<method*end>) context.get<method*start>java.util.Map.get<method*end>("userLogin");
if (userLogin != null) {
String<method*start>java.lang.String<method*end> userLoginId = userLogin.getString<method*start>org.apache.ofbiz.entity.GenericEntity.getString<method*end>("userLoginId");
// is an optional parameters which defaults to the logged on user
String<method*start>java.lang.String<method*end> userLoginIdArg = (String<method*start>java.lang.String<method*end>) context.get<method*start>java.util.Map.get<method*end>(LOGINID_PARAMETER_NAME);
if (userLoginIdArg == null || (userLoginIdArg != null && userLoginId.equals<method*start>java.lang.String.equals<method*end>(userLoginIdArg))) {
// users can copy to their own preferences
hasPermission = true;
} else {
Security<method*start>org.apache.ofbiz.security.Security<method*end> security = ctx.getSecurity<method*start>org.apache.ofbiz.service.DispatchContext.getSecurity<method*end>();
hasPermission = security.hasPermission<method*start>org.apache.ofbiz.security.Security.hasPermission<method*end>(ADMIN_PERMISSION, userLogin);
}
}
Map<method*start>java.util.Map<method*end><String<method*start>java.lang.String<method*end>, Object<method*start>java.lang.Object<method*end>> result = ServiceUtil.returnSuccess<method*start>org.apache.ofbiz.service.ServiceUtil.returnSuccess<method*end>();
result.put<method*start>java.util.Map.put<method*end>("hasPermission", hasPermission);
return result;
}
|
private boolean isUserHasAllRealmUpdPermissionsForGroupLevels() {
boolean hasPermission = true;
this.realmItems<method*start>org.sakaiproject.signup.tool.jsf.SignupPermissionsUpdateBean.realmItems<method*end> = getCurrentSiteRealmItems();
/* One group in the site is the minimum requirement */
if (realmItems == null || realmItems.size<method*start>java.util.List.size<method*end>() < 2)
return false;
/* Check if the realm.upd exist in all levels */
for (Iterator<method*start>java.util.Iterator<method*end> iterator = realmItems.iterator<method*start>java.util.List.iterator<method*end>(); iterator.hasNext<method*start>java.util.Iterator.hasNext<method*end>(); ) {
RealmItem item = (RealmItem) iterator.next<method*start>java.util.Iterator.next<method*end>();
hasPermission = false;
break;
}
}
return hasPermission;
}
|
conventional
|
private boolean isUserHasAllRealmUpdPermissionsForGroupLevels() {
boolean hasPermission = true;
this.realmItems<method*start>org.sakaiproject.signup.tool.jsf.SignupPermissionsUpdateBean.realmItems<method*end> = getCurrentSiteRealmItems();
/* One group in the site is the minimum requirement */
if (realmItems == null || realmItems.size<method*start>java.util.List.size<method*end>() < 2)
return false;
/* Check if the realm.upd exist in all levels */
for (Iterator<method*start>java.util.Iterator<method*end> iterator = realmItems.iterator<method*start>java.util.List.iterator<method*end>(); iterator.hasNext<method*start>java.util.Iterator.hasNext<method*end>(); ) {
RealmItem item = (RealmItem) iterator.next<method*start>java.util.Iterator.next<method*end>();
if (!item.isAllowedUpd<method*start>org.sakaiproject.signup.tool.jsf.RealmItem.isAllowedUpd<method*end>()) {
hasPermission = false;
break;
}
}
return hasPermission;
}
|
default boolean canAttachFiles(User user) {
Optional<PrivateChannel> privateChannel = asPrivateChannel();
return user.isYourself() || privateChannel.get().getRecipient() == user;
Optional<GroupChannel> groupChannel = asGroupChannel();
return user.isYourself() || groupChannel.get().getMembers().contains(user);
Optional<ServerTextChannel> severTextChannel = asServerTextChannel();
return !severTextChannel.isPresent() || severTextChannel.get().hasPermission(user, PermissionType.ADMINISTRATOR) || (severTextChannel.get().hasPermission(user, PermissionType.ATTACH_FILE) && severTextChannel.get().canWrite(user));
}
|
conventional
|
default boolean canAttachFiles(User<method*start>org.javacord.api.entity.user.User<method*end> user) {
Optional<method*start>java.util.Optional<method*end><PrivateChannel> privateChannel = asPrivateChannel();
if (privateChannel.isPresent()) {
return user.isYourself() || privateChannel.get().getRecipient() == user;
}
Optional<method*start>java.util.Optional<method*end><GroupChannel> groupChannel = asGroupChannel();
if (groupChannel.isPresent()) {
return user.isYourself() || groupChannel.get().getMembers().contains(user);
}
Optional<method*start>java.util.Optional<method*end><ServerTextChannel> severTextChannel = asServerTextChannel();
return !severTextChannel.isPresent() || severTextChannel.get().hasPermission(user, PermissionType<method*start>org.javacord.api.entity.permission.PermissionType<method*end>.ADMINISTRATOR) || (severTextChannel.get().hasPermission(user, PermissionType<method*start>org.javacord.api.entity.permission.PermissionType<method*end>.ATTACH_FILE) && severTextChannel.get().canWrite(user));
}
|
public int doStartTag() throws JspException {
initializeIfRequired();
if (domainObject == null) {
if (logger.isDebugEnabled()) {
logger.debug("domainObject resolved to null, so including tag body");
}
// Of course they have access to a null object!
return evalBody();
}
Authentication authentication = SecurityContextHolder.getContext().getAuthentication();
if (logger.isDebugEnabled()) {
logger.debug("SecurityContextHolder did not return a non-null Authentication object, so skipping tag body");
}
return skipBody();
List<Object> requiredPermissions = parseHasPermission(hasPermission);
for (Object requiredPermission : requiredPermissions) {
}
}
return evalBody();
}
|
conventional
|
public int doStartTag() throws JspException<method*start>javax.servlet.jsp.JspException<method*end> {
if ((null == hasPermission<method*start>org.springframework.security.taglibs.authz.AccessControlListTag.hasPermission<method*end>) || "".equals<method*start>java.lang.String.equals<method*end>(hasPermission)) {
return skipBody<method*start>org.springframework.security.taglibs.authz.AccessControlListTag.skipBody<method*end>();
}
initializeIfRequired<method*start>org.springframework.security.taglibs.authz.AccessControlListTag.initializeIfRequired<method*end>();
if (domainObject == null) {
if (logger.isDebugEnabled<method*start>org.apache.commons.logging.Log.isDebugEnabled<method*end>()) {
logger.debug<method*start>org.apache.commons.logging.Log.debug<method*end>("domainObject resolved to null, so including tag body");
}
// Of course they have access to a null object!
return evalBody<method*start>org.springframework.security.taglibs.authz.AccessControlListTag.evalBody<method*end>();
}
Authentication<method*start>org.springframework.security.core.Authentication<method*end> authentication = SecurityContextHolder.getContext<method*start>org.springframework.security.core.context.SecurityContextHolder.getContext<method*end>().getAuthentication<method*start>org.springframework.security.core.context.SecurityContext.getAuthentication<method*end>();
if (authentication == null) {
if (logger.isDebugEnabled<method*start>org.apache.commons.logging.Log.isDebugEnabled<method*end>()) {
logger.debug<method*start>org.apache.commons.logging.Log.debug<method*end>("SecurityContextHolder did not return a non-null Authentication object, so skipping tag body");
}
return skipBody<method*start>org.springframework.security.taglibs.authz.AccessControlListTag.skipBody<method*end>();
}
List<method*start>java.util.List<method*end><Object<method*start>java.lang.Object<method*end>> requiredPermissions = parseHasPermission<method*start>org.springframework.security.taglibs.authz.AccessControlListTag.parseHasPermission<method*end>(hasPermission);
for (Object<method*start>java.lang.Object<method*end> requiredPermission : requiredPermissions) {
if (!permissionEvaluator.hasPermission<method*start>org.springframework.security.access.PermissionEvaluator.hasPermission<method*end>(authentication, domainObject, requiredPermission)) {
return skipBody<method*start>org.springframework.security.taglibs.authz.AccessControlListTag.skipBody<method*end>();
}
}
return evalBody<method*start>org.springframework.security.taglibs.authz.AccessControlListTag.evalBody<method*end>();
}
|
public static void setDefault(TimeZone zone) {
synchronized (TimeZone.class) {
defaultTimeZone = zone;
setDefaultInAppContext(null);
}
} else {
setDefaultInAppContext(zone);
}
|
conventional
|
public static void setDefault(TimeZone<method*start>java.util.TimeZone<method*end> zone) {
if (hasPermission<method*start>java.util.TimeZone.hasPermission<method*end>()) {
synchronized (TimeZone<method*start>java.util.TimeZone<method*end>.class) {
defaultTimeZone<method*start>java.util.TimeZone.defaultTimeZone<method*end> = zone;
setDefaultInAppContext<method*start>java.util.TimeZone.setDefaultInAppContext<method*end>(null);
}
} else {
setDefaultInAppContext<method*start>java.util.TimeZone.setDefaultInAppContext<method*end>(zone);
}
}
|
@Override
public ItemStack<method*start>net.minecraft.item.ItemStack<method*end> slotClick(int slotId, int dragType, ClickType<method*start>net.minecraft.inventory.ClickType<method*end> clickTypeIn, EntityPlayer<method*start>net.minecraft.entity.player.EntityPlayer<method*end> player) {
ItemStack<method*start>net.minecraft.item.ItemStack<method*end> returnStack = null;
boolean hasPermission = true;
if (slotId == 0 || slotId == 1) {
ItemStack<method*start>net.minecraft.item.ItemStack<method*end> stack = player.inventory.getItemStack();
if (stack == null || stack.isEmpty()) {
} else {
} else {
ItemStack<method*start>net.minecraft.item.ItemStack<method*end> slotStack = this.inventorySlots.get(slotId).getStack();
if (slotStack == null || slotStack.isEmpty()) {
returnStack = ItemStack<method*start>net.minecraft.item.ItemStack<method*end>.EMPTY;
} else {
returnStack = slotStack.copy();
}
hasPermission = false;
}
}
}
if (player instanceof EntityPlayerMP<method*start>net.minecraft.entity.player.EntityPlayerMP<method*end>) {
EntityPlayerMP<method*start>net.minecraft.entity.player.EntityPlayerMP<method*end> p = (EntityPlayerMP<method*start>net.minecraft.entity.player.EntityPlayerMP<method*end>) player;
p.sendContainerToPlayer(this);
}
return returnStack;
}
|
annotation
|
@Nullable<method*start>javax.annotation.Nullable<method*end>
@Override
public ItemStack<method*start>net.minecraft.item.ItemStack<method*end> slotClick(int slotId, int dragType, ClickType<method*start>net.minecraft.inventory.ClickType<method*end> clickTypeIn, EntityPlayer<method*start>net.minecraft.entity.player.EntityPlayer<method*end> player) {
ItemStack<method*start>net.minecraft.item.ItemStack<method*end> returnStack = null;
boolean hasPermission = true;
if (slotId == 0 || slotId == 1) {
ItemStack<method*start>net.minecraft.item.ItemStack<method*end> stack = player.inventory.getItemStack();
if (stack == null || stack.isEmpty()) {
} else {
if (type.isEmpty(stack) && PermissionUtil<method*start>extracells.util.PermissionUtil<method*end>.hasPermission(player, SecurityPermissions<method*start>appeng.api.config.SecurityPermissions<method*end>.INJECT, (IPart<method*start>appeng.api.parts.IPart<method*end>) getTerminal())) {
} else if (type.isFilled(stack) && PermissionUtil<method*start>extracells.util.PermissionUtil<method*end>.hasPermission(player, SecurityPermissions<method*start>appeng.api.config.SecurityPermissions<method*end>.EXTRACT, (IPart<method*start>appeng.api.parts.IPart<method*end>) getTerminal())) {
} else {
ItemStack<method*start>net.minecraft.item.ItemStack<method*end> slotStack = this.inventorySlots.get(slotId).getStack();
if (slotStack == null || slotStack.isEmpty()) {
returnStack = ItemStack<method*start>net.minecraft.item.ItemStack<method*end>.EMPTY;
} else {
returnStack = slotStack.copy();
}
hasPermission = false;
}
}
}
if (hasPermission) {
returnStack = super.slotClick(slotId, dragType, clickTypeIn, player);
}
if (player instanceof EntityPlayerMP<method*start>net.minecraft.entity.player.EntityPlayerMP<method*end>) {
EntityPlayerMP<method*start>net.minecraft.entity.player.EntityPlayerMP<method*end> p = (EntityPlayerMP<method*start>net.minecraft.entity.player.EntityPlayerMP<method*end>) player;
p.sendContainerToPlayer(this);
}
return returnStack;
}
|
public int doStartTag() throws JspException<method*start>javax.servlet.jsp.JspException<method*end> {
if ((null == hasPermission<method*start>org.springframework.security.taglibs.authz.AccessControlListTag.hasPermission<method*end>) || "".equals<method*start>java.lang.String.equals<method*end>(hasPermission)) {
return skipBody<method*start>org.springframework.security.taglibs.authz.AccessControlListTag.skipBody<method*end>();
}
initializeIfRequired<method*start>org.springframework.security.taglibs.authz.AccessControlListTag.initializeIfRequired<method*end>();
if (domainObject == null) {
if (logger.isDebugEnabled<method*start>org.apache.commons.logging.Log.isDebugEnabled<method*end>()) {
logger.debug<method*start>org.apache.commons.logging.Log.debug<method*end>("domainObject resolved to null, so including tag body");
}
// Of course they have access to a null object!
return evalBody<method*start>org.springframework.security.taglibs.authz.AccessControlListTag.evalBody<method*end>();
}
Authentication<method*start>org.springframework.security.core.Authentication<method*end> authentication = SecurityContextHolder.getContext<method*start>org.springframework.security.core.context.SecurityContextHolder.getContext<method*end>().getAuthentication<method*start>org.springframework.security.core.context.SecurityContext.getAuthentication<method*end>();
if (authentication == null) {
if (logger.isDebugEnabled<method*start>org.apache.commons.logging.Log.isDebugEnabled<method*end>()) {
logger.debug<method*start>org.apache.commons.logging.Log.debug<method*end>("SecurityContextHolder did not return a non-null Authentication object, so skipping tag body");
}
return skipBody<method*start>org.springframework.security.taglibs.authz.AccessControlListTag.skipBody<method*end>();
}
List<method*start>java.util.List<method*end><Object<method*start>java.lang.Object<method*end>> requiredPermissions = parseHasPermission<method*start>org.springframework.security.taglibs.authz.AccessControlListTag.parseHasPermission<method*end>(hasPermission);
for (Object<method*start>java.lang.Object<method*end> requiredPermission : requiredPermissions) {
return skipBody<method*start>org.springframework.security.taglibs.authz.AccessControlListTag.skipBody<method*end>();
}
}
return evalBody<method*start>org.springframework.security.taglibs.authz.AccessControlListTag.evalBody<method*end>();
}
|
conventional
|
public int doStartTag() throws JspException<method*start>javax.servlet.jsp.JspException<method*end> {
if ((null == hasPermission<method*start>org.springframework.security.taglibs.authz.AccessControlListTag.hasPermission<method*end>) || "".equals<method*start>java.lang.String.equals<method*end>(hasPermission)) {
return skipBody<method*start>org.springframework.security.taglibs.authz.AccessControlListTag.skipBody<method*end>();
}
initializeIfRequired<method*start>org.springframework.security.taglibs.authz.AccessControlListTag.initializeIfRequired<method*end>();
if (domainObject == null) {
if (logger.isDebugEnabled<method*start>org.apache.commons.logging.Log.isDebugEnabled<method*end>()) {
logger.debug<method*start>org.apache.commons.logging.Log.debug<method*end>("domainObject resolved to null, so including tag body");
}
// Of course they have access to a null object!
return evalBody<method*start>org.springframework.security.taglibs.authz.AccessControlListTag.evalBody<method*end>();
}
Authentication<method*start>org.springframework.security.core.Authentication<method*end> authentication = SecurityContextHolder.getContext<method*start>org.springframework.security.core.context.SecurityContextHolder.getContext<method*end>().getAuthentication<method*start>org.springframework.security.core.context.SecurityContext.getAuthentication<method*end>();
if (authentication == null) {
if (logger.isDebugEnabled<method*start>org.apache.commons.logging.Log.isDebugEnabled<method*end>()) {
logger.debug<method*start>org.apache.commons.logging.Log.debug<method*end>("SecurityContextHolder did not return a non-null Authentication object, so skipping tag body");
}
return skipBody<method*start>org.springframework.security.taglibs.authz.AccessControlListTag.skipBody<method*end>();
}
List<method*start>java.util.List<method*end><Object<method*start>java.lang.Object<method*end>> requiredPermissions = parseHasPermission<method*start>org.springframework.security.taglibs.authz.AccessControlListTag.parseHasPermission<method*end>(hasPermission);
for (Object<method*start>java.lang.Object<method*end> requiredPermission : requiredPermissions) {
if (!permissionEvaluator.hasPermission<method*start>org.springframework.security.access.PermissionEvaluator.hasPermission<method*end>(authentication, domainObject, requiredPermission)) {
return skipBody<method*start>org.springframework.security.taglibs.authz.AccessControlListTag.skipBody<method*end>();
}
}
return evalBody<method*start>org.springframework.security.taglibs.authz.AccessControlListTag.evalBody<method*end>();
}
|
@Override
public void setMyLocationEnabled(boolean myLocation) throws RemoteException<method*start>android.os.RemoteException<method*end> {
Log.w<method*start>android.util.Log.w<method*end>(TAG, "MyLocation not yet supported");
boolean hasPermission = ContextCompat.checkSelfPermission<method*start>android.support.v4.content.ContextCompat.checkSelfPermission<method*end>(context, ACCESS_COARSE_LOCATION<method*start>android.Manifest.permission.ACCESS_COARSE_LOCATION<method*end>) == PERMISSION_GRANTED<method*start>android.content.pm.PackageManager.PERMISSION_GRANTED<method*end> || ContextCompat.checkSelfPermission<method*start>android.support.v4.content.ContextCompat.checkSelfPermission<method*end>(context, ACCESS_FINE_LOCATION<method*start>android.Manifest.permission.ACCESS_FINE_LOCATION<method*end>) == PERMISSION_GRANTED<method*start>android.content.pm.PackageManager.PERMISSION_GRANTED<method*end>;
throw new SecurityException<method*start>java.lang.SecurityException<method*end>("Neither " + ACCESS_COARSE_LOCATION<method*start>android.Manifest.permission.ACCESS_COARSE_LOCATION<method*end> + " nor " + ACCESS_FINE_LOCATION<method*start>android.Manifest.permission.ACCESS_FINE_LOCATION<method*end> + " granted.");
LocationManager<method*start>android.location.LocationManager<method*end> locationManager = (LocationManager<method*start>android.location.LocationManager<method*end>) context.getSystemService<method*start>android.content.Context.getSystemService<method*end>(Context.LOCATION_SERVICE<method*start>android.content.Context.LOCATION_SERVICE<method*end>);
if (myLocation) {
locationManager.requestLocationUpdates<method*start>android.location.LocationManager.requestLocationUpdates<method*end>(5000, 10, criteria, listener, Looper.getMainLooper<method*start>android.os.Looper.getMainLooper<method*end>());
} else {
locationManager.removeUpdates<method*start>android.location.LocationManager.removeUpdates<method*end>(listener);
}
}
|
annotation
|
@Override
public void setMyLocationEnabled(boolean myLocation) throws RemoteException<method*start>android.os.RemoteException<method*end> {
Log.w<method*start>android.util.Log.w<method*end>(TAG, "MyLocation not yet supported");
boolean hasPermission = ContextCompat.checkSelfPermission<method*start>android.support.v4.content.ContextCompat.checkSelfPermission<method*end>(context, ACCESS_COARSE_LOCATION<method*start>android.Manifest.permission.ACCESS_COARSE_LOCATION<method*end>) == PERMISSION_GRANTED<method*start>android.content.pm.PackageManager.PERMISSION_GRANTED<method*end> || ContextCompat.checkSelfPermission<method*start>android.support.v4.content.ContextCompat.checkSelfPermission<method*end>(context, ACCESS_FINE_LOCATION<method*start>android.Manifest.permission.ACCESS_FINE_LOCATION<method*end>) == PERMISSION_GRANTED<method*start>android.content.pm.PackageManager.PERMISSION_GRANTED<method*end>;
if (!hasPermission) {
throw new SecurityException<method*start>java.lang.SecurityException<method*end>("Neither " + ACCESS_COARSE_LOCATION<method*start>android.Manifest.permission.ACCESS_COARSE_LOCATION<method*end> + " nor " + ACCESS_FINE_LOCATION<method*start>android.Manifest.permission.ACCESS_FINE_LOCATION<method*end> + " granted.");
}
LocationManager<method*start>android.location.LocationManager<method*end> locationManager = (LocationManager<method*start>android.location.LocationManager<method*end>) context.getSystemService<method*start>android.content.Context.getSystemService<method*end>(Context.LOCATION_SERVICE<method*start>android.content.Context.LOCATION_SERVICE<method*end>);
if (myLocation) {
locationManager.requestLocationUpdates<method*start>android.location.LocationManager.requestLocationUpdates<method*end>(5000, 10, criteria, listener, Looper.getMainLooper<method*start>android.os.Looper.getMainLooper<method*end>());
} else {
locationManager.removeUpdates<method*start>android.location.LocationManager.removeUpdates<method*end>(listener);
}
}
|
@TargetApi<method*start>android.annotation.TargetApi<method*end>(Build.VERSION_CODES.N<method*start>android.os.Build.VERSION_CODES.N<method*end>)
private static boolean isConnected(Context<method*start>android.content.Context<method*end> context) {
try {
int hasPermission = context.checkCallingOrSelfPermission<method*start>android.content.Context.checkCallingOrSelfPermission<method*end>(Manifest.permission.ACCESS_NETWORK_STATE<method*start>android.Manifest.permission.ACCESS_NETWORK_STATE<method*end>);
Log.w<method*start>android.util.Log.w<method*end>(TAG, "android.Manifest.permission.ACCESS_NETWORK_STATE is not granted.");
} else {
ConnectivityManager<method*start>android.net.ConnectivityManager<method*end> connectivityManager = (ConnectivityManager<method*start>android.net.ConnectivityManager<method*end>) context.getSystemService<method*start>android.content.Context.getSystemService<method*end>(Context.CONNECTIVITY_SERVICE<method*start>android.content.Context.CONNECTIVITY_SERVICE<method*end>);
final NetworkInfo<method*start>android.net.NetworkInfo<method*end> networkInfo = connectivityManager.getActiveNetworkInfo<method*start>android.net.ConnectivityManager.getActiveNetworkInfo<method*end>();
if (null != networkInfo && networkInfo.isConnected<method*start>android.net.NetworkInfo.isConnected<method*end>()) {
return true;
}
}
} catch (Exception<method*start>java.lang.Exception<method*end> ex) {
Log.w<method*start>android.util.Log.w<method*end>(TAG, "failed to detect networking status.", ex);
}
return false;
}
|
annotation
|
@TargetApi<method*start>android.annotation.TargetApi<method*end>(Build.VERSION_CODES.N<method*start>android.os.Build.VERSION_CODES.N<method*end>)
private static boolean isConnected(Context<method*start>android.content.Context<method*end> context) {
try {
int hasPermission = context.checkCallingOrSelfPermission<method*start>android.content.Context.checkCallingOrSelfPermission<method*end>(Manifest.permission.ACCESS_NETWORK_STATE<method*start>android.Manifest.permission.ACCESS_NETWORK_STATE<method*end>);
if (PackageManager.PERMISSION_GRANTED<method*start>android.content.pm.PackageManager.PERMISSION_GRANTED<method*end> != hasPermission) {
Log.w<method*start>android.util.Log.w<method*end>(TAG, "android.Manifest.permission.ACCESS_NETWORK_STATE is not granted.");
} else {
ConnectivityManager<method*start>android.net.ConnectivityManager<method*end> connectivityManager = (ConnectivityManager<method*start>android.net.ConnectivityManager<method*end>) context.getSystemService<method*start>android.content.Context.getSystemService<method*end>(Context.CONNECTIVITY_SERVICE<method*start>android.content.Context.CONNECTIVITY_SERVICE<method*end>);
final NetworkInfo<method*start>android.net.NetworkInfo<method*end> networkInfo = connectivityManager.getActiveNetworkInfo<method*start>android.net.ConnectivityManager.getActiveNetworkInfo<method*end>();
if (null != networkInfo && networkInfo.isConnected<method*start>android.net.NetworkInfo.isConnected<method*end>()) {
return true;
}
}
} catch (Exception<method*start>java.lang.Exception<method*end> ex) {
Log.w<method*start>android.util.Log.w<method*end>(TAG, "failed to detect networking status.", ex);
}
return false;
}
|
@CloseDBIfOpened
List<method*start>java.util.List<method*end><WorkflowAction<method*start>com.dotmarketing.portlets.workflows.model.WorkflowAction<method*end>> filterBulkActions(final List<method*start>java.util.List<method*end><WorkflowAction<method*start>com.dotmarketing.portlets.workflows.model.WorkflowAction<method*end>> actions, final User<method*start>com.liferay.portal.model.User<method*end> user, final boolean respectFrontEndRoles) throws DotDataException<method*start>com.dotmarketing.exception.DotDataException<method*end> {
if ((user != null) && roleAPI.doesUserHaveRole<method*start>com.dotmarketing.business.RoleAPI.doesUserHaveRole<method*end>(user, cmsAdminRole)) {
Logger.debug<method*start>com.dotmarketing.util.Logger.debug<method*end>(this, () -> "user:" + user.getUserId<method*start>com.liferay.portal.model.UserModel.getUserId<method*end>() + " has an admin role. returning all actions.");
return actions;
}
final List<method*start>java.util.List<method*end><WorkflowAction<method*start>com.dotmarketing.portlets.workflows.model.WorkflowAction<method*end>> permissionables = new ArrayList<method*start>java.util.ArrayList<method*end><>(actions);
Logger.debug<method*start>com.dotmarketing.util.Logger.debug<method*end>(this, () -> " No actions were passed. ");
}
final Iterator<method*start>java.util.Iterator<method*end><WorkflowAction<method*start>com.dotmarketing.portlets.workflows.model.WorkflowAction<method*end>> actionsIterator = permissionables.iterator<method*start>java.util.List.iterator<method*end>();
while (actionsIterator.hasNext<method*start>java.util.Iterator.hasNext<method*end>()) {
final WorkflowAction<method*start>com.dotmarketing.portlets.workflows.model.WorkflowAction<method*end> action = actionsIterator.next<method*start>java.util.Iterator.next<method*end>();
boolean hasPermission = false;
// Validate if the action has user/role permissions
Logger.debug<method*start>com.dotmarketing.util.Logger.debug<method*end>(this, () -> " Trying other roles for action " + action.getName<method*start>com.dotmarketing.portlets.workflows.model.WorkflowAction.getName<method*end>() + " had permissions: yes");
hasPermission = true;
}
/*
If we don't have direct permissions over the action but the action has special roles
our best guess is to allow the user to try to execute the action in the bulk actions modal,
at this point and the way we calculate the bulk operations for efficiency we don't have
a permissionable to use in order to validate individual permissions.
*/
return permissionables;
}
|
annotation
|
@CloseDBIfOpened
List<method*start>java.util.List<method*end><WorkflowAction<method*start>com.dotmarketing.portlets.workflows.model.WorkflowAction<method*end>> filterBulkActions(final List<method*start>java.util.List<method*end><WorkflowAction<method*start>com.dotmarketing.portlets.workflows.model.WorkflowAction<method*end>> actions, final User<method*start>com.liferay.portal.model.User<method*end> user, final boolean respectFrontEndRoles) throws DotDataException<method*start>com.dotmarketing.exception.DotDataException<method*end> {
if ((user != null) && roleAPI.doesUserHaveRole<method*start>com.dotmarketing.business.RoleAPI.doesUserHaveRole<method*end>(user, cmsAdminRole)) {
Logger.debug<method*start>com.dotmarketing.util.Logger.debug<method*end>(this, () -> "user:" + user.getUserId<method*start>com.liferay.portal.model.UserModel.getUserId<method*end>() + " has an admin role. returning all actions.");
return actions;
}
final List<method*start>java.util.List<method*end><WorkflowAction<method*start>com.dotmarketing.portlets.workflows.model.WorkflowAction<method*end>> permissionables = new ArrayList<method*start>java.util.ArrayList<method*end><>(actions);
if (permissionables.isEmpty<method*start>java.util.List.isEmpty<method*end>()) {
Logger.debug<method*start>com.dotmarketing.util.Logger.debug<method*end>(this, () -> " No actions were passed. ");
return permissionables;
}
final Iterator<method*start>java.util.Iterator<method*end><WorkflowAction<method*start>com.dotmarketing.portlets.workflows.model.WorkflowAction<method*end>> actionsIterator = permissionables.iterator<method*start>java.util.List.iterator<method*end>();
while (actionsIterator.hasNext<method*start>java.util.Iterator.hasNext<method*end>()) {
final WorkflowAction<method*start>com.dotmarketing.portlets.workflows.model.WorkflowAction<method*end> action = actionsIterator.next<method*start>java.util.Iterator.next<method*end>();
boolean hasPermission = false;
// Validate if the action has user/role permissions
if (doesUserHavePermission<method*start>com.dotmarketing.portlets.workflows.business.WorkflowActionUtils.doesUserHavePermission<method*end>(action, PermissionAPI.PERMISSION_USE<method*start>com.dotmarketing.business.PermissionAPI.PERMISSION_USE<method*end>, user, respectFrontEndRoles)) {
Logger.debug<method*start>com.dotmarketing.util.Logger.debug<method*end>(this, () -> " Trying other roles for action " + action.getName<method*start>com.dotmarketing.portlets.workflows.model.WorkflowAction.getName<method*end>() + " had permissions: yes");
hasPermission = true;
}
/*
If we don't have direct permissions over the action but the action has special roles
our best guess is to allow the user to try to execute the action in the bulk actions modal,
at this point and the way we calculate the bulk operations for efficiency we don't have
a permissionable to use in order to validate individual permissions.
*/
if (!hasPermission && hasSpecialWorkflowRoles<method*start>com.dotmarketing.portlets.workflows.business.WorkflowActionUtils.hasSpecialWorkflowRoles<method*end>(action)) {
hasPermission = true;
}
if (!hasPermission) {
actionsIterator.remove<method*start>java.util.Iterator.remove<method*end>();
}
}
return permissionables;
}
|
public static Map<method*start>java.util.Map<method*end><String<method*start>java.lang.String<method*end>, Object<method*start>java.lang.Object<method*end>> entityMaintPermCheck(DispatchContext<method*start>org.apache.ofbiz.service.DispatchContext<method*end> dctx, Map<method*start>java.util.Map<method*end><String<method*start>java.lang.String<method*end>, ? extends Object<method*start>java.lang.Object<method*end>> context) {
GenericValue<method*start>org.apache.ofbiz.entity.GenericValue<method*end> userLogin = (GenericValue) context.get<method*start>java.util.Map.get<method*end>("userLogin");
Locale<method*start>java.util.Locale<method*end> locale = (Locale<method*start>java.util.Locale<method*end>) context.get<method*start>java.util.Map.get<method*end>("locale");
Security security = dctx.getSecurity<method*start>org.apache.ofbiz.service.DispatchContext.getSecurity<method*end>();
Map<method*start>java.util.Map<method*end><String<method*start>java.lang.String<method*end>, Object<method*start>java.lang.Object<method*end>> resultMap = null;
resultMap = ServiceUtil.returnSuccess<method*start>org.apache.ofbiz.service.ServiceUtil.returnSuccess<method*end>();
resultMap.put<method*start>java.util.Map.put<method*end>("hasPermission", true);
} else {
resultMap = ServiceUtil.returnFailure<method*start>org.apache.ofbiz.service.ServiceUtil.returnFailure<method*end>(UtilProperties.getMessage<method*start>org.apache.ofbiz.base.util.UtilProperties.getMessage<method*end>(resource, "WebtoolsPermissionError", locale));
resultMap.put<method*start>java.util.Map.put<method*end>("hasPermission", false);
}
return resultMap;
}
|
conventional
|
public static Map<method*start>java.util.Map<method*end><String<method*start>java.lang.String<method*end>, Object<method*start>java.lang.Object<method*end>> entityMaintPermCheck(DispatchContext<method*start>org.apache.ofbiz.service.DispatchContext<method*end> dctx, Map<method*start>java.util.Map<method*end><String<method*start>java.lang.String<method*end>, ? extends Object<method*start>java.lang.Object<method*end>> context) {
GenericValue<method*start>org.apache.ofbiz.entity.GenericValue<method*end> userLogin = (GenericValue) context.get<method*start>java.util.Map.get<method*end>("userLogin");
Locale<method*start>java.util.Locale<method*end> locale = (Locale<method*start>java.util.Locale<method*end>) context.get<method*start>java.util.Map.get<method*end>("locale");
Security security = dctx.getSecurity<method*start>org.apache.ofbiz.service.DispatchContext.getSecurity<method*end>();
Map<method*start>java.util.Map<method*end><String<method*start>java.lang.String<method*end>, Object<method*start>java.lang.Object<method*end>> resultMap = null;
if (security.hasPermission<method*start>org.apache.ofbiz.security.Security.hasPermission<method*end>("ENTITY_MAINT", userLogin)) {
resultMap = ServiceUtil.returnSuccess<method*start>org.apache.ofbiz.service.ServiceUtil.returnSuccess<method*end>();
resultMap.put<method*start>java.util.Map.put<method*end>("hasPermission", true);
} else {
resultMap = ServiceUtil.returnFailure<method*start>org.apache.ofbiz.service.ServiceUtil.returnFailure<method*end>(UtilProperties.getMessage<method*start>org.apache.ofbiz.base.util.UtilProperties.getMessage<method*end>(resource, "WebtoolsPermissionError", locale));
resultMap.put<method*start>java.util.Map.put<method*end>("hasPermission", false);
}
return resultMap;
}
|
private static boolean hasCachePermission() {
try {
SecurityManager security = System.getSecurityManager();
File cachedir = getCacheDirectory();
String cachepath;
if (cachedir != null) {
cachepath = cachedir.getPath();
} else {
cachepath = getTempDir();
if (cachepath == null) {
getCacheInfo().setHasPermission(Boolean.FALSE);
return false;
}
}
security.checkWrite(cachepath);
}
} catch (SecurityException e) {
getCacheInfo().setHasPermission(Boolean.FALSE);
return false;
}
getCacheInfo().setHasPermission(Boolean.TRUE);
return true;
}
}
|
conventional
|
private static boolean hasCachePermission() {
Boolean<method*start>java.lang.Boolean<method*end> hasPermission = getCacheInfo().getHasPermission<method*start>javax.imageio.ImageIO.CacheInfo.getHasPermission<method*end>();
if (hasPermission != null) {
return hasPermission.booleanValue<method*start>java.lang.Boolean.booleanValue<method*end>();
} else {
try {
SecurityManager<method*start>java.lang.SecurityManager<method*end> security = System.getSecurityManager<method*start>java.lang.System.getSecurityManager<method*end>();
if (security != null) {
File<method*start>java.io.File<method*end> cachedir = getCacheDirectory<method*start>javax.imageio.ImageIO.getCacheDirectory<method*end>();
String<method*start>java.lang.String<method*end> cachepath;
if (cachedir != null) {
cachepath = cachedir.getPath<method*start>cachedir.getPath<method*end>();
} else {
cachepath = getTempDir<method*start>javax.imageio.ImageIO.getTempDir<method*end>();
if (cachepath == null) {
getCacheInfo<method*start>javax.imageio.ImageIO.getCacheInfo<method*end>().setHasPermission<method*start>javax.imageio.ImageIO.CacheInfo.setHasPermission<method*end>(Boolean.FALSE<method*start>java.lang.Boolean.FALSE<method*end>);
return false;
}
}
security.checkWrite<method*start>security.checkWrite<method*end>(cachepath);
}
} catch (SecurityException<method*start>java.lang.SecurityException<method*end> e) {
getCacheInfo<method*start>javax.imageio.ImageIO.getCacheInfo<method*end>().setHasPermission<method*start>javax.imageio.ImageIO.CacheInfo.setHasPermission<method*end>(Boolean.FALSE<method*start>java.lang.Boolean.FALSE<method*end>);
return false;
}
getCacheInfo<method*start>javax.imageio.ImageIO.getCacheInfo<method*end>().setHasPermission<method*start>javax.imageio.ImageIO.CacheInfo.setHasPermission<method*end>(Boolean.TRUE<method*start>java.lang.Boolean.TRUE<method*end>);
return true;
}
}
|
@EventHandler
public void onJoin(PlayerJoinEvent event) {
event.getPlayer().sendMessage(ChestCommands.CHAT_PREFIX + ChatColor.RED + "The plugin found " + ChestCommands.getLastReloadErrors() + " error(s) last time it was loaded. You can see them by doing \"/cc reload\" in the console.");
}
event.getPlayer().sendMessage(ChestCommands.CHAT_PREFIX + "Found an update: " + ChestCommands.getNewVersion() + ". Download:");
event.getPlayer().sendMessage(ChatColor.DARK_GREEN + ">> " + ChatColor.GREEN + "http://dev.bukkit.org/bukkit-plugins/chest-commands");
}
}
|
annotation
|
@EventHandler
public void onJoin(PlayerJoinEvent<method*start>org.bukkit.event.player.PlayerJoinEvent<method*end> event) {
if (ChestCommands<method*start>com.gmail.filoghost.chestcommands.ChestCommands<method*end>.getLastReloadErrors() > 0 && event.getPlayer().hasPermission(Permissions.SEE_ERRORS)) {
event.getPlayer().sendMessage(ChestCommands.CHAT_PREFIX + ChatColor<method*start>org.bukkit.ChatColor<method*end>.RED + "The plugin found " + ChestCommands.getLastReloadErrors() + " error(s) last time it was loaded. You can see them by doing \"/cc reload\" in the console.");
}
if (ChestCommands.hasNewVersion() && ChestCommands.getSettings().update_notifications && event.getPlayer().hasPermission(Permissions.UPDATE_NOTIFICATIONS)) {
event.getPlayer().sendMessage(ChestCommands.CHAT_PREFIX + "Found an update: " + ChestCommands.getNewVersion() + ". Download:");
event.getPlayer().sendMessage(ChatColor<method*start>org.bukkit.ChatColor<method*end>.DARK_GREEN + ">> " + ChatColor<method*start>org.bukkit.ChatColor<method*end>.GREEN + "http://dev.bukkit.org/bukkit-plugins/chest-commands");
}
}
|
@HiveWebsocketAuth
@SuppressWarnings<method*start>java.lang.SuppressWarnings<method*end>("unchecked")
public void processSubscribeList(JsonObject<method*start>com.google.gson.JsonObject<method*end> request, WebSocketSession<method*start>org.springframework.web.socket.WebSocketSession<method*end> session) {
final HivePrincipal<method*start>com.devicehive.auth.HivePrincipal<method*end> principal = (HivePrincipal) SecurityContextHolder.getContext<method*start>org.springframework.security.core.context.SecurityContextHolder.getContext<method*end>().getAuthentication<method*start>org.springframework.security.core.context.SecurityContext.getAuthentication<method*end>().getPrincipal<method*start>org.springframework.security.core.Authentication.getPrincipal<method*end>();
final String<method*start>java.lang.String<method*end> type = gson.fromJson<method*start>com.google.gson.Gson.fromJson<method*end>(request.get<method*start>com.google.gson.JsonObject.get<method*end>(TYPE<method*start>com.devicehive.configuration.Constants.TYPE<method*end>), String<method*start>java.lang.String<method*end>.class);
Set<method*start>java.util.Set<method*end><SubscriptionInfo> subscriptions = subscriptionService.list<method*start>com.devicehive.service.SubscriptionService.list<method*end>(type, principal, session);
logger.debug<method*start>org.slf4j.Logger.debug<method*end>("subscribe/list completed for session {}", session.getId<method*start>org.springframework.web.socket.WebSocketSession.getId<method*end>());
WebSocketResponse response = new WebSocketResponse();
response.addValue<method*start>com.devicehive.websockets.converters.WebSocketResponse.addValue<method*end>(SUBSCRIPTIONS<method*start>com.devicehive.configuration.Constants.SUBSCRIPTIONS<method*end>, subscriptions, JsonPolicyDef.Policy.SUBSCRIPTIONS_LISTED<method*start>com.devicehive.json.strategies.JsonPolicyDef.Policy.SUBSCRIPTIONS_LISTED<method*end>);
clientHandler.sendMessage<method*start>com.devicehive.messages.handler.WebSocketClientHandler.sendMessage<method*end>(request, response, session);
}
|
annotation
|
@HiveWebsocketAuth
@PreAuthorize<method*start>org.springframework.security.access.prepost.PreAuthorize<method*end>("isAuthenticated() and (hasPermission(null, 'GET_DEVICE_COMMAND')" + " or hasPermission(null, 'GET_DEVICE_NOTIFICATION'))")
@SuppressWarnings<method*start>java.lang.SuppressWarnings<method*end>("unchecked")
public void processSubscribeList(JsonObject<method*start>com.google.gson.JsonObject<method*end> request, WebSocketSession<method*start>org.springframework.web.socket.WebSocketSession<method*end> session) {
final HivePrincipal<method*start>com.devicehive.auth.HivePrincipal<method*end> principal = (HivePrincipal) SecurityContextHolder.getContext<method*start>org.springframework.security.core.context.SecurityContextHolder.getContext<method*end>().getAuthentication<method*start>org.springframework.security.core.context.SecurityContext.getAuthentication<method*end>().getPrincipal<method*start>org.springframework.security.core.Authentication.getPrincipal<method*end>();
final String<method*start>java.lang.String<method*end> type = gson.fromJson<method*start>com.google.gson.Gson.fromJson<method*end>(request.get<method*start>com.google.gson.JsonObject.get<method*end>(TYPE<method*start>com.devicehive.configuration.Constants.TYPE<method*end>), String<method*start>java.lang.String<method*end>.class);
Set<method*start>java.util.Set<method*end><SubscriptionInfo> subscriptions = subscriptionService.list<method*start>com.devicehive.service.SubscriptionService.list<method*end>(type, principal, session);
logger.debug<method*start>org.slf4j.Logger.debug<method*end>("subscribe/list completed for session {}", session.getId<method*start>org.springframework.web.socket.WebSocketSession.getId<method*end>());
WebSocketResponse response = new WebSocketResponse();
response.addValue<method*start>com.devicehive.websockets.converters.WebSocketResponse.addValue<method*end>(SUBSCRIPTIONS<method*start>com.devicehive.configuration.Constants.SUBSCRIPTIONS<method*end>, subscriptions, JsonPolicyDef.Policy.SUBSCRIPTIONS_LISTED<method*start>com.devicehive.json.strategies.JsonPolicyDef.Policy.SUBSCRIPTIONS_LISTED<method*end>);
clientHandler.sendMessage<method*start>com.devicehive.messages.handler.WebSocketClientHandler.sendMessage<method*end>(request, response, session);
}
|
@Override
public void onReceive(Context context, Intent intent) {
if (null == this.listener || null == context) {
return;
}
int hasPermission = ActivityCompat.checkSelfPermission(context, Manifest.permission.ACCESS_NETWORK_STATE);
ConnectivityManager cm = (ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE);
try {
NetworkInfo activeNetwork = cm.getActiveNetworkInfo();
if (null == activeNetwork || !activeNetwork.isConnected()) {
this.listener.onNotConnected(context);
connectivityBroken = true;
return;
}
connectivityBroken = false;
if (activeNetwork.getType() == ConnectivityManager.TYPE_MOBILE) {
this.listener.onMobile(context);
} else if (activeNetwork.getType() == ConnectivityManager.TYPE_WIFI) {
this.listener.onWifi(context);
} else {
this.listener.onOtherConnected(context);
}
} catch (Exception ex) {
;
}
}
|
annotation
|
@Override<method*start>java.lang.Override<method*end>
public void onReceive(Context<method*start>android.content.Context<method*end> context, Intent<method*start>android.content.Intent<method*end> intent) {
if (null == this.listener<method*start>cn.leancloud.push.AVConnectivityReceiver.listener<method*end> || null == context) {
return;
}
int hasPermission = ActivityCompat.checkSelfPermission<method*start>androidx.core.app.ActivityCompat.checkSelfPermission<method*end>(context, Manifest.permission.ACCESS_NETWORK_STATE<method*start>android.Manifest.permission.ACCESS_NETWORK_STATE<method*end>);
if (PackageManager.PERMISSION_GRANTED<method*start>android.content.pm.PackageManager.PERMISSION_GRANTED<method*end> != hasPermission) {
LogUtil.getLogger<method*start>cn.leancloud.utils.LogUtil.getLogger<method*end>(AVConnectivityReceiver.class).w<method*start>cn.leancloud.AVLogger.w<method*end>("android.Manifest.permission.ACCESS_NETWORK_STATE is not granted.");
return;
}
ConnectivityManager<method*start>android.net.ConnectivityManager<method*end> cm = (ConnectivityManager<method*start>android.net.ConnectivityManager<method*end>) context.getSystemService<method*start>android.content.Context.getSystemService<method*end>(Context.CONNECTIVITY_SERVICE<method*start>android.content.Context.CONNECTIVITY_SERVICE<method*end>);
try {
NetworkInfo<method*start>android.net.NetworkInfo<method*end> activeNetwork = cm.getActiveNetworkInfo<method*start>android.net.ConnectivityManager.getActiveNetworkInfo<method*end>();
if (null == activeNetwork || !activeNetwork.isConnected<method*start>android.net.NetworkInfo.isConnected<method*end>()) {
this.listener.onNotConnected<method*start>cn.leancloud.push.AVConnectivityListener.onNotConnected<method*end>(context);
connectivityBroken = true;
return;
}
connectivityBroken = false;
if (activeNetwork.getType<method*start>android.net.NetworkInfo.getType<method*end>() == ConnectivityManager.TYPE_MOBILE<method*start>android.net.ConnectivityManager.TYPE_MOBILE<method*end>) {
this.listener.onMobile<method*start>cn.leancloud.push.AVConnectivityListener.onMobile<method*end>(context);
} else if (activeNetwork.getType<method*start>android.net.NetworkInfo.getType<method*end>() == ConnectivityManager.TYPE_WIFI<method*start>android.net.ConnectivityManager.TYPE_WIFI<method*end>) {
this.listener.onWifi<method*start>cn.leancloud.push.AVConnectivityListener.onWifi<method*end>(context);
} else {
this.listener.onOtherConnected<method*start>cn.leancloud.push.AVConnectivityListener.onOtherConnected<method*end>(context);
}
} catch (Exception<method*start>java.lang.Exception<method*end> ex) {
;
}
}
|
public String getSourceFileContent() {
File sourceFile = getSourceFile();
if (sourceFile == null) {
return null;
}
try {
return new TextFile(sourceFile).read();
} catch (IOException e) {
return null;
}
}
|
conventional
|
public String<method*start>java.lang.String<method*end> getSourceFileContent() {
if (!hasPermission<method*start>io.jenkins.plugins.coverage.targets.CoverageResult.hasPermission<method*end>()) {
return null;
}
File<method*start>java.io.File<method*end> sourceFile = getSourceFile();
if (sourceFile == null) {
return null;
}
try {
return new TextFile<method*start>hudson.util.TextFile<method*end>(sourceFile).read<method*start>hudson.util.TextFile.read<method*end>();
} catch (IOException<method*start>java.io.IOException<method*end> e) {
return null;
}
}
|
@EventHandler
public void handle(PlayerLoginEvent event) {
SyncProxyProxyLoginConfiguration syncProxyProxyLoginConfiguration = ProxProxCloudNetSyncProxyPlugin.getInstance().getProxyLoginConfiguration();
if (syncProxyProxyLoginConfiguration != null) {
if (syncProxyProxyLoginConfiguration.isMaintenance() && syncProxyProxyLoginConfiguration.getWhitelist() != null) {
event.deny(ChatColor.toANSI((SyncProxyConfigurationProvider.load().getMessages().get("player-login-not-whitelisted"))));
return;
}
event.deny(ChatColor.toANSI(SyncProxyConfigurationProvider.load().getMessages().getOrDefault("player-login-full-server", "&cThe network is currently full. You need extra permissions to enter the network")));
}
}
}
|
annotation
|
@EventHandler
public void handle(PlayerLoginEvent<method*start>io.gomint.proxprox.api.event.PlayerLoginEvent<method*end> event) {
SyncProxyProxyLoginConfiguration<method*start>de.dytanic.cloudnet.ext.syncproxy.SyncProxyProxyLoginConfiguration<method*end> syncProxyProxyLoginConfiguration = ProxProxCloudNetSyncProxyPlugin.getInstance().getProxyLoginConfiguration();
if (syncProxyProxyLoginConfiguration != null) {
if (syncProxyProxyLoginConfiguration.isMaintenance() && syncProxyProxyLoginConfiguration.getWhitelist() != null) {
if (syncProxyProxyLoginConfiguration.getWhitelist().contains(event.getPlayer().getName()) || syncProxyProxyLoginConfiguration.getWhitelist().contains(event.getPlayer().getUUID().toString()) || event.getPlayer().hasPermission("cloudnet.syncproxy.maintenance")) {
return;
}
event.deny(ChatColor<method*start>io.gomint.proxprox.api.ChatColor<method*end>.toANSI((SyncProxyConfigurationProvider.load().getMessages().get("player-login-not-whitelisted"))));
return;
}
if (ProxProxCloudNetSyncProxyPlugin.getInstance().getSyncProxyOnlineCount() >= syncProxyProxyLoginConfiguration.getMaxPlayers() && !event.getPlayer().hasPermission("cloudnet.syncproxy.fulljoin")) {
event.deny(ChatColor<method*start>io.gomint.proxprox.api.ChatColor<method*end>.toANSI(SyncProxyConfigurationProvider.load().getMessages().getOrDefault("player-login-full-server", "&cThe network is currently full. You need extra permissions to enter the network")));
}
}
}
|
@Override<method*start>java.lang.Override<method*end>
public boolean isComponentAuthorized(Component<method*start>org.apache.wicket.Component<method*end> component, WaspAction<method*start>org.wicketstuff.security.actions.WaspAction<method*end> action) {
IAuthorizationMessageSource<method*start>org.wicketstuff.security.log.IAuthorizationMessageSource<method*end> message = getMessageSource<method*start>org.wicketstuff.security.strategies.WaspAuthorizationStrategy.getMessageSource<method*end>();
message.setComponent<method*start>org.wicketstuff.security.log.IAuthorizationMessageSource.setComponent<method*end>(component);
logMessage<method*start>org.wicketstuff.security.strategies.WaspAuthorizationStrategy.logMessage<method*end>(message);
}
return false;
}
|
annotation
|
@Override<method*start>java.lang.Override<method*end>
public boolean isComponentAuthorized(Component<method*start>org.apache.wicket.Component<method*end> component, WaspAction<method*start>org.wicketstuff.security.actions.WaspAction<method*end> action) {
if (hasPermission<method*start>org.wicketstuff.security.swarm.strategies.AbstractSwarmStrategy.hasPermission<method*end>(new ComponentPermission<method*start>org.wicketstuff.security.hive.authorization.permissions.ComponentPermission<method*end>(component, action)))
return true;
IAuthorizationMessageSource<method*start>org.wicketstuff.security.log.IAuthorizationMessageSource<method*end> message = getMessageSource<method*start>org.wicketstuff.security.strategies.WaspAuthorizationStrategy.getMessageSource<method*end>();
if (message != null) {
message.setComponent<method*start>org.wicketstuff.security.log.IAuthorizationMessageSource.setComponent<method*end>(component);
logMessage<method*start>org.wicketstuff.security.strategies.WaspAuthorizationStrategy.logMessage<method*end>(message);
}
return false;
}
|
public static BigDecimal addToInitiative(boolean allowDuplicates, String state, Token token) throws ParserException {
InitiativeList list = token.getZoneRenderer().getZone().getInitiativeList();
TokenInitiative ti = null;
if (allowDuplicates || list.indexOf(token).isEmpty()) {
ti = list.insertToken(-1, token);
if (state != null)
ti.setState(state);
} else {
setInitiative(token, state);
}
return ti != null ? BigDecimal.ONE : BigDecimal.ZERO;
}
|
conventional
|
public static BigDecimal<method*start>java.math.BigDecimal<method*end> addToInitiative(boolean allowDuplicates, String<method*start>java.lang.String<method*end> state, Token<method*start>net.rptools.maptool.model.Token<method*end> token) throws ParserException<method*start>net.rptools.parser.ParserException<method*end> {
boolean hasPermission = MapTool.getFrame().getInitiativePanel().hasOwnerPermission(token);
if (!MapTool.getParser().isMacroTrusted() && !hasPermission) {
String<method*start>java.lang.String<method*end> message;
if (MapTool.getFrame().getInitiativePanel().isOwnerPermissions()) {
message = I18N<method*start>net.rptools.maptool.language.I18N<method*end>.getText("macro.function.initiative.gmOrOwner", "addToInitiative");
} else {
message = I18N<method*start>net.rptools.maptool.language.I18N<method*end>.getText("macro.function.initiative.gmOnly", "addToInitiative");
}
throw new ParserException<method*start>net.rptools.parser.ParserException<method*end>(message);
}
// endif
InitiativeList<method*start>net.rptools.maptool.model.InitiativeList<method*end> list = token.getZoneRenderer().getZone().getInitiativeList();
// insert the token if needed
TokenInitiative<method*start>net.rptools.maptool.model.InitiativeList.TokenInitiative<method*end> ti = null;
if (allowDuplicates || list.indexOf(token).isEmpty()) {
ti = list.insertToken(-1, token);
if (state != null)
ti.setState(state);
} else {
setInitiative<method*start>net.rptools.maptool.client.functions.TokenInitFunction.setInitiative<method*end>(token, state);
}
// endif
return ti != null ? BigDecimal<method*start>java.math.BigDecimal<method*end>.ONE : BigDecimal<method*start>java.math.BigDecimal<method*end>.ZERO;
}
|
@Override
public List<method*start>java.util.List<method*end><ContentType<method*start>com.dotcms.contenttype.model.type.ContentType<method*end>> getContentTypesInContainer(final User<method*start>com.liferay.portal.model.User<method*end> user, final Container<method*start>com.dotmarketing.portlets.containers.model.Container<method*end> container) throws DotStateException<method*start>com.dotmarketing.business.DotStateException<method*end>, DotDataException<method*start>com.dotmarketing.exception.DotDataException<method*end> {
try {
final List<method*start>java.util.List<method*end><ContainerStructure<method*start>com.dotmarketing.beans.ContainerStructure<method*end>> containerStructureList = getContainerStructures<method*start>com.dotmarketing.portlets.containers.business.ContainerAPIImpl.getContainerStructures<method*end>(container);
final Set<method*start>java.util.Set<method*end><ContentType<method*start>com.dotcms.contenttype.model.type.ContentType<method*end>> contentTypeList = new TreeSet<method*start>java.util.TreeSet<method*end><>(Comparator.comparing<method*start>java.util.Comparator.comparing<method*end>(ContentType<method*start>com.dotcms.contenttype.model.type.ContentType<method*end>::id));
ContentTypeAPI contentTypeAPI = APILocator.getContentTypeAPI<method*start>com.dotmarketing.business.APILocator.getContentTypeAPI<method*end>(user);
PermissionAPI permissionAPI = APILocator.getPermissionAPI<method*start>com.dotmarketing.business.APILocator.getPermissionAPI<method*end>();
for (final ContainerStructure containerStructure : containerStructureList) {
try {
final ContentType<method*start>com.dotcms.contenttype.model.type.ContentType<method*end> type = contentTypeAPI.find<method*start>com.dotcms.contenttype.business.ContentTypeAPI.find<method*end>(containerStructure.getStructureId<method*start>com.dotmarketing.beans.ContainerStructure.getStructureId<method*end>());
if (type == null) {
continue;
}
final boolean hasPermission = permissionAPI.doesUserHavePermission<method*start>com.dotmarketing.business.PermissionAPI.doesUserHavePermission<method*end>(type, PermissionAPI.PERMISSION_READ<method*start>com.dotmarketing.business.PermissionAPI.PERMISSION_READ<method*end>, user, false);
contentTypeList.add<method*start>java.util.Set.add<method*end>(type);
} catch (DotSecurityException<method*start>com.dotmarketing.exception.DotSecurityException<method*end> e) {
continue;
}
}
return contentTypeList.stream<method*start>java.util.Set.stream<method*end>().sorted<method*start>java.util.stream.Stream.sorted<method*end>(Comparator.comparing<method*start>java.util.Comparator.comparing<method*end>(ContentType<method*start>com.dotcms.contenttype.model.type.ContentType<method*end>::name)).collect<method*start>java.util.stream.Stream.collect<method*end>(CollectionsUtils.toImmutableList<method*start>com.dotcms.util.CollectionsUtils.toImmutableList<method*end>());
} catch (DotSecurityException<method*start>com.dotmarketing.exception.DotSecurityException<method*end> e) {
return Collections.EMPTY_LIST<method*start>java.util.Collections.EMPTY_LIST<method*end>;
}
}
|
annotation
|
@CloseDBIfOpened
@Override
public List<method*start>java.util.List<method*end><ContentType<method*start>com.dotcms.contenttype.model.type.ContentType<method*end>> getContentTypesInContainer(final User<method*start>com.liferay.portal.model.User<method*end> user, final Container<method*start>com.dotmarketing.portlets.containers.model.Container<method*end> container) throws DotStateException<method*start>com.dotmarketing.business.DotStateException<method*end>, DotDataException<method*start>com.dotmarketing.exception.DotDataException<method*end> {
try {
final List<method*start>java.util.List<method*end><ContainerStructure<method*start>com.dotmarketing.beans.ContainerStructure<method*end>> containerStructureList = getContainerStructures<method*start>com.dotmarketing.portlets.containers.business.ContainerAPIImpl.getContainerStructures<method*end>(container);
final Set<method*start>java.util.Set<method*end><ContentType<method*start>com.dotcms.contenttype.model.type.ContentType<method*end>> contentTypeList = new TreeSet<method*start>java.util.TreeSet<method*end><>(Comparator.comparing<method*start>java.util.Comparator.comparing<method*end>(ContentType<method*start>com.dotcms.contenttype.model.type.ContentType<method*end>::id));
ContentTypeAPI contentTypeAPI = APILocator.getContentTypeAPI<method*start>com.dotmarketing.business.APILocator.getContentTypeAPI<method*end>(user);
PermissionAPI permissionAPI = APILocator.getPermissionAPI<method*start>com.dotmarketing.business.APILocator.getPermissionAPI<method*end>();
for (final ContainerStructure containerStructure : containerStructureList) {
try {
final ContentType<method*start>com.dotcms.contenttype.model.type.ContentType<method*end> type = contentTypeAPI.find<method*start>com.dotcms.contenttype.business.ContentTypeAPI.find<method*end>(containerStructure.getStructureId<method*start>com.dotmarketing.beans.ContainerStructure.getStructureId<method*end>());
if (type == null) {
continue;
}
final boolean hasPermission = permissionAPI.doesUserHavePermission<method*start>com.dotmarketing.business.PermissionAPI.doesUserHavePermission<method*end>(type, PermissionAPI.PERMISSION_READ<method*start>com.dotmarketing.business.PermissionAPI.PERMISSION_READ<method*end>, user, false);
if (!hasPermission) {
continue;
}
contentTypeList.add<method*start>java.util.Set.add<method*end>(type);
} catch (DotSecurityException<method*start>com.dotmarketing.exception.DotSecurityException<method*end> e) {
continue;
}
}
return contentTypeList.stream<method*start>java.util.Set.stream<method*end>().sorted<method*start>java.util.stream.Stream.sorted<method*end>(Comparator.comparing<method*start>java.util.Comparator.comparing<method*end>(ContentType<method*start>com.dotcms.contenttype.model.type.ContentType<method*end>::name)).collect<method*start>java.util.stream.Stream.collect<method*end>(CollectionsUtils.toImmutableList<method*start>com.dotcms.util.CollectionsUtils.toImmutableList<method*end>());
} catch (DotSecurityException<method*start>com.dotmarketing.exception.DotSecurityException<method*end> e) {
return Collections.EMPTY_LIST<method*start>java.util.Collections.EMPTY_LIST<method*end>;
}
}
|
public Set<method*start>java.util.Set<method*end><IPersonAttributesGroupDefinition<method*start>org.apereo.portal.groups.pags.dao.IPersonAttributesGroupDefinition<method*end>> getPagsDefinitions(IPerson<method*start>org.apereo.portal.security.IPerson<method*end> person) {
Set<method*start>java.util.Set<method*end><IPersonAttributesGroupDefinition<method*start>org.apereo.portal.groups.pags.dao.IPersonAttributesGroupDefinition<method*end>> rslt = new HashSet<method*start>java.util.HashSet<method*end><>();
for (IPersonAttributesGroupDefinition<method*start>org.apereo.portal.groups.pags.dao.IPersonAttributesGroupDefinition<method*end> def : pagsGroupDefDao.getPersonAttributesGroupDefinitions<method*start>org.apereo.portal.groups.pags.dao.IPersonAttributesGroupDefinitionDao.getPersonAttributesGroupDefinitions<method*end>()) {
rslt.add<method*start>java.util.Set.add<method*end>(def);
}
}
logger.debug<method*start>org.slf4j.Logger.debug<method*end>("Returning PAGS definitions '{}' for user '{}'", rslt, person.getUserName<method*start>org.apereo.portal.security.IPerson.getUserName<method*end>());
return rslt;
}
|
conventional
|
public Set<method*start>java.util.Set<method*end><IPersonAttributesGroupDefinition<method*start>org.apereo.portal.groups.pags.dao.IPersonAttributesGroupDefinition<method*end>> getPagsDefinitions(IPerson<method*start>org.apereo.portal.security.IPerson<method*end> person) {
Set<method*start>java.util.Set<method*end><IPersonAttributesGroupDefinition<method*start>org.apereo.portal.groups.pags.dao.IPersonAttributesGroupDefinition<method*end>> rslt = new HashSet<method*start>java.util.HashSet<method*end><>();
for (IPersonAttributesGroupDefinition<method*start>org.apereo.portal.groups.pags.dao.IPersonAttributesGroupDefinition<method*end> def : pagsGroupDefDao.getPersonAttributesGroupDefinitions<method*start>org.apereo.portal.groups.pags.dao.IPersonAttributesGroupDefinitionDao.getPersonAttributesGroupDefinitions<method*end>()) {
if (hasPermission<method*start>org.apereo.portal.groups.pags.dao.PagsService.hasPermission<method*end>(person, IPermission.VIEW_GROUP_ACTIVITY<method*start>org.apereo.portal.security.IPermission.VIEW_GROUP_ACTIVITY<method*end>, def.getCompositeEntityIdentifierForGroup<method*start>org.apereo.portal.groups.pags.dao.IPersonAttributesGroupDefinition.getCompositeEntityIdentifierForGroup<method*end>().getKey<method*start>org.apereo.portal.EntityIdentifier.getKey<method*end>())) {
rslt.add<method*start>java.util.Set.add<method*end>(def);
}
}
logger.debug<method*start>org.slf4j.Logger.debug<method*end>("Returning PAGS definitions '{}' for user '{}'", rslt, person.getUserName<method*start>org.apereo.portal.security.IPerson.getUserName<method*end>());
return rslt;
}
|
@Override
public void onNewIntent(Intent intent) {
if (intent.getAction() == null) {
return;
}
if (intent.getAction().equals(ACTION_SHOW_NOW_PLAYING_PAGE)) {
expandBottomSheet();
mBinding.libraryDrawerLayout.closeDrawers();
// Don't try to process this intent again
setIntent(new Intent(this, LibraryActivity.class));
return;
}
if (intent.getData() == null) {
return;
}
}, throwable -> {
Timber.e(throwable, "Failed to start playback from URI %s", intent.getData());
});
}
// Don't try to process this intent again
setIntent(new Intent(this, LibraryActivity.class));
}
|
annotation
|
@Override
public void onNewIntent(Intent<method*start>android.content.Intent<method*end> intent) {
if (intent.getAction<method*start>android.content.Intent.getAction<method*end>() == null) {
return;
}
if (intent.getAction<method*start>android.content.Intent.getAction<method*end>().equals<method*start>java.lang.String.equals<method*end>(ACTION_SHOW_NOW_PLAYING_PAGE)) {
expandBottomSheet<method*start>com.marverenic.music.ui.BaseLibraryActivity.expandBottomSheet<method*end>();
mBinding.libraryDrawerLayout<method*start>com.marverenic.music.databinding.ActivityLibraryBaseWrapperBinding.libraryDrawerLayout<method*end>.closeDrawers();
// Don't try to process this intent again
setIntent<method*start>com.trello.rxlifecycle.components.support.RxAppCompatActivity.setIntent<method*end>(new Intent<method*start>android.content.Intent<method*end>(this, LibraryActivity.class));
return;
}
// Handle incoming requests to play media from other applications
if (intent.getData<method*start>android.content.Intent.getData<method*end>() == null) {
return;
}
// If this intent is a music intent, process it
if (intent.getAction<method*start>android.content.Intent.getAction<method*end>().equals<method*start>java.lang.String.equals<method*end>(Intent.ACTION_VIEW<method*start>android.content.Intent.ACTION_VIEW<method*end>)) {
MediaStoreUtil.promptPermission<method*start>com.marverenic.music.data.store.MediaStoreUtil.promptPermission<method*end>(this).subscribe<method*start>rx.Observable.subscribe<method*end>(hasPermission -> {
if (hasPermission) {
startPlaybackFromUri<method*start>com.marverenic.music.ui.library.LibraryActivity.startPlaybackFromUri<method*end>(intent.getData<method*start>android.content.Intent.getData<method*end>());
}
}, throwable -> {
Timber.e<method*start>timber.log.Timber.e<method*end>(throwable, "Failed to start playback from URI %s", intent.getData<method*start>android.content.Intent.getData<method*end>());
});
}
// Don't try to process this intent again
setIntent<method*start>com.trello.rxlifecycle.components.support.RxAppCompatActivity.setIntent<method*end>(new Intent<method*start>android.content.Intent<method*end>(this, LibraryActivity.class));
}
|
@Override
public Grid<method*start>org.hisp.dhis.common.Grid<method*end> getVisualizationGridByUser(final String<method*start>java.lang.String<method*end> uid, final Date<method*start>java.util.Date<method*end> relativePeriodDate, final String<method*start>java.lang.String<method*end> organisationUnitUid, final User<method*start>org.hisp.dhis.user.User<method*end> user) {
Visualization<method*start>org.hisp.dhis.visualization.Visualization<method*end> visualization = loadVisualization<method*start>org.hisp.dhis.visualization.impl.DefaultVisualizationService.loadVisualization<method*end>(uid);
I18nFormat<method*start>org.hisp.dhis.i18n.I18nFormat<method*end> format = i18nManager.getI18nFormat<method*start>org.hisp.dhis.i18n.I18nManager.getI18nFormat<method*end>();
OrganisationUnit<method*start>org.hisp.dhis.organisationunit.OrganisationUnit<method*end> organisationUnit = organisationUnitService.getOrganisationUnit<method*start>org.hisp.dhis.organisationunit.OrganisationUnitService.getOrganisationUnit<method*end>(organisationUnitUid);
List<method*start>java.util.List<method*end><OrganisationUnit<method*start>org.hisp.dhis.organisationunit.OrganisationUnit<method*end>> atLevels = new ArrayList<method*start>java.util.ArrayList<method*end><>();
List<method*start>java.util.List<method*end><OrganisationUnit<method*start>org.hisp.dhis.organisationunit.OrganisationUnit<method*end>> inGroups = new ArrayList<method*start>java.util.ArrayList<method*end><>();
if (visualization.hasOrganisationUnitLevels<method*start>org.hisp.dhis.common.BaseAnalyticalObject.hasOrganisationUnitLevels<method*end>()) {
atLevels.addAll<method*start>java.util.List.addAll<method*end>(organisationUnitService.getOrganisationUnitsAtLevels<method*start>org.hisp.dhis.organisationunit.OrganisationUnitService.getOrganisationUnitsAtLevels<method*end>(visualization.getOrganisationUnitLevels<method*start>org.hisp.dhis.common.BaseAnalyticalObject.getOrganisationUnitLevels<method*end>(), visualization.getOrganisationUnits<method*start>org.hisp.dhis.common.BaseAnalyticalObject.getOrganisationUnits<method*end>()));
}
if (visualization.hasItemOrganisationUnitGroups<method*start>org.hisp.dhis.common.BaseAnalyticalObject.hasItemOrganisationUnitGroups<method*end>()) {
inGroups.addAll<method*start>java.util.List.addAll<method*end>(organisationUnitService.getOrganisationUnits<method*start>org.hisp.dhis.organisationunit.OrganisationUnitService.getOrganisationUnits<method*end>(visualization.getItemOrganisationUnitGroups<method*start>org.hisp.dhis.common.BaseAnalyticalObject.getItemOrganisationUnitGroups<method*end>(), visualization.getOrganisationUnits<method*start>org.hisp.dhis.common.BaseAnalyticalObject.getOrganisationUnits<method*end>()));
}
visualization.init<method*start>org.hisp.dhis.visualization.Visualization.init<method*end>(user, relativePeriodDate, organisationUnit, atLevels, inGroups, format);
Map<method*start>java.util.Map<method*end><String<method*start>java.lang.String<method*end>, Object> valueMap = analyticsService.getAggregatedDataValueMapping<method*start>org.hisp.dhis.analytics.AnalyticsService.getAggregatedDataValueMapping<method*end>(visualization);
Grid<method*start>org.hisp.dhis.common.Grid<method*end> visualizationGrid = visualization.getGrid<method*start>org.hisp.dhis.visualization.Visualization.getGrid<method*end>(new ListGrid<method*start>org.hisp.dhis.system.grid.ListGrid<method*end>(), valueMap, SHORTNAME<method*start>org.hisp.dhis.common.DisplayProperty.SHORTNAME<method*end>, true);
visualization.clearTransientState<method*start>org.hisp.dhis.common.BaseAnalyticalObject.clearTransientState<method*end>();
return visualizationGrid;
} else {
return new ListGrid<method*start>org.hisp.dhis.system.grid.ListGrid<method*end>();
}
}
|
annotation
|
@Override<method*start>java.lang.Override<method*end>
@Transactional<method*start>org.springframework.transaction.annotation.Transactional<method*end>(readOnly<method*start>org.springframework.transaction.annotation.Transactional.readOnly<method*end> = true)
public Grid<method*start>org.hisp.dhis.common.Grid<method*end> getVisualizationGridByUser(final String<method*start>java.lang.String<method*end> uid, final Date<method*start>java.util.Date<method*end> relativePeriodDate, final String<method*start>java.lang.String<method*end> organisationUnitUid, final User<method*start>org.hisp.dhis.user.User<method*end> user) {
Visualization<method*start>org.hisp.dhis.visualization.Visualization<method*end> visualization = loadVisualization<method*start>org.hisp.dhis.visualization.impl.DefaultVisualizationService.loadVisualization<method*end>(uid);
final boolean hasPermission = visualization != null;
if (hasPermission) {
I18nFormat<method*start>org.hisp.dhis.i18n.I18nFormat<method*end> format = i18nManager.getI18nFormat<method*start>org.hisp.dhis.i18n.I18nManager.getI18nFormat<method*end>();
OrganisationUnit<method*start>org.hisp.dhis.organisationunit.OrganisationUnit<method*end> organisationUnit = organisationUnitService.getOrganisationUnit<method*start>org.hisp.dhis.organisationunit.OrganisationUnitService.getOrganisationUnit<method*end>(organisationUnitUid);
List<method*start>java.util.List<method*end><OrganisationUnit<method*start>org.hisp.dhis.organisationunit.OrganisationUnit<method*end>> atLevels = new ArrayList<method*start>java.util.ArrayList<method*end><>();
List<method*start>java.util.List<method*end><OrganisationUnit<method*start>org.hisp.dhis.organisationunit.OrganisationUnit<method*end>> inGroups = new ArrayList<method*start>java.util.ArrayList<method*end><>();
if (visualization.hasOrganisationUnitLevels<method*start>org.hisp.dhis.common.BaseAnalyticalObject.hasOrganisationUnitLevels<method*end>()) {
atLevels.addAll<method*start>java.util.List.addAll<method*end>(organisationUnitService.getOrganisationUnitsAtLevels<method*start>org.hisp.dhis.organisationunit.OrganisationUnitService.getOrganisationUnitsAtLevels<method*end>(visualization.getOrganisationUnitLevels<method*start>org.hisp.dhis.common.BaseAnalyticalObject.getOrganisationUnitLevels<method*end>(), visualization.getOrganisationUnits<method*start>org.hisp.dhis.common.BaseAnalyticalObject.getOrganisationUnits<method*end>()));
}
if (visualization.hasItemOrganisationUnitGroups<method*start>org.hisp.dhis.common.BaseAnalyticalObject.hasItemOrganisationUnitGroups<method*end>()) {
inGroups.addAll<method*start>java.util.List.addAll<method*end>(organisationUnitService.getOrganisationUnits<method*start>org.hisp.dhis.organisationunit.OrganisationUnitService.getOrganisationUnits<method*end>(visualization.getItemOrganisationUnitGroups<method*start>org.hisp.dhis.common.BaseAnalyticalObject.getItemOrganisationUnitGroups<method*end>(), visualization.getOrganisationUnits<method*start>org.hisp.dhis.common.BaseAnalyticalObject.getOrganisationUnits<method*end>()));
}
visualization.init<method*start>org.hisp.dhis.visualization.Visualization.init<method*end>(user, relativePeriodDate, organisationUnit, atLevels, inGroups, format);
Map<method*start>java.util.Map<method*end><String<method*start>java.lang.String<method*end>, Object> valueMap = analyticsService.getAggregatedDataValueMapping<method*start>org.hisp.dhis.analytics.AnalyticsService.getAggregatedDataValueMapping<method*end>(visualization);
Grid<method*start>org.hisp.dhis.common.Grid<method*end> visualizationGrid = visualization.getGrid<method*start>org.hisp.dhis.visualization.Visualization.getGrid<method*end>(new ListGrid<method*start>org.hisp.dhis.system.grid.ListGrid<method*end>(), valueMap, SHORTNAME<method*start>org.hisp.dhis.common.DisplayProperty.SHORTNAME<method*end>, true);
visualization.clearTransientState<method*start>org.hisp.dhis.common.BaseAnalyticalObject.clearTransientState<method*end>();
return visualizationGrid;
} else {
return new ListGrid<method*start>org.hisp.dhis.system.grid.ListGrid<method*end>();
}
}
|
public static void askForPermission(Activity<method*start>android.app.Activity<method*end> activity, String<method*start>java.lang.String<method*end>[] permissions, PermissionCallback<method*start>com.ldt.musicr.permission.PermissionCallback<method*end> permissionCallback) {
permissionCallback.permissionGranted<method*start>com.ldt.musicr.permission.PermissionCallback.permissionGranted<method*end>();
return;
}
PermissionRequest<method*start>com.ldt.musicr.permission.PermissionRequest<method*end> permissionRequest = new PermissionRequest<method*start>com.ldt.musicr.permission.PermissionRequest<method*end>(new ArrayList<method*start>java.util.ArrayList<method*end><String<method*start>java.lang.String<method*end>>(Arrays.asList<method*start>java.util.Arrays.asList<method*end>(permissions)), permissionCallback);
permissionRequests.add<method*start>java.util.ArrayList.add<method*end>(permissionRequest);
activity.requestPermissions<method*start>android.app.Activity.requestPermissions<method*end>(permissions, permissionRequest.getRequestCode<method*start>com.ldt.musicr.permission.PermissionRequest.getRequestCode<method*end>());
}
|
conventional
|
public static void askForPermission(Activity<method*start>android.app.Activity<method*end> activity, String<method*start>java.lang.String<method*end>[] permissions, PermissionCallback<method*start>com.ldt.musicr.permission.PermissionCallback<method*end> permissionCallback) {
if (permissionCallback == null) {
return;
}
if (hasPermission<method*start>com.ldt.musicr.permission.Nammu.hasPermission<method*end>(activity, permissions)) {
permissionCallback.permissionGranted<method*start>com.ldt.musicr.permission.PermissionCallback.permissionGranted<method*end>();
return;
}
PermissionRequest<method*start>com.ldt.musicr.permission.PermissionRequest<method*end> permissionRequest = new PermissionRequest<method*start>com.ldt.musicr.permission.PermissionRequest<method*end>(new ArrayList<method*start>java.util.ArrayList<method*end><String<method*start>java.lang.String<method*end>>(Arrays.asList<method*start>java.util.Arrays.asList<method*end>(permissions)), permissionCallback);
permissionRequests.add<method*start>java.util.ArrayList.add<method*end>(permissionRequest);
activity.requestPermissions<method*start>android.app.Activity.requestPermissions<method*end>(permissions, permissionRequest.getRequestCode<method*start>com.ldt.musicr.permission.PermissionRequest.getRequestCode<method*end>());
}
|
@GetMapping<method*start>org.springframework.web.bind.annotation.GetMapping<method*end>()
@Override<method*start>java.lang.Override<method*end>
public List<method*start>java.util.List<method*end><DashboardType<method*start>com.qaprosoft.zafira.models.dto.DashboardType<method*end>> getAllDashboards(@RequestParam<method*start>org.springframework.web.bind.annotation.RequestParam<method*end>(value<method*start>org.springframework.web.bind.annotation.RequestParam.value<method*end> = "hidden", required<method*start>org.springframework.web.bind.annotation.RequestParam.required<method*end> = false) boolean hidden) {
List<method*start>java.util.List<method*end><Dashboard<method*start>com.qaprosoft.zafira.models.db.Dashboard<method*end>> dashboards;
dashboards = dashboardService.retrieveAll<method*start>com.qaprosoft.zafira.service.DashboardService.retrieveAll<method*end>();
} else {
dashboards = dashboardService.retrieveByVisibility<method*start>com.qaprosoft.zafira.service.DashboardService.retrieveByVisibility<method*end>(false);
}
return dashboards.stream<method*start>java.util.List.stream<method*end>().map<method*start>java.util.stream.Stream.map<method*end>(dashboard -> mapper.map<method*start>org.dozer.Mapper.map<method*end>(dashboard, DashboardType<method*start>com.qaprosoft.zafira.models.dto.DashboardType<method*end>.class)).collect<method*start>java.util.stream.Stream.collect<method*end>(Collectors.toList<method*start>java.util.stream.Collectors.toList<method*end>());
}
|
annotation
|
@GetMapping<method*start>org.springframework.web.bind.annotation.GetMapping<method*end>()
@Override<method*start>java.lang.Override<method*end>
public List<method*start>java.util.List<method*end><DashboardType<method*start>com.qaprosoft.zafira.models.dto.DashboardType<method*end>> getAllDashboards(@RequestParam<method*start>org.springframework.web.bind.annotation.RequestParam<method*end>(value<method*start>org.springframework.web.bind.annotation.RequestParam.value<method*end> = "hidden", required<method*start>org.springframework.web.bind.annotation.RequestParam.required<method*end> = false) boolean hidden) {
List<method*start>java.util.List<method*end><Dashboard<method*start>com.qaprosoft.zafira.models.db.Dashboard<method*end>> dashboards;
if (!hidden && hasPermission<method*start>com.qaprosoft.zafira.web.AbstractController.hasPermission<method*end>(Permission.Name.VIEW_HIDDEN_DASHBOARDS<method*start>com.qaprosoft.zafira.models.db.Permission.Name.VIEW_HIDDEN_DASHBOARDS<method*end>)) {
dashboards = dashboardService.retrieveAll<method*start>com.qaprosoft.zafira.service.DashboardService.retrieveAll<method*end>();
} else {
dashboards = dashboardService.retrieveByVisibility<method*start>com.qaprosoft.zafira.service.DashboardService.retrieveByVisibility<method*end>(false);
}
return dashboards.stream<method*start>java.util.List.stream<method*end>().map<method*start>java.util.stream.Stream.map<method*end>(dashboard -> mapper.map<method*start>org.dozer.Mapper.map<method*end>(dashboard, DashboardType<method*start>com.qaprosoft.zafira.models.dto.DashboardType<method*end>.class)).collect<method*start>java.util.stream.Stream.collect<method*end>(Collectors.toList<method*start>java.util.stream.Collectors.toList<method*end>());
}
|
@Override
public ProcessRest<method*start>org.dspace.app.rest.model.ProcessRest<method*end> findOne(Context<method*start>org.dspace.core.Context<method*end> context, Integer<method*start>java.lang.Integer<method*end> id) {
try {
Process<method*start>org.dspace.scripts.Process<method*end> process = processService.find<method*start>org.dspace.scripts.service.ProcessService.find<method*end>(context, id);
if (process == null) {
return null;
}
return converter.toRest<method*start>org.dspace.app.rest.converter.ConverterService.toRest<method*end>(process, utils.obtainProjection<method*start>org.dspace.app.rest.utils.Utils.obtainProjection<method*end>());
} catch (Exception<method*start>java.lang.Exception<method*end> e) {
log.error<method*start>org.apache.logging.log4j.Logger.error<method*end>(e.getMessage<method*start>java.lang.Exception.getMessage<method*end>(), e);
}
return null;
}
|
annotation
|
@Override<method*start>java.lang.Override<method*end>
@PreAuthorize<method*start>org.springframework.security.access.prepost.PreAuthorize<method*end>("hasPermission(#id, 'PROCESS', 'READ')")
public ProcessRest<method*start>org.dspace.app.rest.model.ProcessRest<method*end> findOne(Context<method*start>org.dspace.core.Context<method*end> context, Integer<method*start>java.lang.Integer<method*end> id) {
try {
Process<method*start>org.dspace.scripts.Process<method*end> process = processService.find<method*start>org.dspace.scripts.service.ProcessService.find<method*end>(context, id);
if (process == null) {
return null;
}
return converter.toRest<method*start>org.dspace.app.rest.converter.ConverterService.toRest<method*end>(process, utils.obtainProjection<method*start>org.dspace.app.rest.utils.Utils.obtainProjection<method*end>());
} catch (Exception<method*start>java.lang.Exception<method*end> e) {
log.error<method*start>org.apache.logging.log4j.Logger.error<method*end>(e.getMessage<method*start>java.lang.Exception.getMessage<method*end>(), e);
}
return null;
}
|
@Override
public void messageOnServerThread(final HutRenameMessage<method*start>com.minecolonies.coremod.network.messages.HutRenameMessage<method*end> message, final EntityPlayerMP<method*start>net.minecraft.entity.player.EntityPlayerMP<method*end> player) {
final IColony<method*start>com.minecolonies.api.colony.IColony<method*end> colony = IColonyManager<method*start>com.minecolonies.api.colony.IColonyManager<method*end>.getInstance().getColonyByDimension(message.colonyId, message.dimension);
final IBuilding b = colony<method*start>com.minecolonies.coremod.colony.buildings.AbstractCitizenAssignable.colony<method*end>.getBuildingManager().getBuildings().get(message.buildingId);
if (b != null) {
b.setCustomBuildingName(message.name);
}
}
}
|
annotation
|
@Override
public void messageOnServerThread(final HutRenameMessage<method*start>com.minecolonies.coremod.network.messages.HutRenameMessage<method*end> message, final EntityPlayerMP<method*start>net.minecraft.entity.player.EntityPlayerMP<method*end> player) {
final IColony<method*start>com.minecolonies.api.colony.IColony<method*end> colony = IColonyManager<method*start>com.minecolonies.api.colony.IColonyManager<method*end>.getInstance().getColonyByDimension(message.colonyId, message.dimension);
if (colony<method*start>com.minecolonies.coremod.colony.buildings.AbstractCitizenAssignable.colony<method*end> != null && colony<method*start>com.minecolonies.coremod.colony.buildings.AbstractCitizenAssignable.colony<method*end>.getPermissions().hasPermission(player, Action<method*start>com.minecolonies.api.colony.permissions.Action<method*end>.MANAGE_HUTS)) {
final IBuilding b = colony<method*start>com.minecolonies.coremod.colony.buildings.AbstractCitizenAssignable.colony<method*end>.getBuildingManager().getBuildings().get(message.buildingId);
if (b != null) {
b.setCustomBuildingName(message.name);
}
}
}
|
public BundleRest<method*start>org.dspace.app.rest.model.BundleRest<method*end> findOne(Context<method*start>org.dspace.core.Context<method*end> context, UUID<method*start>java.util.UUID<method*end> uuid) {
Bundle<method*start>org.dspace.content.Bundle<method*end> bundle = null;
try {
bundle = bundleService.find<method*start>org.dspace.content.service.BundleService.find<method*end>(context, uuid);
} catch (SQLException<method*start>java.sql.SQLException<method*end> e) {
throw new RuntimeException<method*start>java.lang.RuntimeException<method*end>(e.getMessage<method*start>java.sql.SQLException.getMessage<method*end>(), e);
}
if (bundle == null) {
return null;
}
return converter.toRest<method*start>org.dspace.app.rest.converter.ConverterService.toRest<method*end>(bundle, utils.obtainProjection<method*start>org.dspace.app.rest.utils.Utils.obtainProjection<method*end>());
}
|
annotation
|
@PreAuthorize<method*start>org.springframework.security.access.prepost.PreAuthorize<method*end>("hasPermission(#uuid, 'BUNDLE', 'READ')")
public BundleRest<method*start>org.dspace.app.rest.model.BundleRest<method*end> findOne(Context<method*start>org.dspace.core.Context<method*end> context, UUID<method*start>java.util.UUID<method*end> uuid) {
Bundle<method*start>org.dspace.content.Bundle<method*end> bundle = null;
try {
bundle = bundleService.find<method*start>org.dspace.content.service.BundleService.find<method*end>(context, uuid);
} catch (SQLException<method*start>java.sql.SQLException<method*end> e) {
throw new RuntimeException<method*start>java.lang.RuntimeException<method*end>(e.getMessage<method*start>java.sql.SQLException.getMessage<method*end>(), e);
}
if (bundle == null) {
return null;
}
return converter.toRest<method*start>org.dspace.app.rest.converter.ConverterService.toRest<method*end>(bundle, utils.obtainProjection<method*start>org.dspace.app.rest.utils.Utils.obtainProjection<method*end>());
}
|
@HiveWebsocketAuth
public void processUserAllowAllDeviceTypes(JsonObject<method*start>com.google.gson.JsonObject<method*end> request, WebSocketSession<method*start>org.springframework.web.socket.WebSocketSession<method*end> session) {
Long<method*start>java.lang.Long<method*end> userId = gson.fromJson<method*start>com.google.gson.Gson.fromJson<method*end>(request.get<method*start>com.google.gson.JsonObject.get<method*end>(USER_ID<method*start>com.devicehive.configuration.Constants.USER_ID<method*end>), Long<method*start>java.lang.Long<method*end>.class);
if (userId == null) {
logger.error<method*start>org.slf4j.Logger.error<method*end>(Messages.USER_ID_REQUIRED<method*start>com.devicehive.configuration.Messages.USER_ID_REQUIRED<method*end>);
throw new HiveException(Messages.USER_ID_REQUIRED<method*start>com.devicehive.configuration.Messages.USER_ID_REQUIRED<method*end>, BAD_REQUEST.getStatusCode<method*start>javax.ws.rs.core.Response.Status.getStatusCode<method*end>());
}
userService.allowAllDeviceTypes<method*start>com.devicehive.service.UserService.allowAllDeviceTypes<method*end>(userId);
clientHandler.sendMessage<method*start>com.devicehive.messages.handler.WebSocketClientHandler.sendMessage<method*end>(request, new WebSocketResponse(), session);
}
|
annotation
|
@HiveWebsocketAuth
@PreAuthorize<method*start>org.springframework.security.access.prepost.PreAuthorize<method*end>("isAuthenticated() and hasPermission(null, 'MANAGE_DEVICE_TYPE')")
public void processUserAllowAllDeviceTypes(JsonObject<method*start>com.google.gson.JsonObject<method*end> request, WebSocketSession<method*start>org.springframework.web.socket.WebSocketSession<method*end> session) {
Long<method*start>java.lang.Long<method*end> userId = gson.fromJson<method*start>com.google.gson.Gson.fromJson<method*end>(request.get<method*start>com.google.gson.JsonObject.get<method*end>(USER_ID<method*start>com.devicehive.configuration.Constants.USER_ID<method*end>), Long<method*start>java.lang.Long<method*end>.class);
if (userId == null) {
logger.error<method*start>org.slf4j.Logger.error<method*end>(Messages.USER_ID_REQUIRED<method*start>com.devicehive.configuration.Messages.USER_ID_REQUIRED<method*end>);
throw new HiveException(Messages.USER_ID_REQUIRED<method*start>com.devicehive.configuration.Messages.USER_ID_REQUIRED<method*end>, BAD_REQUEST.getStatusCode<method*start>javax.ws.rs.core.Response.Status.getStatusCode<method*end>());
}
userService.allowAllDeviceTypes<method*start>com.devicehive.service.UserService.allowAllDeviceTypes<method*end>(userId);
clientHandler.sendMessage<method*start>com.devicehive.messages.handler.WebSocketClientHandler.sendMessage<method*end>(request, new WebSocketResponse(), session);
}
|
@Override
public void messageOnServerThread(final BuildingHiringModeMessage<method*start>com.minecolonies.coremod.network.messages.BuildingHiringModeMessage<method*end> message, final EntityPlayerMP<method*start>net.minecraft.entity.player.EntityPlayerMP<method*end> player) {
final IColony<method*start>com.minecolonies.api.colony.IColony<method*end> colony = IColonyManager<method*start>com.minecolonies.api.colony.IColonyManager<method*end>.getInstance().getColonyByDimension(message.colonyId, message.dimension);
@Nullable final AbstractBuildingWorker<method*start>com.minecolonies.coremod.colony.buildings.AbstractBuildingWorker<method*end> building = colony<method*start>com.minecolonies.coremod.colony.buildings.AbstractCitizenAssignable.colony<method*end>.getBuildingManager().getBuilding(message.buildingId, AbstractBuildingWorker<method*start>com.minecolonies.coremod.colony.buildings.AbstractBuildingWorker<method*end>.class);
if (building != null) {
building.setHiringMode(message.mode);
}
}
}
|
annotation
|
@Override
public void messageOnServerThread(final BuildingHiringModeMessage<method*start>com.minecolonies.coremod.network.messages.BuildingHiringModeMessage<method*end> message, final EntityPlayerMP<method*start>net.minecraft.entity.player.EntityPlayerMP<method*end> player) {
final IColony<method*start>com.minecolonies.api.colony.IColony<method*end> colony = IColonyManager<method*start>com.minecolonies.api.colony.IColonyManager<method*end>.getInstance().getColonyByDimension(message.colonyId, message.dimension);
if (colony<method*start>com.minecolonies.coremod.colony.buildings.AbstractCitizenAssignable.colony<method*end> != null && colony<method*start>com.minecolonies.coremod.colony.buildings.AbstractCitizenAssignable.colony<method*end>.getPermissions().hasPermission(player, Action<method*start>com.minecolonies.api.colony.permissions.Action<method*end>.MANAGE_HUTS)) {
@Nullable final AbstractBuildingWorker<method*start>com.minecolonies.coremod.colony.buildings.AbstractBuildingWorker<method*end> building = colony<method*start>com.minecolonies.coremod.colony.buildings.AbstractCitizenAssignable.colony<method*end>.getBuildingManager().getBuilding(message.buildingId, AbstractBuildingWorker<method*start>com.minecolonies.coremod.colony.buildings.AbstractBuildingWorker<method*end>.class);
if (building != null) {
building.setHiringMode(message.mode);
}
}
}
|
private GraphNode<method*start>org.apache.clerezza.rdf.utils.GraphNode<method*end> addPermission(GraphNode<method*start>org.apache.clerezza.rdf.utils.GraphNode<method*end> subjectNode, String<method*start>java.lang.String<method*end> permissionString) {
GraphNode<method*start>org.apache.clerezza.rdf.utils.GraphNode<method*end> permissionNode = new GraphNode<method*start>org.apache.clerezza.rdf.utils.GraphNode<method*end>(new BlankNode<method*start>org.apache.clerezza.commons.rdf.BlankNode<method*end>(), systemGraph);
permissionNode.addProperty<method*start>org.apache.clerezza.rdf.utils.GraphNode.addProperty<method*end>(RDF.type<method*start>org.apache.clerezza.rdf.ontologies.RDF.type<method*end>, PERMISSION.Permission<method*start>org.apache.clerezza.rdf.ontologies.PERMISSION.Permission<method*end>);
// permissionNode.addProperty(DC.title, new PlainLiteralImpl(permissionName));
subjectNode.addProperty<method*start>org.apache.clerezza.rdf.utils.GraphNode.addProperty<method*end>(PERMISSION.hasPermission<method*start>org.apache.clerezza.rdf.ontologies.PERMISSION.hasPermission<method*end>, permissionNode.getNode<method*start>org.apache.clerezza.rdf.utils.GraphNode.getNode<method*end>());
permissionNode.addProperty<method*start>org.apache.clerezza.rdf.utils.GraphNode.addProperty<method*end>(PERMISSION.javaPermissionEntry<method*start>org.apache.clerezza.rdf.ontologies.PERMISSION.javaPermissionEntry<method*end>, new PlainLiteralImpl<method*start>org.apache.clerezza.commons.rdf.impl.utils.PlainLiteralImpl<method*end>(permissionString));
return subjectNode;
}
|
conventional
|
private GraphNode<method*start>org.apache.clerezza.rdf.utils.GraphNode<method*end> addPermission(GraphNode<method*start>org.apache.clerezza.rdf.utils.GraphNode<method*end> subjectNode, String<method*start>java.lang.String<method*end> permissionString) {
if (hasPermission<method*start>org.apache.stanbol.commons.usermanagement.resource.UserResource.hasPermission<method*end>(subjectNode, permissionString)) {
return subjectNode;
}
GraphNode<method*start>org.apache.clerezza.rdf.utils.GraphNode<method*end> permissionNode = new GraphNode<method*start>org.apache.clerezza.rdf.utils.GraphNode<method*end>(new BlankNode<method*start>org.apache.clerezza.commons.rdf.BlankNode<method*end>(), systemGraph);
permissionNode.addProperty<method*start>org.apache.clerezza.rdf.utils.GraphNode.addProperty<method*end>(RDF.type<method*start>org.apache.clerezza.rdf.ontologies.RDF.type<method*end>, PERMISSION.Permission<method*start>org.apache.clerezza.rdf.ontologies.PERMISSION.Permission<method*end>);
// permissionNode.addProperty(DC.title, new PlainLiteralImpl(permissionName));
subjectNode.addProperty<method*start>org.apache.clerezza.rdf.utils.GraphNode.addProperty<method*end>(PERMISSION.hasPermission<method*start>org.apache.clerezza.rdf.ontologies.PERMISSION.hasPermission<method*end>, permissionNode.getNode<method*start>org.apache.clerezza.rdf.utils.GraphNode.getNode<method*end>());
permissionNode.addProperty<method*start>org.apache.clerezza.rdf.utils.GraphNode.addProperty<method*end>(PERMISSION.javaPermissionEntry<method*start>org.apache.clerezza.rdf.ontologies.PERMISSION.javaPermissionEntry<method*end>, new PlainLiteralImpl<method*start>org.apache.clerezza.commons.rdf.impl.utils.PlainLiteralImpl<method*end>(permissionString));
return subjectNode;
}
|
@Override<method*start>java.lang.Override<method*end>
public ClaimedTaskRest<method*start>org.dspace.app.rest.model.ClaimedTaskRest<method*end> findOne(Context<method*start>org.dspace.core.Context<method*end> context, Integer<method*start>java.lang.Integer<method*end> id) {
ClaimedTask<method*start>org.dspace.xmlworkflow.storedcomponents.ClaimedTask<method*end> task = null;
try {
task = claimedTaskService.find<method*start>org.dspace.xmlworkflow.storedcomponents.service.ClaimedTaskService.find<method*end>(context, id);
} catch (SQLException<method*start>java.sql.SQLException<method*end> e) {
throw new RuntimeException<method*start>java.lang.RuntimeException<method*end>(e.getMessage<method*start>java.sql.SQLException.getMessage<method*end>(), e);
}
if (task == null) {
return null;
}
return converter.toRest<method*start>org.dspace.app.rest.converter.ConverterService.toRest<method*end>(task, utils.obtainProjection<method*start>org.dspace.app.rest.utils.Utils.obtainProjection<method*end>());
}
|
annotation
|
@Override<method*start>java.lang.Override<method*end>
@PreAuthorize<method*start>org.springframework.security.access.prepost.PreAuthorize<method*end>("hasPermission(#id, 'CLAIMEDTASK', 'READ')")
public ClaimedTaskRest<method*start>org.dspace.app.rest.model.ClaimedTaskRest<method*end> findOne(Context<method*start>org.dspace.core.Context<method*end> context, Integer<method*start>java.lang.Integer<method*end> id) {
ClaimedTask<method*start>org.dspace.xmlworkflow.storedcomponents.ClaimedTask<method*end> task = null;
try {
task = claimedTaskService.find<method*start>org.dspace.xmlworkflow.storedcomponents.service.ClaimedTaskService.find<method*end>(context, id);
} catch (SQLException<method*start>java.sql.SQLException<method*end> e) {
throw new RuntimeException<method*start>java.lang.RuntimeException<method*end>(e.getMessage<method*start>java.sql.SQLException.getMessage<method*end>(), e);
}
if (task == null) {
return null;
}
return converter.toRest<method*start>org.dspace.app.rest.converter.ConverterService.toRest<method*end>(task, utils.obtainProjection<method*start>org.dspace.app.rest.utils.Utils.obtainProjection<method*end>());
}
|
public Map<method*start>java.util.Map<method*end><String<method*start>java.lang.String<method*end>, Object<method*start>java.lang.Object<method*end>> evalPermission(DispatchContext<method*start>org.apache.ofbiz.service.DispatchContext<method*end> dctx, Map<method*start>java.util.Map<method*end><String<method*start>java.lang.String<method*end>, ? extends Object<method*start>java.lang.Object<method*end>> context) {
Map<method*start>java.util.Map<method*end><String<method*start>java.lang.String<method*end>, Object<method*start>java.lang.Object<method*end>> result = ServiceUtil.returnSuccess<method*start>org.apache.ofbiz.service.ServiceUtil.returnSuccess<method*end>();
result.put<method*start>java.util.Map.put<method*end>("hasPermission", Boolean.FALSE<method*start>java.lang.Boolean.FALSE<method*end>);
result.put<method*start>java.util.Map.put<method*end>("failMessage", UtilProperties.getMessage<method*start>org.apache.ofbiz.base.util.UtilProperties.getMessage<method*end>(resource, "ServicePermissionErrorDefinitionProblem", (Locale<method*start>java.util.Locale<method*end>) context.get<method*start>java.util.Map.get<method*end>("locale")));
return result;
}
|
conventional
|
public Map<method*start>java.util.Map<method*end><String<method*start>java.lang.String<method*end>, Object<method*start>java.lang.Object<method*end>> evalPermission(DispatchContext<method*start>org.apache.ofbiz.service.DispatchContext<method*end> dctx, Map<method*start>java.util.Map<method*end><String<method*start>java.lang.String<method*end>, ? extends Object<method*start>java.lang.Object<method*end>> context) {
if (this.modelPermission<method*start>org.apache.ofbiz.service.ModelService.modelPermission<method*end> != null) {
return modelPermission.evalPermission<method*start>org.apache.ofbiz.service.ModelPermission.evalPermission<method*end>(dctx, context);
} else {
Map<method*start>java.util.Map<method*end><String<method*start>java.lang.String<method*end>, Object<method*start>java.lang.Object<method*end>> result = ServiceUtil.returnSuccess<method*start>org.apache.ofbiz.service.ServiceUtil.returnSuccess<method*end>();
result.put<method*start>java.util.Map.put<method*end>("hasPermission", Boolean.FALSE<method*start>java.lang.Boolean.FALSE<method*end>);
result.put<method*start>java.util.Map.put<method*end>("failMessage", UtilProperties.getMessage<method*start>org.apache.ofbiz.base.util.UtilProperties.getMessage<method*end>(resource, "ServicePermissionErrorDefinitionProblem", (Locale<method*start>java.util.Locale<method*end>) context.get<method*start>java.util.Map.get<method*end>("locale")));
return result;
}
}
|
@Nonnull<method*start>javax.annotation.Nonnull<method*end>
@Override<method*start>java.lang.Override<method*end>
public PermissionOverrideAction<method*start>net.dv8tion.jda.api.requests.restaction.PermissionOverrideAction<method*end> getManager() {
throw new InsufficientPermissionException(getChannel(), Permission.MANAGE_PERMISSIONS<method*start>net.dv8tion.jda.api.Permission.MANAGE_PERMISSIONS<method*end>);
PermissionOverrideAction<method*start>net.dv8tion.jda.api.requests.restaction.PermissionOverrideAction<method*end> mng = manager;
mng = MiscUtil.locked<method*start>net.dv8tion.jda.api.utils.MiscUtil.locked<method*end>(mngLock, () -> {
if (manager == null)
manager = new PermissionOverrideActionImpl<method*start>net.dv8tion.jda.internal.requests.restaction.PermissionOverrideActionImpl<method*end>(this).setOverride<method*start>net.dv8tion.jda.internal.requests.restaction.PermissionOverrideActionImpl.setOverride<method*end>(false);
return manager;
});
}
return mng.reset<method*start>net.dv8tion.jda.api.requests.restaction.PermissionOverrideAction.reset<method*end>();
}
|
annotation
|
@Nonnull<method*start>javax.annotation.Nonnull<method*end>
@Override<method*start>java.lang.Override<method*end>
public PermissionOverrideAction<method*start>net.dv8tion.jda.api.requests.restaction.PermissionOverrideAction<method*end> getManager() {
if (!getGuild<method*start>net.dv8tion.jda.internal.entities.PermissionOverrideImpl.getGuild<method*end>().getSelfMember<method*start>net.dv8tion.jda.api.entities.Invite.Guild.getSelfMember<method*end>().hasPermission(getChannel(), Permission.MANAGE_PERMISSIONS<method*start>net.dv8tion.jda.api.Permission.MANAGE_PERMISSIONS<method*end>))
throw new InsufficientPermissionException(getChannel(), Permission.MANAGE_PERMISSIONS<method*start>net.dv8tion.jda.api.Permission.MANAGE_PERMISSIONS<method*end>);
PermissionOverrideAction<method*start>net.dv8tion.jda.api.requests.restaction.PermissionOverrideAction<method*end> mng = manager;
if (mng == null) {
mng = MiscUtil.locked<method*start>net.dv8tion.jda.api.utils.MiscUtil.locked<method*end>(mngLock, () -> {
if (manager == null)
manager = new PermissionOverrideActionImpl<method*start>net.dv8tion.jda.internal.requests.restaction.PermissionOverrideActionImpl<method*end>(this).setOverride<method*start>net.dv8tion.jda.internal.requests.restaction.PermissionOverrideActionImpl.setOverride<method*end>(false);
return manager;
});
}
return mng.reset<method*start>net.dv8tion.jda.api.requests.restaction.PermissionOverrideAction.reset<method*end>();
}
|
@EventHandler
public void giveKit(final ObserverKitApplyEvent<method*start>tc.oc.commons.bukkit.event.ObserverKitApplyEvent<method*end> event) {
ItemStack<method*start>org.bukkit.inventory.ItemStack<method*end> item = new ItemStack<method*start>org.bukkit.inventory.ItemStack<method*end>(Material<method*start>org.bukkit.Material<method*end>.ICE);
ItemMeta<method*start>org.bukkit.inventory.meta.ItemMeta<method*end> meta = item.getItemMeta();
meta.addItemFlags(ItemFlag<method*start>org.bukkit.inventory.ItemFlag<method*end>.values());
meta.setDisplayName(Translations.get().t("freeze.itemName", event.getPlayer()));
meta.setLore(Collections<method*start>java.util.Collections<method*end>.singletonList(Translations.get().t("freeze.itemDescription", event.getPlayer())));
item.setItemMeta(meta);
event.getPlayer().getInventory().setItem(6, item);
}
|
annotation
|
@EventHandler
public void giveKit(final ObserverKitApplyEvent<method*start>tc.oc.commons.bukkit.event.ObserverKitApplyEvent<method*end> event) {
if (event.getPlayer().hasPermission(Freeze.PERMISSION)) {
ItemStack<method*start>org.bukkit.inventory.ItemStack<method*end> item = new ItemStack<method*start>org.bukkit.inventory.ItemStack<method*end>(Material<method*start>org.bukkit.Material<method*end>.ICE);
ItemMeta<method*start>org.bukkit.inventory.meta.ItemMeta<method*end> meta = item.getItemMeta();
meta.addItemFlags(ItemFlag<method*start>org.bukkit.inventory.ItemFlag<method*end>.values());
meta.setDisplayName(Translations.get().t("freeze.itemName", event.getPlayer()));
meta.setLore(Collections<method*start>java.util.Collections<method*end>.singletonList(Translations.get().t("freeze.itemDescription", event.getPlayer())));
item.setItemMeta(meta);
event.getPlayer().getInventory().setItem(6, item);
}
}
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.