class RubyAem::Resources::Group

Group class contains API calls related to managing an AEM group.

Public Class Methods

new(client, path, name) click to toggle source

Initialise a group.

@param client RubyAem::Client @param path the path to group node, e.g. /home/groups/s/ @param name the name of the AEM group, e.g. somegroup @return new RubyAem::Resources::Group instance

# File lib/ruby_aem/resources/group.rb, line 25
def initialize(client, path, name)
  @client = client
  @call_params = {
    path: path,
    name: name
  }
end

Public Instance Methods

add_member(member) click to toggle source

Add another group as a member of this group.

@param member the name of the member group to be added @return RubyAem::Result

# File lib/ruby_aem/resources/group.rb, line 78
def add_member(member)
  result = find_authorizable_id
  @call_params[:authorizable_id] = result.data
  @call_params[:member] = member
  @call_params[:path] = RubyAem::Swagger.path(@call_params[:path])
  @client.call(self.class, __callee__.to_s, @call_params)
end
create() click to toggle source

Create a new group.

@return RubyAem::Result

# File lib/ruby_aem/resources/group.rb, line 36
def create
  @call_params[:path] = "/#{@call_params[:path]}" unless @call_params[:path].start_with? '/'
  @client.call(self.class, __callee__.to_s, @call_params)
end
delete() click to toggle source

Delete the group.

@return RubyAem::Result

# File lib/ruby_aem/resources/group.rb, line 44
def delete
  result = find_authorizable_id
  @call_params[:authorizable_id] = result.data
  @call_params[:path] = RubyAem::Swagger.path(@call_params[:path])
  @client.call(self.class, __callee__.to_s, @call_params)
end
exists() click to toggle source

Check whether the group exists or not. If the group exists, this method returns a true result data, false otherwise.

@return RubyAem::Result

# File lib/ruby_aem/resources/group.rb, line 56
def exists
  result = find_authorizable_id
  @call_params[:authorizable_id] = result.data
  @call_params[:path] = RubyAem::Swagger.path(@call_params[:path])
  @client.call(self.class, __callee__.to_s, @call_params)
end
find_authorizable_id() click to toggle source

Find the group's authorizable ID. Return authorizable ID as result data, or nil if authorizable ID cannot be found.

@return RubyAem::Result

# File lib/ruby_aem/resources/group.rb, line 91
def find_authorizable_id
  @call_params[:path] = "/#{@call_params[:path]}" unless @call_params[:path].start_with? '/'
  @client.call(self.class, __callee__.to_s, @call_params)
end
set_permission(permission_path, permission_csv) click to toggle source

Set the group's permission.

@param permission_path the path that the group's permission is to be set against, e.g. /etc/replication @param permission_csv comma-separated-values of the group's permission, e.g. read:true,modify:true @return RubyAem::Result

# File lib/ruby_aem/resources/group.rb, line 68
def set_permission(permission_path, permission_csv)
  @call_params[:permission_path] = permission_path
  @call_params[:permission_csv] = permission_csv
  @client.call(self.class, __callee__.to_s, @call_params)
end