This server will be upgraded at 3pm Sydney time on December 3rd (December 2nd, 8pm PST) and will be down for up to 30 minutes.

Space Access Macro

The space access macro provides a list of users that have at least view privileges to the space in which the page containing the macro is located.

This macro is very useful for more restrictive spaces. Sometimes people are hesitant to post sensitive information to certain spaces because they aren't sure who can read it. This macro was created to address that issue.

Usage

The macro takes no parameters and has no body content.

{space-access}

 

Download

Confluence 1.4 JAR, Source
Confluence 2.2 JAR, Source

Screenshot

Download & Installation Instructions

  1. Download the macro above
  2. Upload the plugin through the Plugins Administration screen, or drop it into WEB-INF/lib inside the Confluence web application and restart Confluence.

Build from Source

Source code originally developed by Near Infinity and released under the Apache License, version 2.0

  1. Download the distribution
  2. Extract to any convenient directory
  3. Open build.properties and edit the webapp.dir property to point at the base directory of an existing Confluence web application
  4. Run ant build from the directory containing the build.xml file
  5. Locate the distribution named macros-space-access.jar in the dist directory and drop it into WEB-INF/lib inside the Confluence web application
  6. Re-start Confluence

Labels

confluence14 confluence14 Delete
plugin plugin Delete
repository-testing repository-testing Delete
non-repository non-repository Delete
Enter labels to add to this page:
Please wait 
Looking for a label? Just start typing.
  1. Jul 20, 2005

    Guy Fraser says:

    If anonymous users have access to a space, this macro does not display that whic...

    If anonymous users have access to a space, this macro does not display that which could lead to people mistakenly thinking that their content is secured to certain groups of people.

    Other than that, it's a great macro! Are there any plans for a {page-access} macro in the future, that would show who can edit/view a page based on either the page specific privs or, if none are set, the space privs? I'm guessing that the macro would have to first limit by space privs and then by page specific privs as people without access to the space could not get to the page even if they have specific privileges to do so on that page?

  2. Jan 09, 2006

    Cheryl Chase says:

    It seems this doesn't work with Confluence 2.1.1 (warnings about several depreca...

    It seems this doesn't work with Confluence 2.1.1 (warnings about several deprecated classes, and errors (can't find method) for getActiveUsers and hasPermission).

    Any chance of upgrading this to 2.1.1? Or give me a hint about how to proceed? (I'm not a Java programmer, so probably the hint would consist of pointing me to some specs about methods made available in 2.1.2).

  3. Jan 09, 2006

    Cheryl Chase says:

    If I search http://confluence.atlassian.com for getActiveUsers, I get only two h...

    If I search http://confluence.atlassian.com for getActiveUsers, I get only two hits: this page and a page that discusses Remote API and whether you should use SOAP or XML-RPC, and mentions that was added to the remote API at version 2.0. Hmm. Does the space access macro use a remote API? If so, which? If so, where can I find a spec of all the methods provided by the API?

    1. Jan 09, 2006

      Guy Fraser says:

      Is this what you are after: http://www.atlassian.com/software/confluence/docs/a...

      Is this what you are after:

      http://www.atlassian.com/software/confluence/docs/api/latest/

      The user management was changed significantly in 2.1.1 so I'm not sure if method names, etc., will still be the same. I know David Peterson and several other plugin developers have had to spend many hours in dark rooms chaning over to the new API. David is close to having his upgraded utilities macro and as such it may be possible to get this space-access macro to use that as a basis for it's user privileges checking, etc - if so that would in theory allow space-access to be used on all versions of Confluence?

      1. Jan 09, 2006

        David Peterson [CustomWare] says:

        I'm guessing the change in the user API is indeed the culprit here. Utilities do...

        I'm guessing the change in the user API is indeed the culprit here. Utilities doesn't currently handle the 'getActiveUsers' case, but it could. Alternately, it is probably just a matter of recompiling space-access with the new User object, which may be simpler...

  4. Jan 19, 2006

    Guy Fraser says:

    I just tried to add a confluence14 label to this page so the macro appears in th...

    I just tried to add a confluence14 label to this page so the macro appears in the list of conf 1.4 compatible macros, but was not allowed - could the page owner or an admin please add the label?

    1. Jan 19, 2006

      Jeremy Higgs says:

      Hi Guy, I just fixed that (using Jens' account), but had to remove Jeff's edit ...

      Hi Guy,

      I just fixed that (using Jens' account), but had to remove Jeff's edit restriction, which he can re-implement if he wants...

      Jeremy

  5. Mar 02, 2006

    Bob Swift says:

    This doesn't work on 2.1. Any plans for fixing it?

    This doesn't work on 2.1. Any plans for fixing it?

  6. Mar 26, 2006

    Jeff Hatfield says:

    I just realized that this doesn't work after we upgraded to 2.1.4.   I...

    I just realized that this doesn't work after we upgraded to 2.1.4.   It would really be helpful if it could be fixed.

  7. Sep 19, 2006

    Jim Clark says:

    I'm new to writing Confluence macros but I think I've created a version of the s...

    I'm new to writing Confluence macros but I think I've created a version of the space-access macro that works in Confluence 2.2. Unfortunately, I have a "personal" license so I'm limited to 2 users. Feel free to download it here and give it a try. Source code is here If all works ok I'll update the links on the main page.

    1. Sep 19, 2006

      Bob Swift says:

      Thanks for doing this. Seems to work in our LDAP environment on 2.2.9. If you c...

      Thanks for doing this. Seems to work in our LDAP environment on 2.2.9. If you could add it the the Confluence Repository, that would be helpful.

    2. Oct 06, 2006

      Thomas Burkhart says:

      Hi, I installed it here, but it seems that it does not list all Users only some...

      Hi,

      I installed it here, but it seems that it does not list all Users only some of them that have permissions.

      I have no Idea why.

      Cheers

      Thomas

      1. Oct 06, 2006

        David Peterson [CustomWare] says:

        I believe that that is the point of this particular macro - it just list people ...

        I believe that that is the point of this particular macro - it just list people who can view the current space.

        1. Oct 06, 2006

          Thomas Burkhart says:

          I meant it only lists part of the users that can view the current space.

          I meant it only lists part of the users that can view the current space.

          1. Oct 06, 2006

            Guy Fraser says:

            From memory this macro doesn't list whether anonymous users can view the space a...

            From memory this macro doesn't list whether anonymous users can view the space and I think it also omits confluence-users group as well ?

            1. Oct 06, 2006

              David Peterson [CustomWare] says:

              That would seem to defeat the purpose - it should at least mention that anonymou...

              That would seem to defeat the purpose - it should at least mention that anonymous users and/or all logged-in users can view the site. Not mentioning it at all is rather misleading, if that's the case.

              That said, I've never used it, so that could be completely not the case

  8. Oct 05, 2006

    Stefan Baader says:

    A great macro. Unfortunately it doesn't work with our CONF 2.1.5a Version. Any i...

    A great macro. Unfortunately it doesn't work with our CONF 2.1.5a Version. Any ideas?

    Text on rendered page: Error rendering macro: java.lang.NoSuchMethodError: com.atlassian.confluence.user.UserAccessor.getActiveUsers()Ljava/util/List;

    Kind Regards, Stefan

    1. Oct 06, 2006

      Jim Clark says:

      Try the version I posted that works for 2.2 macros-space-access2.jar These are ...

      Try the version I posted that works for 2.2 macros-space-access2.jar

      These are old Confluence APIs, you can read more by reading the threads above.
      com.atlassian.confluence.user.UserAccessor.getActiveUsers()Ljava/util/List

      Regarding "anonymous", yes, it appears that anonymous isn't displayed. I'll look into the API to see how I can determine that.

      1. Oct 06, 2006

        David Peterson [CustomWare] says:

        Not sure how you're doing your testing so far, but one way is to use the Permiss...

        Not sure how you're doing your testing so far, but one way is to use the PermissionManager. Eg:

        boolean anonAccess = permissionManager.hasPermission(null, Permission.VIEW, myPage);
        
        1. Oct 10, 2006

          Jim Clark says:

          I've added the "anonymous" user to the list if they have space access, using the...

          I've added the "anonymous" user to the list if they have space access, using the code you have above. I noticed you used "myPage", just a reminder this is for space access, not page access. Perhaps a page access macro would be beneficial too.

      2. Oct 09, 2006

        Thomas Burkhart says:

        Hi, as I posted above, it seems that the macro has some problems with our LDAP ...

        Hi,

        as I posted above, it seems that the macro has some problems with our LDAP Active directory. Only part of the permitted users are displayed.

        Cheers

        Thomas

        1. Oct 10, 2006

          Jim Clark says:

          Currently, the macro is written to see if a given user has view access to the cu...

          Currently, the macro is written to see if a given user has view access to the current space (not page). I'm not sure what the issues are that you're having, but here's the basic logic, so whatever the "getUsers" method is returning, this is what is used to check view access.

                  for (Iterator iter = userAccessor.getUsers().iterator(); iter.hasNext(); ) {
                      User user = (User)iter.next();
                      if (manager.hasPermission(SpacePermission.VIEWSPACE_PERMISSION, space, user)) {
                          users.add(user);
                      }
                  }
          
          1. Oct 11, 2006

            Thomas Burkhart says:

            Makes for me sense, but I don't now anything about the Jira-API. Could it be tha...

            Makes for me sense, but I don't now anything about the Jira-API. Could it be that it has something to do that I don't use individual permission but only group (LDAP) permissions for my space?

            Cheers Thomas

      3. Oct 11, 2006

        Stefan Baader says:

        Hi Jim, thanks so much. It works with CONF 2.2.9. Great. Kind Regards Stefan...

        Hi Jim,

        thanks so much. It works with CONF 2.2.9. Great.

        Kind Regards

        Stefan 

  9. Nov 03, 2006

    Frankenstein says:

    is it possible to use this macro - or any other to display not just the users wh...

    is it possible to use this macro - or any other to display not just the users who have access to a space but how often users have accessed a space? What i'm looking for is:

    1. list of users who have access to a space - this macro works fine

    2. track user access to a space

    So it would look something like:

    username: # of times user has accessed the space

    -J

    1. Nov 10, 2006

      Jim Clark says:

      You might want to try the Tracking Plugin

      You might want to try the Tracking Plugin

  10. Mar 17, 2007

    Jeff Shaffer says:

    I just installed 2.4.2 Build: #703 and I'm getting the error below when the Unkn...

    I just installed 2.4.2 Build: #703 and I'm getting the error below when the

    Unknown macro: {space-access}
    macro is rendered.

    Works great in the 2.3.2 Build: #645 installation I imported from.

    Any help would be appreciated.

    -Jeff 

  11. Mar 17, 2007

    Jeff Shaffer says:

    re: last posting... It looks like the macro within my comment was processed by t...

    re: last posting... It looks like the macro within my comment was processed by this instance of Confluence. Sorry about that.

    Here's the error message:Error rendering macro: java.lang.NoSuchMethodError: com.atlassian.confluence.user.UserAccessor.getActiveUsers()Ljava/util/List;

    1. Mar 18, 2007

      Jim Clark says:

      You may need to get a more recent version that worked w/ Confluence 2.2. Visit ...

      You may need to get a more recent version that worked w/ Confluence 2.2. Visit the space-access macro home, grab and install the 2.2 version of the space-access jar

      I just installed 2.4.2 fresh and installed the space-access macro (the 2.2 version) and that worked fine.

      Jim

      1. Mar 19, 2007

        Jeff Shaffer says:

        Jim, Thanks. You'e quite right. I simply clicked on the wrong version .jar file...

        Jim,

        Thanks. You'e quite right. I simply clicked on the wrong version .jar file. Thanks for the help.

        -Jeff

  12. Dec 20, 2007

    Adrian Ellis says:

    Great, can you add a feature to display which user groups have access instead? I...

    Great, can you add a feature to display which user groups have access instead? I have a very long list of users whereas I really want to see:

    Restricted to 'Management Team'. Ideally just listing the group which access has been restricted to in the list but fine if it iterates across user groups instead of users.

    Cheers Adrian

    1. Dec 20, 2007

      James Mortimer says:

      there is a prototype user macro that does this. I'd love if someone would conver...

      there is a prototype user macro that does this. I'd love if someone would convert it into a real macro.
      space-permissions user macro

      1. Dec 20, 2007

        Adrian Ellis says:

        A-ha, that's the type of thing I'm looking for. I'll keep a watch on the page......

        A-ha, that's the type of thing I'm looking for. I'll keep a watch on the page...

        Thanks

  13. Dec 20, 2007

    Adrian Ellis says:

    Also, would be great if a page level version of this macro existed. Did a search...

    Also, would be great if a page level version of this macro existed. Did a search but didn't find one

    Cheers, Adrian