Automatically verify CLAs when the admin requests them
In Android's use of Gerrit 1 individual CLAs are automatically marked as verified by the system if the contact information has been filled out by the end-user. This was done to avoid the rush of accounts as the site opened for first use. Corporations installing Gerrit 2 within their own firewall and with their own SSO system might want to allow users to be covered by a CLA automatically; permitting them to be auto-verified can simplify that setup task. Signed-off-by: Shawn O. Pearce <sop@google.com>
This commit is contained in:
@@ -17,6 +17,7 @@ package com.google.gerrit.client.account;
|
|||||||
import com.google.gerrit.client.reviewdb.AccountExternalId;
|
import com.google.gerrit.client.reviewdb.AccountExternalId;
|
||||||
import com.google.gerrit.client.reviewdb.AccountSshKey;
|
import com.google.gerrit.client.reviewdb.AccountSshKey;
|
||||||
import com.google.gerrit.client.reviewdb.ContactInformation;
|
import com.google.gerrit.client.reviewdb.ContactInformation;
|
||||||
|
import com.google.gerrit.client.reviewdb.ContributorAgreement;
|
||||||
import com.google.gerrit.client.rpc.SignInRequired;
|
import com.google.gerrit.client.rpc.SignInRequired;
|
||||||
import com.google.gwt.user.client.rpc.AsyncCallback;
|
import com.google.gwt.user.client.rpc.AsyncCallback;
|
||||||
import com.google.gwtjsonrpc.client.RemoteJsonService;
|
import com.google.gwtjsonrpc.client.RemoteJsonService;
|
||||||
@@ -42,4 +43,8 @@ public interface AccountSecurity extends RemoteJsonService {
|
|||||||
@SignInRequired
|
@SignInRequired
|
||||||
void updateContact(String fullName, String emailAddr,
|
void updateContact(String fullName, String emailAddr,
|
||||||
ContactInformation info, AsyncCallback<VoidResult> callback);
|
ContactInformation info, AsyncCallback<VoidResult> callback);
|
||||||
|
|
||||||
|
@SignInRequired
|
||||||
|
void enterAgreement(ContributorAgreement.Id id,
|
||||||
|
AsyncCallback<VoidResult> callback);
|
||||||
}
|
}
|
||||||
|
@@ -16,7 +16,6 @@ package com.google.gerrit.client.account;
|
|||||||
|
|
||||||
import com.google.gerrit.client.reviewdb.Account;
|
import com.google.gerrit.client.reviewdb.Account;
|
||||||
import com.google.gerrit.client.reviewdb.AccountProjectWatch;
|
import com.google.gerrit.client.reviewdb.AccountProjectWatch;
|
||||||
import com.google.gerrit.client.reviewdb.ContributorAgreement;
|
|
||||||
import com.google.gerrit.client.rpc.SignInRequired;
|
import com.google.gerrit.client.rpc.SignInRequired;
|
||||||
import com.google.gwt.user.client.rpc.AsyncCallback;
|
import com.google.gwt.user.client.rpc.AsyncCallback;
|
||||||
import com.google.gwtjsonrpc.client.AllowCrossSiteRequest;
|
import com.google.gwtjsonrpc.client.AllowCrossSiteRequest;
|
||||||
@@ -49,8 +48,4 @@ public interface AccountService extends RemoteJsonService {
|
|||||||
@SignInRequired
|
@SignInRequired
|
||||||
@AllowCrossSiteRequest
|
@AllowCrossSiteRequest
|
||||||
void myAgreements(AsyncCallback<AgreementInfo> callback);
|
void myAgreements(AsyncCallback<AgreementInfo> callback);
|
||||||
|
|
||||||
@SignInRequired
|
|
||||||
void enterAgreement(ContributorAgreement.Id id,
|
|
||||||
AsyncCallback<VoidResult> callback);
|
|
||||||
}
|
}
|
||||||
|
@@ -15,9 +15,7 @@
|
|||||||
package com.google.gerrit.client.account;
|
package com.google.gerrit.client.account;
|
||||||
|
|
||||||
import com.google.gerrit.client.reviewdb.Account;
|
import com.google.gerrit.client.reviewdb.Account;
|
||||||
import com.google.gerrit.client.reviewdb.AccountAgreement;
|
|
||||||
import com.google.gerrit.client.reviewdb.AccountProjectWatch;
|
import com.google.gerrit.client.reviewdb.AccountProjectWatch;
|
||||||
import com.google.gerrit.client.reviewdb.ContributorAgreement;
|
|
||||||
import com.google.gerrit.client.reviewdb.Project;
|
import com.google.gerrit.client.reviewdb.Project;
|
||||||
import com.google.gerrit.client.reviewdb.ReviewDb;
|
import com.google.gerrit.client.reviewdb.ReviewDb;
|
||||||
import com.google.gerrit.client.rpc.BaseServiceImplementation;
|
import com.google.gerrit.client.rpc.BaseServiceImplementation;
|
||||||
@@ -140,17 +138,4 @@ public class AccountServiceImpl extends BaseServiceImplementation implements
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
public void enterAgreement(final ContributorAgreement.Id id,
|
|
||||||
final AsyncCallback<VoidResult> callback) {
|
|
||||||
run(callback, new Action<VoidResult>() {
|
|
||||||
public VoidResult run(final ReviewDb db) throws OrmException {
|
|
||||||
final AccountAgreement a =
|
|
||||||
new AccountAgreement(new AccountAgreement.Key(RpcUtil
|
|
||||||
.getAccountId(), id));
|
|
||||||
db.accountAgreements().insert(Collections.singleton(a));
|
|
||||||
return VoidResult.INSTANCE;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@@ -216,7 +216,7 @@ public class NewAgreementScreen extends AccountScreen {
|
|||||||
if (contactGroup.isVisible()) {
|
if (contactGroup.isVisible()) {
|
||||||
contactPanel.doSave();
|
contactPanel.doSave();
|
||||||
}
|
}
|
||||||
Util.ACCOUNT_SVC.enterAgreement(current.getId(),
|
Util.ACCOUNT_SEC.enterAgreement(current.getId(),
|
||||||
new GerritCallback<VoidResult>() {
|
new GerritCallback<VoidResult>() {
|
||||||
public void onSuccess(final VoidResult result) {
|
public void onSuccess(final VoidResult result) {
|
||||||
History.newItem(Link.SETTINGS_AGREEMENTS);
|
History.newItem(Link.SETTINGS_AGREEMENTS);
|
||||||
|
@@ -60,6 +60,10 @@ public final class ContributorAgreement {
|
|||||||
@Column
|
@Column
|
||||||
protected boolean requireContactInformation;
|
protected boolean requireContactInformation;
|
||||||
|
|
||||||
|
/** Does this agreement automatically verify new accounts? */
|
||||||
|
@Column
|
||||||
|
protected boolean autoVerify;
|
||||||
|
|
||||||
/** A short name for the agreement. */
|
/** A short name for the agreement. */
|
||||||
@Column(length = 40)
|
@Column(length = 40)
|
||||||
protected String shortName;
|
protected String shortName;
|
||||||
@@ -107,6 +111,14 @@ public final class ContributorAgreement {
|
|||||||
groupAgreement = g;
|
groupAgreement = g;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean isAutoVerify() {
|
||||||
|
return autoVerify;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setAutoVerify(final boolean g) {
|
||||||
|
autoVerify = g;
|
||||||
|
}
|
||||||
|
|
||||||
public boolean isRequireContactInformation() {
|
public boolean isRequireContactInformation() {
|
||||||
return requireContactInformation;
|
return requireContactInformation;
|
||||||
}
|
}
|
||||||
|
@@ -16,9 +16,11 @@ package com.google.gerrit.server;
|
|||||||
|
|
||||||
import com.google.gerrit.client.account.AccountSecurity;
|
import com.google.gerrit.client.account.AccountSecurity;
|
||||||
import com.google.gerrit.client.reviewdb.Account;
|
import com.google.gerrit.client.reviewdb.Account;
|
||||||
|
import com.google.gerrit.client.reviewdb.AccountAgreement;
|
||||||
import com.google.gerrit.client.reviewdb.AccountExternalId;
|
import com.google.gerrit.client.reviewdb.AccountExternalId;
|
||||||
import com.google.gerrit.client.reviewdb.AccountSshKey;
|
import com.google.gerrit.client.reviewdb.AccountSshKey;
|
||||||
import com.google.gerrit.client.reviewdb.ContactInformation;
|
import com.google.gerrit.client.reviewdb.ContactInformation;
|
||||||
|
import com.google.gerrit.client.reviewdb.ContributorAgreement;
|
||||||
import com.google.gerrit.client.reviewdb.ReviewDb;
|
import com.google.gerrit.client.reviewdb.ReviewDb;
|
||||||
import com.google.gerrit.client.rpc.BaseServiceImplementation;
|
import com.google.gerrit.client.rpc.BaseServiceImplementation;
|
||||||
import com.google.gerrit.client.rpc.NoSuchEntityException;
|
import com.google.gerrit.client.rpc.NoSuchEntityException;
|
||||||
@@ -129,4 +131,25 @@ public class AccountSecurityImpl extends BaseServiceImplementation implements
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void enterAgreement(final ContributorAgreement.Id id,
|
||||||
|
final AsyncCallback<VoidResult> callback) {
|
||||||
|
run(callback, new Action<VoidResult>() {
|
||||||
|
public VoidResult run(final ReviewDb db) throws OrmException, Failure {
|
||||||
|
final ContributorAgreement cla = db.contributorAgreements().get(id);
|
||||||
|
if (cla == null || !cla.isActive()) {
|
||||||
|
throw new Failure(new NoSuchEntityException());
|
||||||
|
}
|
||||||
|
|
||||||
|
final AccountAgreement a =
|
||||||
|
new AccountAgreement(new AccountAgreement.Key(RpcUtil
|
||||||
|
.getAccountId(), id));
|
||||||
|
if (cla.isAutoVerify()) {
|
||||||
|
a.review(AccountAgreement.Status.VERIFIED, null);
|
||||||
|
}
|
||||||
|
db.accountAgreements().insert(Collections.singleton(a));
|
||||||
|
return VoidResult.INSTANCE;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@@ -70,6 +70,7 @@ INSERT INTO contributor_agreements
|
|||||||
(active,
|
(active,
|
||||||
group_agreement,
|
group_agreement,
|
||||||
require_contact_information,
|
require_contact_information,
|
||||||
|
auto_verify,
|
||||||
short_name,
|
short_name,
|
||||||
short_description,
|
short_description,
|
||||||
agreement_url,
|
agreement_url,
|
||||||
@@ -77,6 +78,7 @@ INSERT INTO contributor_agreements
|
|||||||
'Y',
|
'Y',
|
||||||
'N',
|
'N',
|
||||||
'Y',
|
'Y',
|
||||||
|
'Y',
|
||||||
'Individual',
|
'Individual',
|
||||||
'If you are going to be contributing code on your own, this is the one you want. You can sign this one online.',
|
'If you are going to be contributing code on your own, this is the one you want. You can sign this one online.',
|
||||||
'static/cla_individual.html',
|
'static/cla_individual.html',
|
||||||
@@ -85,6 +87,7 @@ INSERT INTO contributor_agreements
|
|||||||
(active,
|
(active,
|
||||||
group_agreement,
|
group_agreement,
|
||||||
require_contact_information,
|
require_contact_information,
|
||||||
|
auto_verify,
|
||||||
short_name,
|
short_name,
|
||||||
short_description,
|
short_description,
|
||||||
agreement_url,
|
agreement_url,
|
||||||
@@ -92,6 +95,7 @@ INSERT INTO contributor_agreements
|
|||||||
'Y',
|
'Y',
|
||||||
'Y',
|
'Y',
|
||||||
'N',
|
'N',
|
||||||
|
'N',
|
||||||
'Corporate',
|
'Corporate',
|
||||||
'If you are going to be contributing code on behalf of your company, this is the one you want. We\'ll give you a form that will need to printed, signed and sent back via post, email or fax.',
|
'If you are going to be contributing code on behalf of your company, this is the one you want. We\'ll give you a form that will need to printed, signed and sent back via post, email or fax.',
|
||||||
'static/cla_corporate.html',
|
'static/cla_corporate.html',
|
||||||
|
Reference in New Issue
Block a user