use of com.zimbra.cs.account.Account in project zm-mailbox by Zimbra.
the class BUG_72007 method upgrdeAcount.
private void upgrdeAcount(String name) throws ServiceException {
if (name != null) {
Account acct = prov.get(AccountBy.name, name);
if (acct != null) {
Map<String, Object> attrs = new HashMap<String, Object>();
if (!acct.isIsSystemResource()) {
attrs.put(Provisioning.A_zimbraIsSystemResource, ProvisioningConstants.TRUE);
}
if (!acct.isIsSystemAccount()) {
attrs.put(Provisioning.A_zimbraIsSystemAccount, ProvisioningConstants.TRUE);
}
modifyAttrs(acct, attrs);
}
}
}
use of com.zimbra.cs.account.Account in project zm-mailbox by Zimbra.
the class SoapProvisioning method getAllAdminAccounts.
// SoapProvisioning only, for zmprov
public List<Account> getAllAdminAccounts(boolean applyDefault) throws ServiceException {
ArrayList<Account> result = new ArrayList<Account>();
GetAllAdminAccountsResponse resp = invokeJaxb(new GetAllAdminAccountsRequest(applyDefault));
for (AccountInfo acct : resp.getAccountList()) {
result.add(new SoapAccount(acct, this));
}
return result;
}
use of com.zimbra.cs.account.Account in project zm-mailbox by Zimbra.
the class DataSourceTask method call.
@Override
public Void call() {
ZimbraLog.clearContext();
ZimbraLog.addMboxToContext(getMailboxId());
ZimbraLog.datasource.debug("Running scheduled import for DataSource %s", getDataSourceId());
Mailbox mbox = null;
try {
// Look up mailbox, account and data source
mbox = MailboxManager.getInstance().getMailboxById(getMailboxId());
Account account = mbox.getAccount();
ZimbraLog.addAccountNameToContext(account.getName());
Provisioning prov = Provisioning.getInstance();
DataSource ds = prov.get(account, Key.DataSourceBy.id, getDataSourceId());
if (ds != null) {
ZimbraLog.addDataSourceNameToContext(ds.getName());
if (!ds.isEnabled()) {
ZimbraLog.datasource.info("DataSource is disabled. Cancelling future tasks.");
DataSourceManager.cancelTask(mbox, getDataSourceId());
return null;
}
// Do the work
DataSourceManager.importData(ds);
} else {
ZimbraLog.datasource.info("DataSource %s was deleted. Cancelling future tasks.", getDataSourceId());
DataSourceManager.cancelTask(mbox, getDataSourceId());
}
} catch (ServiceException e) {
ZimbraLog.datasource.warn("Scheduled DataSource import failed.", e);
return null;
}
ZimbraLog.clearContext();
return null;
}
use of com.zimbra.cs.account.Account in project zm-mailbox by Zimbra.
the class AutoScheduler method getAutoScheduler.
public static AutoScheduler getAutoScheduler(Mailbox userMailbox, Mailbox calendarMailbox, Invite[] origInvites, int calendarMailItemId, int flags, String[] tags, SetCalendarItemData scidDefault, SetCalendarItemData[] scidExceptions, List<ReplyInfo> replies, DavContext context) {
if (!DavResource.isCalendarAutoSchedulingEnabled()) {
return null;
}
if (calendarMailbox == null) {
// We don't know who to act as
return null;
}
ZOrganizer organizer = null;
Account organizerAcct = null;
try {
if (scidDefault == null || scidDefault.invite == null) {
if (isEmpty(origInvites)) {
// No new or old invites!
return null;
}
organizer = origInvites[0].getOrganizer();
organizerAcct = origInvites[0].getOrganizerAccount();
} else {
organizer = scidDefault.invite.getOrganizer();
organizerAcct = scidDefault.invite.getOrganizerAccount();
}
if (organizer == null) {
// no organizer means no scheduling
return null;
}
// TODO: Does the auth user have scheduling capability for the calendar
if (calendarMailbox.getAccount().sameAccount(organizerAcct)) {
return new OrganizerAutoScheduler(userMailbox, calendarMailbox, origInvites, calendarMailItemId, flags, tags, scidDefault, scidExceptions, replies, context);
} else {
return new AttendeeAutoScheduler(userMailbox, calendarMailbox, origInvites, calendarMailItemId, flags, tags, scidDefault, scidExceptions, replies, context);
}
} catch (ServiceException e) {
ZimbraLog.dav.debug("Hit this whilst getting AutoScheduler", e);
}
return null;
}
use of com.zimbra.cs.account.Account in project zm-mailbox by Zimbra.
the class CalDavUtils method removeAttendeeForOrganizer.
// Fixup for ATTENDEE properties set by Apple iCal
// Don't let the organizer to be also listed as an attendee.
public static void removeAttendeeForOrganizer(ZComponent comp) {
if (!DebugConfig.caldavAllowAttendeeForOrganizer && (ICalTok.VEVENT.equals(comp.getTok()) || ICalTok.VTODO.equals(comp.getTok()))) {
String organizer = comp.getPropVal(ICalTok.ORGANIZER, null);
if (organizer != null) {
organizer = organizer.trim();
AccountAddressMatcher acctMatcher = null;
String address = stripMailto(organizer);
if (address != null) {
try {
Account acct = Provisioning.getInstance().get(AccountBy.name, address);
if (acct != null) {
acctMatcher = new AccountAddressMatcher(acct);
}
} catch (ServiceException e) {
// ignore
ZimbraLog.dav.warn("could not get the account matcher for " + address, e);
}
}
for (Iterator<ZProperty> propIter = comp.getPropertyIterator(); propIter.hasNext(); ) {
ZProperty prop = propIter.next();
if (ICalTok.ATTENDEE.equals(prop.getToken())) {
String att = prop.getValue();
if (att != null) {
att = att.trim();
try {
// iCal has a habit of listing the organizer as an ATTENDEE. Undo it.
if (att.equalsIgnoreCase(organizer) || (acctMatcher != null && acctMatcher.matches(stripMailto(att)))) {
propIter.remove();
}
} catch (ServiceException e) {
// ignore
ZimbraLog.dav.warn("exception while matching the attendee address " + att, e);
}
} else {
// We haven't seen this case occur, but just in case.
propIter.remove();
}
}
}
}
}
}
Aggregations