Uploaded image for project: 'Bitbucket Data Center'
  1. Bitbucket Data Center
  2. BSERV-5041

IsPersonalProjectCondition/IsPersonalRepositoryCondition doesn't work from a plugin

    XMLWordPrintable

Details

    Description

      https://developer.atlassian.com/static/javadoc/stash/3.1.3/web-common/reference/com/atlassian/stash/web/conditions/IsPersonalProjectCondition.html is a documented condition that checks if a project is a personal project or not. However, this doesn't work from a plugin, because that condition's constructor (and the related IsPersonalRepositoryCondition) takes an InternalProjectService param, and that bean isn't exported.

      Loading a plugin with the web-item in atlassian-plugin.xml :

      <web-item key="test" name="test" section="stash.repository.nav" weight="1000">
      <label key="label" />
      <param name="stashIconClass" value="aui-icon-small aui-iconfont-add" />
      <link>/</link>

      <condition class="com.atlassian.stash.web.conditions.IsPersonalRepositoryCondition">
      <param name="onlyMine">false</param>
      </condition>
      </web-item>

      gives the error:

      [INFO] [talledLocalContainer] 2014-07-24 17:51:05,737 ERROR [UpmAsynchronousTaskManager:thread-3] admin 1071x3033x0 6mkppg 127.0.0.1 "POST /rest/plugins/1.0/ HTTP/1.1" c.a.p.manager.DefaultPluginManager There was an error loading the descriptor 'test' of plugin 'com.example.stash.projectconditionerror'. Disabling.
      [INFO] [talledLocalContainer] org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'com.atlassian.stash.web.conditions.IsPersonalRepositoryCondition': Unsatisfied dependency expressed through constructor argument with index 0 of type [com.atlassian.stash.internal.project.InternalProjectService]: : No unique bean of type [com.atlassian.stash.internal.project.InternalProjectService] is defined: Unsatisfied dependency of type [interface com.atlassian.stash.internal.project.InternalProjectService]: expected at least 1 matching bean; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No unique bean of type [com.atlassian.stash.internal.project.InternalProjectService] is defined: Unsatisfied dependency of type [interface com.atlassian.stash.internal.project.InternalProjectService]: expected at least 1 matching bean

      A search for 'Internal' in the source code (stash-parent/web-common/src/main/java/com/atlassian/stash/web/conditions) shows a few other potentially useful conditions that may have the same issue (eg HasPullRequestWatchCondition and HasPersonalForkCondition) although I haven't tried using those.

      Attachments

        Issue Links

          Activity

            People

              aahmed Adam Ahmed (Inactive)
              06fbb7509c24 Bradley Baetz
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: