Class: Confluence::Group

Inherits:
Object
  • Object
show all
Defined in:
lib/confluence/group.rb

Class Method Summary collapse

Class Method Details

.allArray<String>

Retrieve a list of all groups in Confluence.

Returns:

  • (Array<String>)

    names of all groups in our Confluence instance.



9
10
11
# File 'lib/confluence/group.rb', line 9

def all()
  Confluence.conn.getGroups()
end

.create(name) ⇒ true, false

Creates a new group in Confluence.

Parameters:

  • name (String)

    of group to create.

Returns:

  • (true, false)

    result of whether group was successfully created.



19
20
21
22
23
24
25
26
27
# File 'lib/confluence/group.rb', line 19

def create(name)
  if all.include?(name)
    return false
  else
    result = Confluence.conn.addGroup(name)
    Confluence.logger.debug("Created group: #{name}")
  end
  result
end

.delete(name) ⇒ true, false

Delete a group from Confluence.

Parameters:

  • name (String)

    of group to delete.

Returns:

  • (true, false)

    result of whether group was successfully deleted.



35
36
37
38
39
40
41
42
43
# File 'lib/confluence/group.rb', line 35

def delete(name)
  if all.include?(name)
    result = Confluence.conn.removeGroup(name, Confluence::User::DEFAULT_GROUP)
    Confluence.logger.debug("Deleted group: #{name}")
    return result
  else
    return false
  end
end

.exists?(grp_name) ⇒ true, false

Predicate that indicates whether a given group exists in Confluence

Parameters:

  • the (String)

    group name.

Returns:

  • (true, false)


51
52
53
# File 'lib/confluence/group.rb', line 51

def exists?(grp_name)
  all.include?(grp_name)
end