test_class.declarator: root
test_class.modifier: private
test_class.original_string: private Root root;
test_class.type: Root
test_class.var_name: root
test_class.declarator: defaultConfig
test_class.modifier: private
test_class.original_string: private ConfigurationParameters defaultConfig;
test_class.type: ConfigurationParameters
test_class.var_name: defaultConfig
test_class.declarator: defaultUserPath
test_class.modifier: private
test_class.original_string: private String defaultUserPath;
test_class.type: String
test_class.var_name: defaultUserPath
test_class.declarator: defaultGroupPath
test_class.modifier: private
test_class.original_string: private String defaultGroupPath;
test_class.type: String
test_class.var_name: defaultGroupPath
test_class.declarator: customOptions
test_class.modifier: private
test_class.original_string: private Map<String, Object> customOptions;
test_class.type: Map<String, Object>
test_class.var_name: customOptions
test_class.declarator: customUserPath = "/home/users"
test_class.modifier: private
test_class.original_string: private String customUserPath = "/home/users";
test_class.type: String
test_class.var_name: customUserPath
test_class.declarator: customGroupPath = "/home/groups"
test_class.modifier: private
test_class.original_string: private String customGroupPath = "/home/groups";
test_class.type: String
test_class.var_name: customGroupPath
test_class.file: oak-core/src/test/java/org/apache/jackrabbit/oak/security/user/UserProviderTest.java
test_class.identifier: UserProviderTest
test_case.body: @Test
      public void testGetAuthorizableByPrincipal() throws Exception {
          UserProvider up = createUserProvider();
          up.createUser("uid", null);
          TreeBasedPrincipal tbp = new TreeBasedPrincipal("uid", "/path", NamePathMapper.DEFAULT) {
              @Override
              @NotNull String getOakPath() {
                  return "/path";
              }
          };
          // changes not yet persisted -> query returns no result.
          assertNotNull(up.getAuthorizableByPrincipal(tbp));
      }
test_case.class_method_signature: UserProviderTest.testGetAuthorizableByPrincipal()
test_case.full_signature: @Test public void testGetAuthorizableByPrincipal()
test_case.identifier: testGetAuthorizableByPrincipal
test_case.invocations: createUserProvider createUser assertNotNull getAuthorizableByPrincipal
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void testGetAuthorizableByPrincipal()
focal_class.declarator: log = LoggerFactory.getLogger(UserProvider.class)
focal_class.modifier: private static final
focal_class.original_string: private static final Logger log = LoggerFactory.getLogger(UserProvider.class);
focal_class.type: Logger
focal_class.var_name: log
focal_class.declarator: DELIMITER = "/"
focal_class.modifier: private static final
focal_class.original_string: private static final String DELIMITER = "/";
focal_class.type: String
focal_class.var_name: DELIMITER
focal_class.declarator: defaultDepth
focal_class.modifier: private final
focal_class.original_string: private final int defaultDepth;
focal_class.type: int
focal_class.var_name: defaultDepth
focal_class.declarator: groupPath
focal_class.modifier: private final
focal_class.original_string: private final String groupPath;
focal_class.type: String
focal_class.var_name: groupPath
focal_class.declarator: userPath
focal_class.modifier: private final
focal_class.original_string: private final String userPath;
focal_class.type: String
focal_class.var_name: userPath
focal_class.file: oak-core/src/main/java/org/apache/jackrabbit/oak/security/user/UserProvider.java
focal_class.identifier: UserProvider
focal_class.class_method_signature: UserProvider.UserProvider(@NotNull Root root, @NotNull ConfigurationParameters config)
focal_class.full_signature:   UserProvider(@NotNull Root root, @NotNull ConfigurationParameters config)
focal_class.identifier: UserProvider
focal_class.parameters: (@NotNull Root root, @NotNull ConfigurationParameters config)
focal_class.signature:  UserProvider(@NotNull Root root, @NotNull ConfigurationParameters config)
focal_class.class_method_signature: UserProvider.createUser(@NotNull String userID, @Nullable String intermediateJcrPath)
focal_class.full_signature: @NotNull Tree createUser(@NotNull String userID, @Nullable String intermediateJcrPath)
focal_class.identifier: createUser
focal_class.modifiers: @NotNull
focal_class.parameters: (@NotNull String userID, @Nullable String intermediateJcrPath)
focal_class.return: Tree
focal_class.signature: Tree createUser(@NotNull String userID, @Nullable String intermediateJcrPath)
focal_class.class_method_signature: UserProvider.createGroup(@NotNull String groupID, @Nullable String intermediateJcrPath)
focal_class.full_signature: @NotNull Tree createGroup(@NotNull String groupID, @Nullable String intermediateJcrPath)
focal_class.identifier: createGroup
focal_class.modifiers: @NotNull
focal_class.parameters: (@NotNull String groupID, @Nullable String intermediateJcrPath)
focal_class.return: Tree
focal_class.signature: Tree createGroup(@NotNull String groupID, @Nullable String intermediateJcrPath)
focal_class.class_method_signature: UserProvider.createSystemUser(@NotNull String userID, @Nullable String intermediateJcrPath)
focal_class.full_signature: @NotNull Tree createSystemUser(@NotNull String userID, @Nullable String intermediateJcrPath)
focal_class.identifier: createSystemUser
focal_class.modifiers: @NotNull
focal_class.parameters: (@NotNull String userID, @Nullable String intermediateJcrPath)
focal_class.return: Tree
focal_class.signature: Tree createSystemUser(@NotNull String userID, @Nullable String intermediateJcrPath)
focal_class.class_method_signature: UserProvider.getAuthorizable(@NotNull String authorizableId)
focal_class.full_signature: @Nullable Tree getAuthorizable(@NotNull String authorizableId)
focal_class.identifier: getAuthorizable
focal_class.modifiers: @Nullable
focal_class.parameters: (@NotNull String authorizableId)
focal_class.return: Tree
focal_class.signature: Tree getAuthorizable(@NotNull String authorizableId)
focal_class.class_method_signature: UserProvider.getAuthorizableByPath(@NotNull String authorizableOakPath)
focal_class.full_signature: @Nullable Tree getAuthorizableByPath(@NotNull String authorizableOakPath)
focal_class.identifier: getAuthorizableByPath
focal_class.modifiers: @Nullable
focal_class.parameters: (@NotNull String authorizableOakPath)
focal_class.return: Tree
focal_class.signature: Tree getAuthorizableByPath(@NotNull String authorizableOakPath)
focal_class.class_method_signature: UserProvider.getAuthorizableByPrincipal(@NotNull Principal principal)
focal_class.full_signature: @Nullable Tree getAuthorizableByPrincipal(@NotNull Principal principal)
focal_class.identifier: getAuthorizableByPrincipal
focal_class.modifiers: @Nullable
focal_class.parameters: (@NotNull Principal principal)
focal_class.return: Tree
focal_class.signature: Tree getAuthorizableByPrincipal(@NotNull Principal principal)
focal_class.class_method_signature: UserProvider.createAuthorizableNode(@NotNull String authorizableId,
                                          @NotNull String ntName,
                                          @Nullable String intermediatePath)
focal_class.full_signature: private Tree createAuthorizableNode(@NotNull String authorizableId,
                                          @NotNull String ntName,
                                          @Nullable String intermediatePath)
focal_class.identifier: createAuthorizableNode
focal_class.modifiers: private
focal_class.parameters: (@NotNull String authorizableId,
                                          @NotNull String ntName,
                                          @Nullable String intermediatePath)
focal_class.return: Tree
focal_class.signature: Tree createAuthorizableNode(@NotNull String authorizableId,
                                          @NotNull String ntName,
                                          @Nullable String intermediatePath)
focal_class.class_method_signature: UserProvider.createFolderNodes(@NotNull String nodeName,
                                     boolean isGroup,
                                     @Nullable String intermediatePath)
focal_class.full_signature: private Tree createFolderNodes(@NotNull String nodeName,
                                     boolean isGroup,
                                     @Nullable String intermediatePath)
focal_class.identifier: createFolderNodes
focal_class.modifiers: private
focal_class.parameters: (@NotNull String nodeName,
                                     boolean isGroup,
                                     @Nullable String intermediatePath)
focal_class.return: Tree
focal_class.signature: Tree createFolderNodes(@NotNull String nodeName,
                                     boolean isGroup,
                                     @Nullable String intermediatePath)
focal_class.class_method_signature: UserProvider.getFolderPath(@NotNull String nodeName,
                                   @Nullable String intermediatePath,
                                   @NotNull String authRoot)
focal_class.full_signature: @NotNull private String getFolderPath(@NotNull String nodeName,
                                   @Nullable String intermediatePath,
                                   @NotNull String authRoot)
focal_class.identifier: getFolderPath
focal_class.modifiers: @NotNull private
focal_class.parameters: (@NotNull String nodeName,
                                   @Nullable String intermediatePath,
                                   @NotNull String authRoot)
focal_class.return: String
focal_class.signature: String getFolderPath(@NotNull String nodeName,
                                   @Nullable String intermediatePath,
                                   @NotNull String authRoot)
focal_class.class_method_signature: UserProvider.getNodeName(@NotNull String authorizableId)
focal_class.full_signature: private String getNodeName(@NotNull String authorizableId)
focal_class.identifier: getNodeName
focal_class.modifiers: private
focal_class.parameters: (@NotNull String authorizableId)
focal_class.return: String
focal_class.signature: String getNodeName(@NotNull String authorizableId)
focal_class.superclass: extends AuthorizableBaseProvider
focal_method.body: @Nullable
      Tree getAuthorizableByPrincipal(@NotNull Principal principal) {
          if (principal instanceof TreeBasedPrincipal) {
              try {
                  return root.getTree(((TreeBasedPrincipal) principal).getOakPath());
              } catch (RepositoryException e) {
                  // getting oakpath fails -> try searching below
                  log.debug(e.getMessage());
              }
          }
  
          // NOTE: in contrast to JR2 the extra shortcut for ID==principalName
          // can be omitted as principals names are stored in user defined
          // index as well.
          try {
              StringBuilder stmt = new StringBuilder();
              stmt.append("SELECT * FROM [").append(UserConstants.NT_REP_AUTHORIZABLE).append(']');
              stmt.append(" WHERE [").append(UserConstants.REP_PRINCIPAL_NAME).append("] = $principalName");
              stmt.append(QueryEngine.INTERNAL_SQL2_QUERY);
  
              Result result = root.getQueryEngine().executeQuery(stmt.toString(),
                      Query.JCR_SQL2, 1, 0,
                      Collections.singletonMap("principalName", PropertyValues.newString(principal.getName())),
                      NO_MAPPINGS);
  
              Iterator<? extends ResultRow> rows = result.getRows().iterator();
              if (rows.hasNext()) {
                  String path = rows.next().getPath();
                  return root.getTree(path);
              }
          } catch (ParseException ex) {
              log.error("Failed to retrieve authorizable by principal", ex);
          }
  
          return null;
      }
focal_method.class_method_signature: UserProvider.getAuthorizableByPrincipal(@NotNull Principal principal)
focal_method.full_signature: @Nullable Tree getAuthorizableByPrincipal(@NotNull Principal principal)
focal_method.identifier: getAuthorizableByPrincipal
focal_method.invocations: getTree getOakPath debug getMessage append append append append append append append executeQuery getQueryEngine toString singletonMap newString getName iterator getRows hasNext getPath next getTree error
focal_method.modifiers: @Nullable
focal_method.parameters: (@NotNull Principal principal)
focal_method.return: Tree
focal_method.signature: Tree getAuthorizableByPrincipal(@NotNull Principal principal)