/** * If true, this is a view that renders the top page of Hudson. */ public boolean isDefault() { return getOwner().getPrimaryView()==this; }
/** * Returns the transient {@link Action}s associated with the top page. * * <p> * If views don't want to show top-level actions, this method * can be overridden to return different objects. * * @see Jenkins#getActions() */ public List<Action> getActions() { List<Action> result = new ArrayList<>(); result.addAll(getOwner().getViewActions()); result.addAll(TransientViewActionFactory.createAllFor(this)); return result; }
/** * Gets the {@link TopLevelItem} of the given name. */ public TopLevelItem getItem(String name) { return getOwner().getItemGroup().getItem(name); }
/** * Implementation can choose to provide different ACL for different views. * This can be used as a basis for more fine-grained access control. * * <p> * The default implementation makes the view visible if any of the items are visible * or the view is configurable. * * @since 1.220 */ public @Nonnull ACL getACL(final @Nonnull View item) { return ACL.lambda((a, permission) -> { ACL base = item.getOwner().getACL(); boolean hasPermission = base.hasPermission(a, permission); if (!hasPermission && permission == View.READ) { return base.hasPermission(a,View.CONFIGURE) || !item.getItems().isEmpty(); } return hasPermission; }); }
/** * Makes sure that the given name is good as a job name. * For use from {@code newJob}. */ @Restricted(DoNotUse.class) // called from newJob view public FormValidation doCheckJobName(@QueryParameter String value) { // this method can be used to check if a file exists anywhere in the file system, // so it should be protected. getOwner().checkPermission(Item.CREATE); if (Util.fixEmpty(value) == null) { return FormValidation.ok(); } try { Jenkins.checkGoodName(value); value = value.trim(); // why trim *after* checkGoodName? not sure, but ItemGroupMixIn.createTopLevelItem does the same Jenkins.getInstance().getProjectNamingStrategy().checkName(value); } catch (Failure e) { return FormValidation.error(e.getMessage()); } if (getOwner().getItemGroup().getItem(value) != null) { return FormValidation.error(Messages.Hudson_JobAlreadyExists(value)); } // looks good return FormValidation.ok(); }
ViewGroup group = view.getOwner(); if (!group.canDelete(view)) { throw new IllegalStateException(String.format("%s does not allow to delete '%s' view",
if (last.getObject() instanceof View) { View view = (View) last.getObject(); if (view.getOwner().getItemGroup() == getParent() && !view.isDefault()) {
@Restricted(NoExternalUse.class) // for cc.xml.jelly public static Collection<TopLevelItem> getCCItems(View v) { if (Stapler.getCurrentRequest().getParameter("recursive") != null) { return v.getOwner().getItemGroup().getAllItems(TopLevelItem.class); } else { return v.getItems(); } }
getOwner().checkPermission(Item.CREATE); ctx = null; for (TopLevelItemDescriptor descriptor : DescriptorVisibilityFilter.apply(getOwner().getItemGroup(), Items.all(Jenkins.getAuthentication(), getOwner().getItemGroup()))) { ItemCategory ic = ItemCategory.getCategory(descriptor); Map<String, Serializable> metadata = new HashMap<String, Serializable>();
url = i.getShortUrl()+url; if(ig== Jenkins.getInstance() || (view != null && ig == view.getOwner().getItemGroup())) { assert i instanceof TopLevelItem; if (view != null) {
public ViewGroup superGetOwner() { return super.getOwner(); }
/** * If true, this is a view that renders the top page of Hudson. */ public boolean isDefault() { return getOwner().getPrimaryView()==this; }
/** * Implementation can choose to provide different ACL for different views. * This can be used as a basis for more fine-grained access control. * * <p> The default implementation returns the ACL of the ViewGroup. * * @since 1.220 */ public ACL getACL(View item) { return item.getOwner().getACL(); }
/** * Implementation can choose to provide different ACL for different views. * This can be used as a basis for more fine-grained access control. * * <p> * The default implementation returns the ACL of the ViewGroup. * * @since 1.220 */ public ACL getACL(View item) { return item.getOwner().getACL(); }
/** * Implementation can choose to provide different ACL for different views. * This can be used as a basis for more fine-grained access control. * * <p> * The default implementation returns the ACL of the ViewGroup. * * @since 1.220 */ public ACL getACL(View item) { return item.getOwner().getACL(); }
/** * Implementation can choose to provide different ACL for different views. * This can be used as a basis for more fine-grained access control. * * <p> * The default implementation returns the ACL of the ViewGroup. * * @since 1.220 */ public ACL getACL(View item) { return item.getOwner().getACL(); }
/** * Gets the {@link TopLevelItem} of the given name. */ public TopLevelItem getItem(String name) { return getOwner().getItemGroup().getItem(name); }
@Override public boolean hasPermission(Authentication a, Permission permission) { ACL base = item.getOwner().getACL(); boolean hasPermission = base.hasPermission(a, permission); if (!hasPermission && permission == View.READ) { return base.hasPermission(a,View.CONFIGURE) || !item.getItems().isEmpty(); } return hasPermission; } };
@Override public ViewGroup getOwner() { initPython(); if (pexec.isImplemented(3)) { return (ViewGroup) pexec.execPython("get_owner"); } else { return super.getOwner(); } }
@Restricted(NoExternalUse.class) // for cc.xml.jelly public static Collection<TopLevelItem> getCCItems(View v) { if (Stapler.getCurrentRequest().getParameter("recursive") != null) { return Items.getAllItems(v.getOwner().getItemGroup(), TopLevelItem.class); } else { return v.getItems(); } }