Merge permissions of Drupal roles

Merge permissions from multiple Drupal roles

First specity the new role which will be the source and destination for the merge

$source_role_names = array('blogger', 'editor')
$dest_role_name = 'merged';

Fetch the rid from the names

foreach ($source_role_names as $name) {
  $rid = user_role_load_by_name($name)->rid;
  $source_role_ids[$rid] = $rid;

Create the role if necessary.


Working with git repositories

Initialize bare git repository

Use these commands to initialize a bare (empty) git repository. This is usualy a good idea when you want to create a central repository.

mkdir /var/git-repo/project.gif
cd /var/git-repo/project.gif
git init --bare

Configure git groups and users

Also make sure that the developers will have access to the repo. This can be done by adding them to a group developers and giving permissions to the git repository directory.

If the developers group does not exist yet, you can create it with this command: