Class SetupAvailability
Decides whether the initial setup of an engine - the creation of the very first administrator - may still be performed.
The setup steps are reachable without authentication by design, so this check is
the only control protecting them. It must therefore consider an engine to be
administered whenever an administrator exists by any of the routes the engine
itself accepts (see
AuthorizationManager.isCamundaAdmin(org.camunda.bpm.engine.impl.identity.Authentication)),
not only by membership in Groups.CAMUNDA_ADMIN:
- a user is a member of one of the configured administrator groups,
- an administrator user is configured, e.g. by the
AdministratorAuthorizationPlugin, - an authorization exists which grants
ALLpermissions on all authorizations, i.e. somebody can already administer authorizations and thus grant themselves any permission.
The last two checks only apply when authorization is enabled: without authorization the engine has no notion of an administrator, and blocking the setup there could lock an operator out of an engine with an empty user database.
All checks query the identity and authorization services and therefore have to be
performed without authentication, see
SecurityActions.runWithoutAuthentication(SecurityActions.SecurityAction, ProcessEngine).
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected static booleanexistsAdministratorAuthorization(ProcessEngine processEngine) Whether somebody already holds an administrator-equivalent authorization onResources.AUTHORIZATION, i.e.protected static booleanexistsAuthorization(ProcessEngine processEngine, Permission permission, String resourceId) Whether a granting authorization onResources.AUTHORIZATIONconveys the given permission.getAdminGroups(ProcessEngineConfigurationImpl configuration) The configured administrator groups, always includingGroups.CAMUNDA_ADMIN.protected static ProcessEngineConfigurationImplgetConfiguration(ProcessEngine processEngine) static StringgetSetupUnavailableReason(ProcessEngine processEngine) static booleanisSetupAvailable(ProcessEngine processEngine)
-
Constructor Details
-
SetupAvailability
protected SetupAvailability()
-
-
Method Details
-
isSetupAvailable
- Returns:
trueif the initial user may still be created through the setup steps
-
existsAdministratorAuthorization
Whether somebody already holds an administrator-equivalent authorization on
Resources.AUTHORIZATION, i.e. one that lets its holder grant themselves every other permission:UPDATEon any resource id.AuthorizationManager#updateonly checksUPDATEagainst the id of the authorization being changed, and the REST layer lets that update rewrite the authorization's subject, resource, resource id and permissions. Being allowed to change a single authorization is therefore enough to turn it into anALL-on-*grant for oneself.CREATEon the resource id*.AuthorizationManager#insertchecksCREATEwithout a resource id, and such a check is only satisfied by an authorization withRESOURCE_ID_ = '*'- aCREATEauthorization scoped to a single id grants nothing.
ALLcontains both permissions, which is what makes the members ofGroups.CAMUNDA_ADMINand the users of theAdministratorAuthorizationPluginadministrators. An engine containing such an authorization is administered even if the administrator group is empty.DELETEis not administrator-equivalent on its own - it cannot grant any permission - so an engine whose only authorization is aDELETEone has no administrator and stays bootstrappable. -
existsAuthorization
protected static boolean existsAuthorization(ProcessEngine processEngine, Permission permission, String resourceId) Whether a granting authorization on
Resources.AUTHORIZATIONconveys the given permission. Only theglobalandgranttypes are queried - arevokeauthorization takes permissions away and must not close the gate.- Parameters:
resourceId- the resource id to restrict to, ornullfor any
-
getAdminGroups
The configured administrator groups, always includingGroups.CAMUNDA_ADMIN. -
getConfiguration
-