Several fixes.

This commit is contained in:
Paulo Gustavo Veiga
2012-08-26 16:53:33 -03:00
parent 361beb371f
commit c4f3feb92e
8 changed files with 67 additions and 47 deletions

View File

@@ -264,10 +264,12 @@ public class Mindmap {
}
public boolean hasPermissions(@NotNull Collaborator collaborator, @NotNull CollaborationRole role) {
final Collaboration collaboration = this.findCollaboration(collaborator);
boolean result = false;
if (collaboration != null) {
result = collaboration.hasPermissions(role);
if (collaborator != null) {
final Collaboration collaboration = this.findCollaboration(collaborator);
if (collaboration != null) {
result = collaboration.hasPermissions(role);
}
}
return result;

View File

@@ -23,6 +23,7 @@ import com.wisemapping.exceptions.WiseMappingException;
import com.wisemapping.model.CollaborationRole;
import com.wisemapping.model.Mindmap;
import com.wisemapping.model.MindMapHistory;
import com.wisemapping.model.User;
import com.wisemapping.security.Utils;
import com.wisemapping.service.MindmapService;
import com.wisemapping.view.MindMapBean;
@@ -143,9 +144,9 @@ public class MindmapController {
// Configure default locale for the editor ...
final Locale locale = LocaleContextHolder.getLocale();
model.addAttribute("locale", locale.toString().toLowerCase());
model.addAttribute("principal", Utils.getUser());
model.addAttribute("readOnlyMode", !mindmap.hasPermissions(Utils.getUser(), CollaborationRole.EDITOR));
final User collaborator = Utils.getUser();
model.addAttribute("principal", collaborator);
model.addAttribute("readOnlyMode", !mindmap.hasPermissions(collaborator, CollaborationRole.EDITOR));
return "mindmapEditor";
}

View File

@@ -32,10 +32,6 @@ mail.smtp.auth=false
mail.smtp.starttls.enable=false
mail.smtp.quitwait=false
#------------------------
# SSL SMTP Server Configuration
#------------------------
#------------------------
# GMAIL SMTP Configuration
#------------------------
@@ -58,7 +54,7 @@ mail.serverSendEmail=root@localhost
mail.supportEmail=root@localhost
# Optional: Unexpected errors will be reported to this address.
mail.errorReporterEmail=support@wisemapping.com
mail.errorReporterEmail=bug-report@wisemapping.com
##################################################################################
# Users Registration Configuration

View File

@@ -1,9 +0,0 @@
# Configuration file for javax.mail
# Host whose mail services will be used
# (Default value : localhost)
mail.host=mail.wisemapping.com
# Return address to appear on emails
# (Default value : username@host)
mail.from=webmaster@wisemapping.com

View File

@@ -28,6 +28,7 @@
<sec:http pattern="/c/home" security="none"/>
<sec:http pattern="/c/maps/*/embed" security="none"/>
<sec:http pattern="/c/maps/*/try" security="none"/>
<sec:http pattern="/c/maps/*/public" security="none"/>
<sec:http pattern="/c/GCFInstall" security="none"/>

View File

@@ -4,17 +4,17 @@ starred BOOL NOT NULL default 0,
mindmap_properties varchar(512) CHARACTER SET utf8
) CHARACTER SET utf8;
drop table `wisemapping`.`MINDMAP_NATIVE`;
ALTER TABLE `wisemapping`.`MINDMAP_COLABORATOR` RENAME TO `wisemapping`.`COLLABORATION`;
ALTER TABLE `wisemapping`.`COLABORATOR` RENAME TO `wisemapping`.`COLLABORATOR`;
drop table `MINDMAP_NATIVE`;
ALTER TABLE `MINDMAP_COLABORATOR` RENAME TO `COLLABORATION`;
ALTER TABLE `COLABORATOR` RENAME TO `COLLABORATOR`;
ALTER TABLE `wisemapping`.`MINDMAP` DROP COLUMN `editor_properties` , DROP COLUMN `mindMapNative_id` ;
ALTER TABLE `MINDMAP` DROP COLUMN `editor_properties` , DROP COLUMN `mindMapNative_id` ;
ALTER TABLE `wisemapping`.`MINDMAP` CHANGE COLUMN `owner_id` `creator_id` INT(11) NOT NULL
ALTER TABLE `MINDMAP` CHANGE COLUMN `owner_id` `creator_id` INT(11) NOT NULL
, DROP INDEX `owner_id`
, ADD INDEX `owner_id` (`creator_id` ASC) ;
ALTER TABLE `wisemapping`.`COLLABORATION` ADD COLUMN `properties_id` INT(11) NULL DEFAULT NULL AFTER `role_id` ;
ALTER TABLE `COLLABORATION` ADD COLUMN `properties_id` INT(11) NULL DEFAULT NULL AFTER `role_id` ;
DROP TABLE USER_LOGIN;
CREATE TABLE ACCESS_AUDITORY (
@@ -26,22 +26,22 @@ login_date date
#ALTER TABLE ACCESS_AUDITORY
# ADD CONSTRAINT `user_id`
# FOREIGN KEY ()
# REFERENCES `wisemapping`.`USER` ()
# REFERENCES `USER` ()
# ON DELETE CASCADE
# ON UPDATE NO ACTION
#, ADD INDEX `user_id` () ;
ALTER TABLE `wisemapping`.`MINDMAP_HISTORY` DROP COLUMN `creator_user` , ADD COLUMN `editor_id` INT(11) NULL DEFAULT NULL AFTER `creation_date`;
ALTER TABLE `MINDMAP_HISTORY` DROP COLUMN `creator_user` , ADD COLUMN `editor_id` INT(11) NULL DEFAULT NULL AFTER `creation_date`;
ALTER TABLE `wisemapping`.`USER` ADD COLUMN `locale` VARCHAR(5) NULL AFTER `allowSendEmail` ;
ALTER TABLE `USER` ADD COLUMN `locale` VARCHAR(5) NULL AFTER `allowSendEmail` ;
ALTER TABLE `wisemapping`.`MINDMAP` DROP COLUMN `last_editor` , ADD COLUMN `last_editor_id` INT(11) NULL DEFAULT 9 AFTER `tags` ;
ALTER TABLE `MINDMAP` DROP COLUMN `last_editor` , ADD COLUMN `last_editor_id` INT(11) NULL DEFAULT 2 AFTER `tags` ;
ALTER TABLE `wisemapping`.`USER` DROP COLUMN `username` , CHANGE COLUMN `activationCode` `activation_code` BIGINT(20) NOT NULL , CHANGE COLUMN `allowSendEmail` `allow_send_email` CHAR(1) NOT NULL DEFAULT '0' ;
ALTER TABLE `USER` DROP COLUMN `username` , CHANGE COLUMN `activationCode` `activation_code` BIGINT(20) NOT NULL , CHANGE COLUMN `allowSendEmail` `allow_send_email` CHAR(1) NOT NULL DEFAULT '0' ;
INSERT INTO `wisemapping`.`MINDMAP` (`last_editor_id`) VALUES (1);
INSERT INTO `MINDMAP` (`last_editor_id`) VALUES (1);
INSERT INTO `wisemapping`.`COLLABORATOR` (`id`, `email`, `creation_date`) VALUES (8081, 'migfake@wisemapping.com', '2007-10-09');
DELETE FROM `wisemapping`.`USER` where activation_date is null;
INSERT INTO `COLLABORATOR` (`id`, `email`, `creation_date`) VALUES (8081, 'migfake@wis.com', '2007-10-09');
DELETE FROM `USER` where activation_date is null;
DROP TABLE FEEDBACK;