Skip to content

Commit

Permalink
refactor: change invite only to private in project
Browse files Browse the repository at this point in the history
  • Loading branch information
Alex Eng committed Aug 30, 2017
1 parent 513517c commit c429f33
Show file tree
Hide file tree
Showing 9 changed files with 418 additions and 82 deletions.
11 changes: 5 additions & 6 deletions docs/user-guide/projects/project-settings.md
Expand Up @@ -38,6 +38,11 @@ For example, a git checkout URL is provided for the Zanata server project that c
$ git clone git@github.com:zanata/zanata-platform.git
```

### Private

This setting determines if the project will be visible to all Zanata users or just subset of users.
When it is activated, the project will only visible to assigned users and only translators in your [project team](/user-guide/projects/project-team/) are allowed to translate your project.

### Make this project read only

This button is used to set a project to read-only, which prevents translations being entered. This may be useful in some cases, but should be used sparingly so that translators are able to work on your project.
Expand Down Expand Up @@ -90,12 +95,6 @@ To remove a language from the list of available locales, first move the cursor o
</figure>

------------
### Invite only

This setting determines which users will be allowed to translate your project.
When it is inactive, any translator can translate your project into their language,
as long as their language is enabled in your project. When the setting is active,
only translators in your [project team](/user-guide/projects/project-team/) are allowed to translate your project.

### Validations

Expand Down
10 changes: 5 additions & 5 deletions server/services/src/main/java/org/zanata/action/ProjectHome.java
Expand Up @@ -620,13 +620,13 @@ public void setRestrictedByRole(String key, boolean checked) {
}

@Transactional
public void setInviteOnly(boolean inviteOnly) {
public void setPrivateProject(boolean privateProject) {
identity.checkPermission(getInstance(), "update");
getInstance().setAllowGlobalTranslation(!inviteOnly);
getInstance().setAllowGlobalTranslation(!privateProject);
update();
String message = inviteOnly
? msgs.get("jsf.translation.permission.inviteOnly.Active")
: msgs.get("jsf.translation.permission.inviteOnly.Inactive");
String message = privateProject
? msgs.get("jsf.permission.private.Active")
: msgs.get("jsf.permission.private.Inactive");
facesMessages.addGlobal(FacesMessage.SEVERITY_INFO, message);
}

Expand Down
Expand Up @@ -234,7 +234,7 @@ public boolean canManageProjectTranslationMembers(HProject project) {
*/
@GrantsPermission(actions = { "add-translation", "modify-translation" })
public boolean canTranslate(HProject project, HLocale lang) {
return project.isAllowGlobalTranslation()
return !project.isPrivateProject()
&& isUserAllowedAccess(project)
&& isUserTranslatorOfLanguage(lang);
}
Expand Down Expand Up @@ -307,7 +307,7 @@ public boolean userCanDownloadProjectGlossary(HProject project) {
*/
@GrantsPermission(actions = { "review-translation", "translation-review" })
public boolean canReviewTranslation(HProject project, HLocale locale) {
return project.isAllowGlobalTranslation()
return !project.isPrivateProject()
&& isUserAllowedAccess(project)
&& isUserReviewerOfLanguage(locale);
}
Expand Down Expand Up @@ -542,7 +542,7 @@ public boolean canRunCopyTrans(HProjectIteration iteration) {
*/
@GrantsPermission(actions = "review-comment")
public boolean canCommentOnReview(HLocale locale, HProject project) {
return project.isAllowGlobalTranslation()
return !project.isPrivateProject()
&& isUserAllowedAccess(project) && isLanguageTeamMember(locale);
}

Expand Down
@@ -0,0 +1,18 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>

<databaseChangeLog
xmlns="http://www.liquibase.org/xml/ns/dbchangelog"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.0.xsd">

<changeSet author="aeng@redhat.com" id="2">
<comment>Rename allowGlobalTranslation to private</comment>
<renameColumn tableName="HProject" oldColumnName="allowGlobalTranslation" newColumnName="private" />
</changeSet>

<changeSet author="aeng@redhat.com" id="3">
<comment>Migrate allowGlobalTranslation data to private</comment>
<sql>UPDATE HProject SET private= !private</sql>
</changeSet>

</databaseChangeLog>
8 changes: 4 additions & 4 deletions server/services/src/main/resources/messages.properties
Expand Up @@ -358,6 +358,8 @@ jsf.project.ProjectRestrictedToFollowingRoles=This project has restricted access
jsf.ExportTMXProject=Export project to TMX
jsf.iteration.ExportTMXProjectInfo=Export all translations in this project to TMX
jsf.project.SourceCode=Source Code
jsf.project.Private=Private project
jsf.project.private.detail=Only visible to users who have been explicitly added to this project. When this is turned off, project will be visible to all users and translators will be able to join translation of this project.
jsf.project.HomePage=Home Page
jsf.project.Repository=Repository
jsf.project.About=About
Expand Down Expand Up @@ -545,10 +547,8 @@ jsf.LocaleAlias.AliasSet=Language "{0}" now has alias "{1}".
jsf.LocaleAlias.NoAliasToRemove=Language "{0}" has no alias to remove.
jsf.LocaleAlias.NoAliasesToRemove=There were no locale aliases to remove.
#------ [home] > Projects > [project-id] > Settings > Translation
jsf.translation.permission.inviteOnly=Invite only
jsf.translation.permission.inviteOnly.detail=Only allow translation by translators who have been explicitly added to this project. When this is turned off, translators from any of the global translation teams will be able to join translation of this project.
jsf.translation.permission.inviteOnly.Active=Project set to invite only. Only members can translate.
jsf.translation.permission.inviteOnly.Inactive=Project is no longer invite only. Any translator can translate.
jsf.permission.private.Active=Project set to private. Only accessible by invited members.
jsf.permission.private.Inactive=Project is no longer invite only. Accessible by any users.
#------ [home] > Projects > [project-id] > [version-id] ------
jsf.iteration.ShowAllLocales.title=Your teams will be <span class='highlighted_datatable_row'>highlighted</span> below.
jsf.Refresh=Refresh
Expand Down

0 comments on commit c429f33

Please sign in to comment.