本文整理了Java中hudson.model.AbstractItem.checkPermission()
方法的一些代码示例,展示了AbstractItem.checkPermission()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。AbstractItem.checkPermission()
方法的具体详情如下:
包路径:hudson.model.AbstractItem
类名称:AbstractItem
方法名:checkPermission
[英]Short for getACL().checkPermission(p)
[中]getACL()的缩写。检查权限(p)
代码示例来源:origin: jenkinsci/jenkins
job.checkPermission(AbstractItem.DELETE);
job.delete();
} catch (Exception e) {
代码示例来源:origin: jenkinsci/jenkins
job.checkPermission(AbstractItem.CONFIGURE);
job.doReload();
} catch (Exception e) {
代码示例来源:origin: jenkinsci/jenkins
/**
* Writes {@code config.xml} to the specified output stream.
* The user must have at least {@link #EXTENDED_READ}.
* If he lacks {@link #CONFIGURE}, then any {@link Secret}s detected will be masked out.
*/
@Restricted(NoExternalUse.class)
public void writeConfigDotXml(OutputStream os) throws IOException {
checkPermission(EXTENDED_READ);
XmlFile configFile = getConfigFile();
if (hasPermission(CONFIGURE)) {
IOUtils.copy(configFile.getFile(), os);
} else {
String encoding = configFile.sniffEncoding();
String xml = FileUtils.readFileToString(configFile.getFile(), encoding);
Matcher matcher = SECRET_PATTERN.matcher(xml);
StringBuffer cleanXml = new StringBuffer();
while (matcher.find()) {
if (Secret.decrypt(matcher.group(1)) != null) {
matcher.appendReplacement(cleanXml, ">********<");
}
}
matcher.appendTail(cleanXml);
org.apache.commons.io.IOUtils.write(cleanXml.toString(), os, encoding);
}
}
代码示例来源:origin: jenkinsci/jenkins
/**
* Accepts the new description.
*/
@RequirePOST
public synchronized void doSubmitDescription( StaplerRequest req, StaplerResponse rsp ) throws IOException, ServletException {
checkPermission(CONFIGURE);
setDescription(req.getParameter("description"));
rsp.sendRedirect("."); // go to the top page
}
代码示例来源:origin: jenkinsci/jenkins
/**
* Called by {@link #doConfirmRename} and {@code rename.jelly} to validate renames.
* @return {@link FormValidation#ok} if this item can be renamed as specified, otherwise
* {@link FormValidation#error} with a message explaining the problem.
*/
@Restricted(NoExternalUse.class)
public @Nonnull FormValidation doCheckNewName(@QueryParameter String newName) {
// TODO: Create an Item.RENAME permission to use here, see JENKINS-18649.
if (!hasPermission(Item.CONFIGURE)) {
if (parent instanceof AccessControlled) {
((AccessControlled)parent).checkPermission(Item.CREATE);
}
checkPermission(Item.DELETE);
}
newName = newName == null ? null : newName.trim();
try {
Jenkins.checkGoodName(newName);
assert newName != null; // Would have thrown Failure
if (newName.equals(name)) {
return FormValidation.warning(Messages.AbstractItem_NewNameUnchanged());
}
Jenkins.get().getProjectNamingStrategy().checkName(newName);
checkIfNameIsUsed(newName);
checkRename(newName);
} catch (Failure e) {
return FormValidation.error(e.getMessage());
}
return FormValidation.ok();
}
代码示例来源:origin: jenkinsci/jenkins
checkPermission(CONFIGURE);
XmlFile configXmlFile = getConfigFile();
final AtomicFileWriter out = new AtomicFileWriter(configXmlFile.getFile());
代码示例来源:origin: jenkinsci/jenkins
checkPermission(DELETE);
boolean responsibleForAbortingBuilds = !ItemDeletion.contains(this);
boolean ownsRegistration = ItemDeletion.register(this);
代码示例来源:origin: jenkinsci/jenkins
/**
* Reloads this job from the disk.
*
* Exposed through CLI as well.
*
* TODO: think about exposing this to UI
*
* @since 1.556
*/
@RequirePOST
public void doReload() throws IOException {
checkPermission(CONFIGURE);
// try to reflect the changes by reloading
getConfigFile().unmarshal(this);
Items.whileUpdatingByXml(new NotReallyRoleSensitiveCallable<Void, IOException>() {
@Override
public Void call() throws IOException {
onLoad(getParent(), getRootDir().getName());
return null;
}
});
Jenkins.getInstance().rebuildDependencyGraphAsync();
SaveableListener.fireOnChange(this, getConfigFile());
}
代码示例来源:origin: org.eclipse.hudson.main/hudson-core
/**
* Accepts the new description.
*/
public synchronized void doSubmitDescription( StaplerRequest req, StaplerResponse rsp ) throws IOException, ServletException {
checkPermission(CONFIGURE);
setDescription(req.getParameter("description"));
rsp.sendRedirect("."); // go to the top page
}
代码示例来源:origin: org.jenkins-ci.main/jenkins-core
job.checkPermission(AbstractItem.DELETE);
job.delete();
} catch (Exception e) {
代码示例来源:origin: org.eclipse.hudson/hudson-core
/**
* Accepts the new description.
*/
public synchronized void doSubmitDescription(StaplerRequest req, StaplerResponse rsp) throws IOException, ServletException {
checkPermission(CONFIGURE);
setDescription(req.getParameter("description"));
rsp.sendRedirect("."); // go to the top page
}
代码示例来源:origin: org.jvnet.hudson.main/hudson-core
/**
* Accepts the new description.
*/
public synchronized void doSubmitDescription( StaplerRequest req, StaplerResponse rsp ) throws IOException, ServletException {
checkPermission(CONFIGURE);
setDescription(req.getParameter("description"));
rsp.sendRedirect("."); // go to the top page
}
代码示例来源:origin: hudson/hudson-2.x
/**
* Accepts the new description.
*/
public synchronized void doSubmitDescription( StaplerRequest req, StaplerResponse rsp ) throws IOException, ServletException {
checkPermission(CONFIGURE);
setDescription(req.getParameter("description"));
rsp.sendRedirect("."); // go to the top page
}
代码示例来源:origin: org.jenkins-ci.main/jenkins-core
/**
* Writes {@code config.xml} to the specified output stream.
* The user must have at least {@link #EXTENDED_READ}.
* If he lacks {@link #CONFIGURE}, then any {@link Secret}s detected will be masked out.
*/
@Restricted(NoExternalUse.class)
public void writeConfigDotXml(OutputStream os) throws IOException {
checkPermission(EXTENDED_READ);
XmlFile configFile = getConfigFile();
if (hasPermission(CONFIGURE)) {
IOUtils.copy(configFile.getFile(), os);
} else {
String encoding = configFile.sniffEncoding();
String xml = FileUtils.readFileToString(configFile.getFile(), encoding);
Matcher matcher = SECRET_PATTERN.matcher(xml);
StringBuffer cleanXml = new StringBuffer();
while (matcher.find()) {
if (Secret.decrypt(matcher.group(1)) != null) {
matcher.appendReplacement(cleanXml, ">********<");
}
}
matcher.appendTail(cleanXml);
org.apache.commons.io.IOUtils.write(cleanXml.toString(), os, encoding);
}
}
代码示例来源:origin: org.eclipse.hudson.main/hudson-core
/**
* Deletes this item.
*/
public synchronized void delete() throws IOException, InterruptedException {
checkPermission(DELETE);
performDelete();
try {
invokeOnDeleted();
} catch (AbstractMethodError e) {
// ignore
}
Hudson.getInstance().rebuildDependencyGraph();
}
代码示例来源:origin: org.jenkins-ci.main/jenkins-core
/**
* Accepts the new description.
*/
@RequirePOST
public synchronized void doSubmitDescription( StaplerRequest req, StaplerResponse rsp ) throws IOException, ServletException {
checkPermission(CONFIGURE);
setDescription(req.getParameter("description"));
rsp.sendRedirect("."); // go to the top page
}
代码示例来源:origin: org.jvnet.hudson.main/hudson-core
/**
* Deletes this item.
*/
public synchronized void delete() throws IOException, InterruptedException {
checkPermission(DELETE);
performDelete();
try {
invokeOnDeleted();
} catch (AbstractMethodError e) {
// ignore
}
Hudson.getInstance().rebuildDependencyGraph();
}
代码示例来源:origin: hudson/hudson-2.x
/**
* Deletes this item.
*/
public synchronized void delete() throws IOException, InterruptedException {
checkPermission(DELETE);
performDelete();
try {
invokeOnDeleted();
} catch (AbstractMethodError e) {
// ignore
}
Hudson.getInstance().rebuildDependencyGraph();
}
代码示例来源:origin: org.eclipse.hudson/hudson-core
/**
* Deletes this item.
*/
public void delete() throws IOException, InterruptedException {
final ItemGroup group = getParent();
// Obtain delete lock
synchronized (getDeleteLock()) {
// Lock parent, and then 'this' before deleting.
synchronized (group) {
synchronized (this) {
checkPermission(DELETE);
performDelete();
try {
invokeOnDeleted();
} catch (AbstractMethodError e) {
// ignore
}
Hudson.getInstance().rebuildDependencyGraph();
}
}
}
}
代码示例来源:origin: org.jenkins-ci.main/jenkins-core
/**
* Reloads this job from the disk.
*
* Exposed through CLI as well.
*
* TODO: think about exposing this to UI
*
* @since 1.556
*/
@RequirePOST
public void doReload() throws IOException {
checkPermission(CONFIGURE);
// try to reflect the changes by reloading
getConfigFile().unmarshal(this);
Items.whileUpdatingByXml(new NotReallyRoleSensitiveCallable<Void, IOException>() {
@Override
public Void call() throws IOException {
onLoad(getParent(), getRootDir().getName());
return null;
}
});
Jenkins.getInstance().rebuildDependencyGraphAsync();
SaveableListener.fireOnChange(this, getConfigFile());
}
内容来源于网络,如有侵权,请联系作者删除!