cirandas.net

ref: master

plugins/social_statistics/README.md


  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
README - Social Statistcs (Social Statistics Plugin)
================================

Social Statistics is a plugin that provides custom Noosfero's network graphs
and checks. It comes with a default set of queries and dashboards but can be
customized through the web interface with new ones.

This plugins is a wrapper for the blazer gem.

INSTALL
=======

Dependencies
-----------

This plugin depends on the following gems:
* blazer
  * chartkick
  * safely\_block
    * errbase

This gems are packaged (debian packages) and available on Noosfero's
repository. If you have this repository properly configured the
`script/debian-install.rb` should do all the work and install this dependencies
on its own.

If you want to install them manually you can do it as well:

```
# apt-get install ruby-errbase ruby-safely-block ruby-chartkick ruby-blazer
```

Configuration
-------------

This plugin needs a configuration file that define all of its basic behavior.
This configuration file should be created on `config/blazer.yml`. You may copy
`config/blazer.yml.dist` as a starting point since it also defines necessary
configurations for the default queries.

If you are using this plugin on production environment should be concerned with
the `data_sources[main][url]` option which defines the url for database
connection. This url may be passed as an environment variable (as it is used in
the `config/blazer.yml.dist` file) or be added directly on the
`config/blazer.yml` file. This configuration follows the following format:

```
postgres://user:password@hostname:5432/database
```

Another thing you should also be aware on production setups is the use of a
read-only database user for security reasons. Although accesses to the database
are treated by the gem, any vulnerability bug may expose your database to an
attacker. In order to have a higher level of security you should create a
specific user with read-only permissions to access the database for this plugin.

On Postgresql, this can be done with the following code:

```
BEGIN;
CREATE ROLE blazer LOGIN PASSWORD 'secret123';
GRANT CONNECT ON DATABASE database_name TO blazer;
GRANT USAGE ON SCHEMA public TO blazer;
GRANT SELECT ON ALL TABLES IN SCHEMA public TO blazer;
ALTER DEFAULT PRIVILEGES IN SCHEMA public GRANT SELECT ON TABLES TO blazer;
COMMIT;
```

You can check how to setup this user on different databases here:
https://github.com/ankane/blazer#permissions

Theme Customization
-------------------

This plugin extends Blazer's layout file to allow a Noosfero environment theme
to customize its appearance. To use this customization, create a folder named
"blazer" inside your theme folder and use the following files:

* style.css
* header.html.erb
* footer.html.erb


Enable Plugin
-------------

To enable this plugin do:

cd <your_noosfero_dir>
./script/noosfero-plugins enable social\_statistics

Activate Plugin
-------------

As a Noosfero administrator user, go to administrator panel:

- Click on "Plugins" option
- Click on "Social Statistics" check-box
- Save the changes


DEVELOPMENT
===========

Get Noosfero's development repository:

$ git clone https://gitlab.com/noosfero/noosfero.git

Running tests
--------------------

$ rake test:noosfero\_plugins:social\_statistics

Get Involved
============

If you found any bug and/or want to collaborate, please send an e-mail to noosfero-dev@listas.softwarelivre.org

LICENSE
=======

Copyright (c) The Author developers.

See Noosfero license.


AUTHORS
=======

Rodrigo Souto (rodrigo at colivre.coop.br)