= ApplicationPermissionRepository
:Notice: Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at. http://www.apache.org/licenses/LICENSE-2.0 . Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR  CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

== API

[source,java]
.ApplicationPermissionRepository.java
----
interface ApplicationPermissionRepository {
  Optional<ApplicationPermission> findByUserAndPermissionValue(String username, ApplicationPermissionValue changingPermissionValue)
  Optional<ApplicationPermission> findByRoleAndRuleAndFeature(ApplicationRole holder, ApplicationPermissionRule rule, ApplicationFeatureSort type, String featureFqn)
  Collection<ApplicationPermission> allPermissions()
  Collection<ApplicationPermission> findOrphaned()
  Collection<ApplicationPermission> findByFeatureCached(ApplicationFeatureId featureId)
  Collection<ApplicationPermission> findByRoleAndRuleAndFeatureTypeCached(ApplicationRole holder, ApplicationPermissionRule rule, ApplicationFeatureSort type)
  ApplicationPermission newApplicationPermission()     // <.>
  ApplicationPermission newPermission(ApplicationRole role, ApplicationPermissionRule rule, ApplicationPermissionMode mode, String packageFqn, String className, String memberName)
  ApplicationPermission newPermission(ApplicationRole role, ApplicationPermissionRule rule, ApplicationPermissionMode mode, ApplicationFeatureSort featureSort, String featureFqn)
  ApplicationPermission newPermission(ApplicationRole role, ApplicationPermissionRule rule, ApplicationPermissionMode mode, ApplicationFeatureId featureId)
  ApplicationPermission newPermissionNoCheck(ApplicationRole role, ApplicationPermissionRule rule, ApplicationPermissionMode mode, ApplicationFeatureSort sort, String featureFqn)     // <.>
  List<ApplicationPermission> findByUser(ApplicationUser applicationUser)     // <.>
  List<ApplicationPermission> findByRole(ApplicationRole applicationRole)
  List<ApplicationPermission> findByUserMemento(UserMemento user)     // <.>
  List<ApplicationPermission> findByRoleNames(List<String> roleNames)     // <.>
}
----

<.> xref:#newApplicationPermission_[newApplicationPermission()]
<.> xref:#newPermissionNoCheck_ApplicationRole_ApplicationPermissionRule_ApplicationPermissionMode_ApplicationFeatureSort_String[newPermissionNoCheck(ApplicationRole, ApplicationPermissionRule, ApplicationPermissionMode, ApplicationFeatureSort, String)]
+
--
Intended for use by fixture scripts.
--
<.> xref:#findByUser_ApplicationUser[findByUser(ApplicationUser)]
+
--
Uses the xref:refguide:extensions:index/secman/applib/role/dom/ApplicationRole.adoc[ApplicationRole] s associated with the xref:refguide:extensions:index/secman/applib/user/dom/ApplicationUser.adoc[ApplicationUser] .
--
<.> xref:#findByUserMemento_UserMemento[findByUserMemento(UserMemento)]
+
--
Uses the _UserMemento#getRoles() roles_ held within the provided xref:refguide:applib:index/services/user/UserMemento.adoc[UserMemento] .
--
<.> xref:#findByRoleNames_List[findByRoleNames(List)]
+
--
Returns the set of permissions associated with the provided list of roles (identified by their role name).
--

== Members

[#newApplicationPermission_]
=== newApplicationPermission()

[#newPermissionNoCheck_ApplicationRole_ApplicationPermissionRule_ApplicationPermissionMode_ApplicationFeatureSort_String]
=== newPermissionNoCheck(ApplicationRole, ApplicationPermissionRule, ApplicationPermissionMode, ApplicationFeatureSort, String)

Intended for use by fixture scripts.

[#findByUser_ApplicationUser]
=== findByUser(ApplicationUser)

Uses the xref:refguide:extensions:index/secman/applib/role/dom/ApplicationRole.adoc[ApplicationRole] s associated with the xref:refguide:extensions:index/secman/applib/user/dom/ApplicationUser.adoc[ApplicationUser] .

[#findByUserMemento_UserMemento]
=== findByUserMemento(UserMemento)

Uses the _UserMemento#getRoles() roles_ held within the provided xref:refguide:applib:index/services/user/UserMemento.adoc[UserMemento] .

Added to support _org.apache.isis.applib.services.user.ImpersonateMenu.impersonateWithRoles#act(String, List, String) impersonation by role_ .

[#findByRoleNames_List]
=== findByRoleNames(List)

Returns the set of permissions associated with the provided list of roles (identified by their role name).
