Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Warning

The ability to define UI features in properties files was introduced in XNAT 1.6, but support for this was removed in XNAT 1.7. However, these URIs still function, if on a limited basis.

Contents:

Table of Contents


Defining Feature Permissions

Features are registered in XNAT via properties files which are loaded by XNAT on server startup (or first access).  The server will look for any files which end with *-feature-definition.properties.  All features which are automatically a part of XNAT should be defined in the xnat-feature-definition.properties file.  Features developed for specific modules should be defined using a unique string in the properties file name.

...

Code Block
#if($user.checkFeature($om, "feature_key")
   <div>some content of varying complexity</div>
#end
Warning
This velocity method of checking user permissions is not supported in XNAT 1.7. See Changes in XNAT that affect Customizations.



Get All Defined Features In A Site

Code Block
GET - /data/services/features?type=admin

...

Code Block
[
  {
    "groups": [
      {
        "features": [],
        "blocked": [],
        "display": "Owners",
        "id": "Owners"
      },
      ...,
      {
        "features": [],
        "blocked": [
          
        ],
        "display": "Role: Site Manager",
        "isRole": true,
        "id": "role:Administrator"
      },
      ...
    ],
    "id": "_SITE_WIDE",
    "banned": [],
    "onByDefault": [
      "manage_files"
    ]
  }
]


Get All Defined Features In A Project

Code Block
GET - /data/services/features?tag={project_id}

...

Code Block
[
  {
    "groups": [
      {
        "features": [],
        "inherited_features": [],
        "inherited_banned": [],
        "blocked": [],
        "display": "Owners",
        "id": "Project_ID_owner"
      },
      ...
    ],
    "id": "Project_ID",
    "banned": [],
    "onByDefault": [
      "manage_files"
    ]
  }
]



Block Access To A Feature That Is On By Default

If a feature is defined with "OnByDefault" set to "true", then it can be disabled for specific projects or user groups.

...

{project_group_id}Required querystring parameter. Specifies the project access group to restrict from using this feature
keyRequired body parameter. Specifies the key associated with the defined feature.
banned

Required body parameter.

  • true: Restrict access to this feature for the specified group
  • false: Remove restriction to this feature for the specified group


Enable Access To A Feature That Is Off By Default

If a feature is defined with "OnByDefault" set to "false" or null, then it can be enabled for specific projects or user groups.

...