aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJean-Baptiste Vilain <jean-baptiste.vilain@sonarsource.com>2013-06-26 16:36:11 +0200
committerJean-Baptiste Vilain <jean-baptiste.vilain@sonarsource.com>2013-06-26 16:36:11 +0200
commit64c168a91d69a0fcfb69cafba29d3f718437c764 (patch)
tree07c6e7d7efcce0f7c8097b29ccc7b19e03d2d052
parent31fba86ddcf83f57c5040cef8843341b79a02253 (diff)
downloadsonarqube-64c168a91d69a0fcfb69cafba29d3f718437c764.tar.gz
sonarqube-64c168a91d69a0fcfb69cafba29d3f718437c764.zip
SONAR-4412 Extracted Role DAO to make it available to the upcoming ruby role service
-rw-r--r--plugins/sonar-core-plugin/src/main/resources/org/sonar/l10n/core.properties32
-rw-r--r--sonar-core/src/main/java/org/sonar/core/resource/DefaultResourcePermissions.java59
-rw-r--r--sonar-core/src/main/java/org/sonar/core/user/RoleDao.java85
-rw-r--r--sonar-core/src/main/java/org/sonar/core/user/UserDao.java17
-rw-r--r--sonar-core/src/test/java/org/sonar/core/resource/DefaultResourcePermissionsTest.java30
-rw-r--r--sonar-core/src/test/java/org/sonar/core/user/RoleDaoTest.java28
-rw-r--r--sonar-server/src/main/webapp/WEB-INF/app/helpers/roles_helper.rb2
-rw-r--r--sonar-server/src/main/webapp/WEB-INF/app/views/roles/global.html.erb22
-rw-r--r--sonar-server/src/main/webapp/WEB-INF/app/views/roles/projects.html.erb4
9 files changed, 199 insertions, 80 deletions
diff --git a/plugins/sonar-core-plugin/src/main/resources/org/sonar/l10n/core.properties b/plugins/sonar-core-plugin/src/main/resources/org/sonar/l10n/core.properties
index 43789c51f19..f75d10eb544 100644
--- a/plugins/sonar-core-plugin/src/main/resources/org/sonar/l10n/core.properties
+++ b/plugins/sonar-core-plugin/src/main/resources/org/sonar/l10n/core.properties
@@ -2194,22 +2194,22 @@ metric.confirmed_issues.description=Confirmed issues
#------------------------------------------------------------------------------
#
-# GLOBAL ROLES
-#
-#------------------------------------------------------------------------------
-global_role.role=Role
-global_role.users=Users
-global_role.groups=Groups
-global_role.admin=System Administration
-global_role.admin.desc=Ability to perform all administration functions for the instance: global configuration and personalization of default dashboards.
-global_role.profileadmin=Quality Profile Administration
-global_role.profileadmin.desc=Ability to perform any action on the quality profiles.
-global_role.sharedashboard=Dashboard Sharing
-global_role.sharedashboard.desc=Ability to share dashboards that any user will be able to follow.
-global_role.scan=Ability to execute some Sonar analysis
-global_role.scan.desc=Permission required to execute a Sonar analysis. This permission allows to get all settings (even the secured ones like scm account password, jira account password, ...) required to execute all Sonar plugins.
-global_role.dryrun=Ability to execute some local (dry run) Sonar analysis
-global_role.dryrun.desc=Permission required to execute a local (dry run) Sonar analysis without pushing the results to the Sonar server. This permission allows to get all settings required to execute all Sonar plugins except the secured one like scm account password, jira account password... This permission is required for instance to execute a local Sonar analysis in Sonar Eclipse.
+# GLOBAL PERMISSIONS
+#
+#------------------------------------------------------------------------------
+global_permissions.permission=Permission
+global_permissions.users=Users
+global_permissions.groups=Groups
+global_permissions.admin=System Administration
+global_permissions.admin.desc=Ability to perform all administration functions for the instance: global configuration and personalization of default dashboards.
+global_permissions.profileadmin=Quality Profile Administration
+global_permissions.profileadmin.desc=Ability to perform any action on the quality profiles.
+global_permissions.sharedashboard=Dashboard Sharing
+global_permissions.sharedashboard.desc=Ability to share dashboards that any user will be able to follow.
+global_permissions.scan=Ability to execute some Sonar analysis
+global_permissions.scan.desc=Permission required to execute a Sonar analysis. This permission allows to get all settings (even the secured ones like scm account password, jira account password, ...) required to execute all Sonar plugins.
+global_permissions.dryrun=Ability to execute some local (dry run) Sonar analysis
+global_permissions.dryrun.desc=Permission required to execute a local (dry run) Sonar analysis without pushing the results to the Sonar server. This permission allows to get all settings required to execute all Sonar plugins except the secured one like scm account password, jira account password... This permission is required for instance to execute a local Sonar analysis in Sonar Eclipse.
#------------------------------------------------------------------------------
#
diff --git a/sonar-core/src/main/java/org/sonar/core/resource/DefaultResourcePermissions.java b/sonar-core/src/main/java/org/sonar/core/resource/DefaultResourcePermissions.java
index e90547aeddc..7a7e17b14e3 100644
--- a/sonar-core/src/main/java/org/sonar/core/resource/DefaultResourcePermissions.java
+++ b/sonar-core/src/main/java/org/sonar/core/resource/DefaultResourcePermissions.java
@@ -28,12 +28,7 @@ import org.sonar.api.security.ResourcePermissions;
import org.sonar.api.task.TaskExtension;
import org.sonar.api.web.UserRole;
import org.sonar.core.persistence.MyBatis;
-import org.sonar.core.user.GroupDto;
-import org.sonar.core.user.GroupRoleDto;
-import org.sonar.core.user.RoleMapper;
-import org.sonar.core.user.UserDto;
-import org.sonar.core.user.UserMapper;
-import org.sonar.core.user.UserRoleDto;
+import org.sonar.core.user.*;
/**
* @since 3.2
@@ -42,23 +37,20 @@ public class DefaultResourcePermissions implements ResourcePermissions, TaskExte
private final Settings settings;
private final MyBatis myBatis;
+ private final RoleDao roleDao;
+ private final UserDao userDao;
- public DefaultResourcePermissions(Settings settings, MyBatis myBatis) {
+ public DefaultResourcePermissions(Settings settings, MyBatis myBatis, RoleDao roleDao, UserDao userDao) {
this.settings = settings;
this.myBatis = myBatis;
+ this.roleDao = roleDao;
+ this.userDao = userDao;
}
public boolean hasRoles(Resource resource) {
if (resource.getId() != null) {
- SqlSession session = myBatis.openSession();
- try {
- RoleMapper roleMapper = session.getMapper(RoleMapper.class);
- Long resourceId = Long.valueOf(resource.getId());
- return roleMapper.countGroupRoles(resourceId) + roleMapper.countUserRoles(resourceId) > 0;
-
- } finally {
- MyBatis.closeQuietly(session);
- }
+ Long resourceId = Long.valueOf(resource.getId());
+ return roleDao.countGroupRoles(resourceId) + roleDao.countUserRoles(resourceId) > 0;
}
return false;
}
@@ -73,9 +65,8 @@ public class DefaultResourcePermissions implements ResourcePermissions, TaskExte
.setRole(role)
.setUserId(user.getId())
.setResourceId(Long.valueOf(resource.getId()));
- RoleMapper roleMapper = session.getMapper(RoleMapper.class);
- roleMapper.deleteUserRole(userRole);
- roleMapper.insertUserRole(userRole);
+ roleDao.deleteUserRole(userRole, session);
+ roleDao.insertUserRole(userRole, session);
session.commit();
}
} finally {
@@ -91,17 +82,16 @@ public class DefaultResourcePermissions implements ResourcePermissions, TaskExte
GroupRoleDto groupRole = new GroupRoleDto()
.setRole(role)
.setResourceId(Long.valueOf(resource.getId()));
- RoleMapper roleMapper = session.getMapper(RoleMapper.class);
if (DefaultGroups.isAnyone(groupName)) {
- roleMapper.deleteGroupRole(groupRole);
- roleMapper.insertGroupRole(groupRole);
+ roleDao.deleteGroupRole(groupRole, session);
+ roleDao.insertGroupRole(groupRole, session);
session.commit();
} else {
- GroupDto group = session.getMapper(UserMapper.class).selectGroupByName(groupName);
+ GroupDto group = userDao.selectGroupByName(groupName, session);
if (group != null) {
groupRole.setGroupId(group.getId());
- roleMapper.deleteGroupRole(groupRole);
- roleMapper.insertGroupRole(groupRole);
+ roleDao.deleteGroupRole(groupRole, session);
+ roleDao.insertGroupRole(groupRole, session);
session.commit();
}
}
@@ -128,33 +118,30 @@ public class DefaultResourcePermissions implements ResourcePermissions, TaskExte
private void removeRoles(Resource resource, SqlSession session) {
Long resourceId = Long.valueOf(resource.getId());
- RoleMapper mapper = session.getMapper(RoleMapper.class);
- mapper.deleteGroupRolesByResourceId(resourceId);
- mapper.deleteUserRolesByResourceId(resourceId);
+ roleDao.deleteGroupRolesByResourceId(resourceId, session);
+ roleDao.deleteUserRolesByResourceId(resourceId, session);
}
private void grantDefaultRoles(Resource resource, String role, SqlSession session) {
- UserMapper userMapper = session.getMapper(UserMapper.class);
- RoleMapper roleMapper = session.getMapper(RoleMapper.class);
-
String[] groupNames = settings.getStringArrayBySeparator("sonar.role." + role + "." + resource.getQualifier() + ".defaultGroups", ",");
for (String groupName : groupNames) {
GroupRoleDto groupRole = new GroupRoleDto().setRole(role).setResourceId(Long.valueOf(resource.getId()));
if (DefaultGroups.isAnyone(groupName)) {
- roleMapper.insertGroupRole(groupRole);
+ roleDao.insertGroupRole(groupRole, session);
} else {
- GroupDto group = userMapper.selectGroupByName(groupName);
+ GroupDto group = userDao.selectGroupByName(groupName, session);
if (group != null) {
- roleMapper.insertGroupRole(groupRole.setGroupId(group.getId()));
+ roleDao.insertGroupRole(groupRole.setGroupId(group.getId()), session);
}
}
}
String[] logins = settings.getStringArrayBySeparator("sonar.role." + role + "." + resource.getQualifier() + ".defaultUsers", ",");
for (String login : logins) {
- UserDto user = userMapper.selectUserByLogin(login);
+ UserDto user = userDao.selectActiveUserByLogin(login, session);
if (user != null) {
- roleMapper.insertUserRole(new UserRoleDto().setRole(role).setUserId(user.getId()).setResourceId(Long.valueOf(resource.getId())));
+ UserRoleDto userRoleDto = new UserRoleDto().setRole(role).setUserId(user.getId()).setResourceId(Long.valueOf(resource.getId()));
+ roleDao.insertUserRole(userRoleDto, session);
}
}
}
diff --git a/sonar-core/src/main/java/org/sonar/core/user/RoleDao.java b/sonar-core/src/main/java/org/sonar/core/user/RoleDao.java
new file mode 100644
index 00000000000..6a3a08eba8f
--- /dev/null
+++ b/sonar-core/src/main/java/org/sonar/core/user/RoleDao.java
@@ -0,0 +1,85 @@
+/*
+ * SonarQube, open source software quality management tool.
+ * Copyright (C) 2008-2013 SonarSource
+ * mailto:contact AT sonarsource DOT com
+ *
+ * SonarQube is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * SonarQube is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+package org.sonar.core.user;
+
+import org.apache.ibatis.session.SqlSession;
+import org.sonar.api.ServerExtension;
+import org.sonar.api.task.TaskExtension;
+import org.sonar.core.persistence.MyBatis;
+
+public class RoleDao implements TaskExtension, ServerExtension {
+
+ private final MyBatis mybatis;
+
+ public RoleDao(MyBatis mybatis) {
+ this.mybatis = mybatis;
+ }
+
+ public void insertGroupRole(GroupRoleDto groupRole, SqlSession session) {
+ RoleMapper mapper = session.getMapper(RoleMapper.class);
+ mapper.insertGroupRole(groupRole);
+ }
+
+ public void insertUserRole(UserRoleDto userRole, SqlSession session) {
+ RoleMapper mapper = session.getMapper(RoleMapper.class);
+ mapper.insertUserRole(userRole);
+ }
+
+ public void deleteUserRole(UserRoleDto userRole, SqlSession session) {
+ RoleMapper mapper = session.getMapper(RoleMapper.class);
+ mapper.deleteUserRole(userRole);
+ }
+
+ public void deleteGroupRole(GroupRoleDto groupRole, SqlSession session) {
+ RoleMapper mapper = session.getMapper(RoleMapper.class);
+ mapper.deleteGroupRole(groupRole);
+ }
+
+ public void deleteGroupRolesByResourceId(Long resourceId, SqlSession session) {
+ RoleMapper mapper = session.getMapper(RoleMapper.class);
+ mapper.deleteGroupRolesByResourceId(resourceId);
+ }
+
+ public void deleteUserRolesByResourceId(Long resourceId, SqlSession session) {
+ RoleMapper mapper = session.getMapper(RoleMapper.class);
+ mapper.deleteUserRolesByResourceId(resourceId);
+ }
+
+ public int countGroupRoles(Long resourceId) {
+ SqlSession session = mybatis.openSession();
+ try {
+ RoleMapper mapper = session.getMapper(RoleMapper.class);
+ return mapper.countGroupRoles(resourceId);
+ } finally {
+ MyBatis.closeQuietly(session);
+ }
+ }
+
+ public int countUserRoles(Long resourceId) {
+ SqlSession session = mybatis.openSession();
+ try {
+ RoleMapper mapper = session.getMapper(RoleMapper.class);
+ return mapper.countUserRoles(resourceId);
+ } finally {
+ MyBatis.closeQuietly(session);
+ }
+ }
+}
diff --git a/sonar-core/src/main/java/org/sonar/core/user/UserDao.java b/sonar-core/src/main/java/org/sonar/core/user/UserDao.java
index 6a2ce6a499b..c5d482ff139 100644
--- a/sonar-core/src/main/java/org/sonar/core/user/UserDao.java
+++ b/sonar-core/src/main/java/org/sonar/core/user/UserDao.java
@@ -47,13 +47,17 @@ public class UserDao {
public UserDto selectActiveUserByLogin(String login) {
SqlSession session = mybatis.openSession();
try {
- UserMapper mapper = session.getMapper(UserMapper.class);
- return mapper.selectUserByLogin(login);
+ return selectActiveUserByLogin(login, session);
} finally {
MyBatis.closeQuietly(session);
}
}
+ public UserDto selectActiveUserByLogin(String login, SqlSession session) {
+ UserMapper mapper = session.getMapper(UserMapper.class);
+ return mapper.selectUserByLogin(login);
+ }
+
public List<UserDto> selectUsersByLogins(List<String> logins) {
List<UserDto> users = Lists.newArrayList();
if (!logins.isEmpty()) {
@@ -118,11 +122,16 @@ public class UserDao {
* @return the group, null if group not found
*/
+ public GroupDto selectGroupByName(String name, SqlSession session) {
+ UserMapper mapper = session.getMapper(UserMapper.class);
+ return mapper.selectGroupByName(name);
+ }
+
+
public GroupDto selectGroupByName(String name) {
SqlSession session = mybatis.openSession();
try {
- UserMapper mapper = session.getMapper(UserMapper.class);
- return mapper.selectGroupByName(name);
+ return selectGroupByName(name, session);
} finally {
MyBatis.closeQuietly(session);
}
diff --git a/sonar-core/src/test/java/org/sonar/core/resource/DefaultResourcePermissionsTest.java b/sonar-core/src/test/java/org/sonar/core/resource/DefaultResourcePermissionsTest.java
index 7f8182234df..df51c2356b9 100644
--- a/sonar-core/src/test/java/org/sonar/core/resource/DefaultResourcePermissionsTest.java
+++ b/sonar-core/src/test/java/org/sonar/core/resource/DefaultResourcePermissionsTest.java
@@ -25,7 +25,8 @@ import org.sonar.api.resources.Project;
import org.sonar.api.resources.Resource;
import org.sonar.api.security.DefaultGroups;
import org.sonar.core.persistence.AbstractDaoTestCase;
-import org.sonar.core.resource.DefaultResourcePermissions;
+import org.sonar.core.user.RoleDao;
+import org.sonar.core.user.UserDao;
import static org.fest.assertions.Assertions.assertThat;
@@ -37,7 +38,8 @@ public class DefaultResourcePermissionsTest extends AbstractDaoTestCase {
public void grantGroupRole() {
setupData("grantGroupRole");
- DefaultResourcePermissions permissions = new DefaultResourcePermissions(new Settings(), getMyBatis());
+ DefaultResourcePermissions permissions = new DefaultResourcePermissions(new Settings(), getMyBatis(),
+ new RoleDao(getMyBatis()), new UserDao(getMyBatis()));
permissions.grantGroupRole(project, "sonar-administrators", "admin");
// do not insert duplicated rows
@@ -50,7 +52,8 @@ public class DefaultResourcePermissionsTest extends AbstractDaoTestCase {
public void grantGroupRole_anyone() {
setupData("grantGroupRole_anyone");
- DefaultResourcePermissions permissions = new DefaultResourcePermissions(new Settings(), getMyBatis());
+ DefaultResourcePermissions permissions = new DefaultResourcePermissions(new Settings(), getMyBatis(),
+ new RoleDao(getMyBatis()), new UserDao(getMyBatis()));
permissions.grantGroupRole(project, DefaultGroups.ANYONE, "admin");
checkTables("grantGroupRole_anyone", "group_roles");
@@ -60,7 +63,8 @@ public class DefaultResourcePermissionsTest extends AbstractDaoTestCase {
public void grantGroupRole_ignore_if_group_not_found() {
setupData("grantGroupRole_ignore_if_group_not_found");
- DefaultResourcePermissions permissions = new DefaultResourcePermissions(new Settings(), getMyBatis());
+ DefaultResourcePermissions permissions = new DefaultResourcePermissions(new Settings(), getMyBatis(),
+ new RoleDao(getMyBatis()), new UserDao(getMyBatis()));
permissions.grantGroupRole(project, "not_found", "admin");
checkTables("grantGroupRole_ignore_if_group_not_found", "group_roles");
@@ -70,7 +74,8 @@ public class DefaultResourcePermissionsTest extends AbstractDaoTestCase {
public void grantGroupRole_ignore_if_not_persisted() {
setupData("grantGroupRole_ignore_if_not_persisted");
- DefaultResourcePermissions permissions = new DefaultResourcePermissions(new Settings(), getMyBatis());
+ DefaultResourcePermissions permissions = new DefaultResourcePermissions(new Settings(), getMyBatis(),
+ new RoleDao(getMyBatis()), new UserDao(getMyBatis()));
Project resourceWithoutId = new Project("");
permissions.grantGroupRole(resourceWithoutId, "sonar-users", "admin");
@@ -81,7 +86,8 @@ public class DefaultResourcePermissionsTest extends AbstractDaoTestCase {
public void grantUserRole() {
setupData("grantUserRole");
- DefaultResourcePermissions permissions = new DefaultResourcePermissions(new Settings(), getMyBatis());
+ DefaultResourcePermissions permissions = new DefaultResourcePermissions(new Settings(), getMyBatis(),
+ new RoleDao(getMyBatis()), new UserDao(getMyBatis()));
permissions.grantUserRole(project, "marius", "admin");
// do not insert duplicated rows
@@ -101,7 +107,8 @@ public class DefaultResourcePermissionsTest extends AbstractDaoTestCase {
settings.setProperty("sonar.role.user.TRK.defaultUsers", "");
settings.setProperty("sonar.role.codeviewer.TRK.defaultGroups", "Anyone,sonar-users");
settings.setProperty("sonar.role.codeviewer.TRK.defaultUsers", "");
- DefaultResourcePermissions permissions = new DefaultResourcePermissions(settings, getMyBatis());
+ DefaultResourcePermissions permissions = new DefaultResourcePermissions(settings, getMyBatis(),
+ new RoleDao(getMyBatis()), new UserDao(getMyBatis()));
permissions.grantDefaultRoles(project);
@@ -114,7 +121,8 @@ public class DefaultResourcePermissionsTest extends AbstractDaoTestCase {
Settings settings = new Settings();
settings.setProperty("sonar.role.admin.TRK.defaultGroups", "sonar-administrators,unknown");
- DefaultResourcePermissions permissions = new DefaultResourcePermissions(settings, getMyBatis());
+ DefaultResourcePermissions permissions = new DefaultResourcePermissions(settings, getMyBatis(),
+ new RoleDao(getMyBatis()), new UserDao(getMyBatis()));
permissions.grantDefaultRoles(project);
checkTables("grantDefaultRoles_unknown_group", "group_roles");
@@ -126,7 +134,8 @@ public class DefaultResourcePermissionsTest extends AbstractDaoTestCase {
Settings settings = new Settings();
settings.setProperty("sonar.role.admin.TRK.defaultUsers", "marius,disabled,notfound");
- DefaultResourcePermissions permissions = new DefaultResourcePermissions(settings, getMyBatis());
+ DefaultResourcePermissions permissions = new DefaultResourcePermissions(settings, getMyBatis(),
+ new RoleDao(getMyBatis()), new UserDao(getMyBatis()));
permissions.grantDefaultRoles(project);
checkTables("grantDefaultRoles_users", "user_roles");
@@ -135,7 +144,8 @@ public class DefaultResourcePermissionsTest extends AbstractDaoTestCase {
@Test
public void hasRoles() {
setupData("hasRoles");
- DefaultResourcePermissions permissions = new DefaultResourcePermissions(new Settings(), getMyBatis());
+ DefaultResourcePermissions permissions = new DefaultResourcePermissions(new Settings(), getMyBatis(),
+ new RoleDao(getMyBatis()), new UserDao(getMyBatis()));
// no groups and at least one user
assertThat(permissions.hasRoles(new Project("only_users").setId(1))).isTrue();
diff --git a/sonar-core/src/test/java/org/sonar/core/user/RoleDaoTest.java b/sonar-core/src/test/java/org/sonar/core/user/RoleDaoTest.java
new file mode 100644
index 00000000000..1f803346a3d
--- /dev/null
+++ b/sonar-core/src/test/java/org/sonar/core/user/RoleDaoTest.java
@@ -0,0 +1,28 @@
+/*
+ * SonarQube, open source software quality management tool.
+ * Copyright (C) 2008-2013 SonarSource
+ * mailto:contact AT sonarsource DOT com
+ *
+ * SonarQube is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * SonarQube is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+package org.sonar.core.user;
+
+import org.sonar.core.persistence.AbstractDaoTestCase;
+
+public class RoleDaoTest extends AbstractDaoTestCase {
+
+
+}
diff --git a/sonar-server/src/main/webapp/WEB-INF/app/helpers/roles_helper.rb b/sonar-server/src/main/webapp/WEB-INF/app/helpers/roles_helper.rb
index 69c6a5592cf..9d32cabffae 100644
--- a/sonar-server/src/main/webapp/WEB-INF/app/helpers/roles_helper.rb
+++ b/sonar-server/src/main/webapp/WEB-INF/app/helpers/roles_helper.rb
@@ -79,7 +79,7 @@ module RolesHelper
end
def global_role_name(role)
- message("global_role.#{role}", :default => role)
+ message("global_permissions.#{role}", :default => role)
end
end
diff --git a/sonar-server/src/main/webapp/WEB-INF/app/views/roles/global.html.erb b/sonar-server/src/main/webapp/WEB-INF/app/views/roles/global.html.erb
index 405fe0d9934..5f47c60911d 100644
--- a/sonar-server/src/main/webapp/WEB-INF/app/views/roles/global.html.erb
+++ b/sonar-server/src/main/webapp/WEB-INF/app/views/roles/global.html.erb
@@ -3,24 +3,24 @@
<table class="data width100" id="global-roles">
<thead>
<tr >
- <th><%= message('global_role.role') -%></th>
- <th width="30%"><%= message('global_role.users') -%></th>
- <th width="30%"><%= message('global_role.groups') -%></th>
+ <th><%= message('global_permissions.permission') -%></th>
+ <th width="30%"><%= message('global_permissions.users') -%></th>
+ <th width="30%"><%= message('global_permissions.groups') -%></th>
</tr>
</thead>
<tbody>
- <% ['admin', 'profileadmin', 'sharedashboard', 'scan', 'dryrun'].each do |globalRole| %>
- <tr class="<%= cycle('even', 'odd', :name => 'globalRole') -%>" >
+ <% ['admin', 'profileadmin', 'sharedashboard', 'scan', 'dryrun'].each do |global_permissions| %>
+ <tr class="<%= cycle('even', 'odd', :name => 'global_permission') -%>" >
<td valign="top">
- <b><%= message('global_role.' + globalRole) -%></b><br/>
- <span class="small gray"><%= message('global_role.' + globalRole + '.desc') -%></span></td>
+ <b><%= message('global_permissions.' + global_permissions) -%></b><br/>
+ <span class="small gray"><%= message('global_permissions.' + global_permissions + '.desc') -%></span></td>
<td valign="top" style="word-break:break-all;width:30%;">
- <span><%= users(globalRole).map(&:name).join(', ') -%></span>
- (<%= link_to "select", {:action => 'edit_users', :role => globalRole, :redirect => 'global'}, :class => 'link-action' -%>)
+ <span><%= users(global_permissions).map(&:name).join(', ') -%></span>
+ (<%= link_to "select", {:action => 'edit_users', :role => global_permissions, :redirect => 'global'}, :class => 'link-action' -%>)
</td>
<td valign="top" style="word-break:break-all;width:30%;">
- <span><%= groups(globalRole).map{|g| group_name(g)}.join(', ') %></span>
- (<%= link_to "select", {:action => 'edit_groups', :role => globalRole, :redirect => 'global'}, :class => 'link-action' -%>)
+ <span><%= groups(global_permissions).map{|g| group_name(g)}.join(', ') %></span>
+ (<%= link_to "select", {:action => 'edit_groups', :role => global_permissions, :redirect => 'global'}, :class => 'link-action' -%>)
</td>
</tr>
<% end %>
diff --git a/sonar-server/src/main/webapp/WEB-INF/app/views/roles/projects.html.erb b/sonar-server/src/main/webapp/WEB-INF/app/views/roles/projects.html.erb
index a885064b766..564ae0fdbc9 100644
--- a/sonar-server/src/main/webapp/WEB-INF/app/views/roles/projects.html.erb
+++ b/sonar-server/src/main/webapp/WEB-INF/app/views/roles/projects.html.erb
@@ -17,8 +17,8 @@
<thead>
<tr>
<th><%= message('projects_role.role') -%> <%= message("qualifiers.#{@qualifier}") -%></th>
- <th width="35%"><%= message('global_role.users') -%></th>
- <th width="35%"><%= message('global_role.groups') -%></th>
+ <th width="35%"><%= message('projects_role.users') -%></th>
+ <th width="35%"><%= message('projects_role.groups') -%></th>
</tr>
</thead>
<tbody>