From ea6f8ffa1f60e592fe454d9d86e2dcf7af27622d Mon Sep 17 00:00:00 2001 From: Michael Bayne Date: Thu, 22 May 2008 12:03:51 +0000 Subject: [PATCH] Use the new Permission objects. git-svn-id: svn+ssh://src.earth.threerings.net/vilya/trunk@600 c613c5cb-e716-0410-b11b-feb51c14d237 --- src/java/com/threerings/stage/data/StageCodes.java | 11 +++++------ .../threerings/stage/server/StageSceneManager.java | 12 ++---------- 2 files changed, 7 insertions(+), 16 deletions(-) diff --git a/src/java/com/threerings/stage/data/StageCodes.java b/src/java/com/threerings/stage/data/StageCodes.java index fcb1254b..211ef94a 100644 --- a/src/java/com/threerings/stage/data/StageCodes.java +++ b/src/java/com/threerings/stage/data/StageCodes.java @@ -24,6 +24,7 @@ package com.threerings.stage.data; import com.threerings.util.MessageBundle; import com.threerings.presents.data.InvocationCodes; +import com.threerings.presents.data.Permission; import com.threerings.crowd.data.BodyObject; @@ -38,13 +39,11 @@ public interface StageCodes extends InvocationCodes /** The resource set that contains our tileset bundles. */ public static final String TILESET_RSRC_SET = "tilesets"; - /** The access control identifier for scene modification privileges. - * See {@link BodyObject#checkAccess}. */ - public static final String MODIFY_SCENE_ACCESS = "stage.modify_scene"; + /** The access control identifier for scene modification privileges. */ + public static final Permission MODIFY_SCENE_ACCESS = new Permission(); - /** The access control identifier for potentially damaging scene - * modification privileges. See {@link BodyObject#checkAccess}. */ - public static final String MUTILATE_SCENE_ACCESS = "stage.mutilate_scene"; + /** The access control identifier for potentially damaging scene modification privileges. */ + public static final Permission MUTILATE_SCENE_ACCESS = new Permission(); /** An error delivered when adding objects to scenes. */ public static final String ERR_NO_OVERLAP = MessageBundle.qualify( diff --git a/src/java/com/threerings/stage/server/StageSceneManager.java b/src/java/com/threerings/stage/server/StageSceneManager.java index b0e0e5b3..71c4868a 100644 --- a/src/java/com/threerings/stage/server/StageSceneManager.java +++ b/src/java/com/threerings/stage/server/StageSceneManager.java @@ -176,11 +176,7 @@ public class StageSceneManager extends SpotSceneManager StageSceneService.ConfirmListener listener) throws InvocationException { - BodyObject user = (BodyObject)caller; - String err = user.checkAccess(StageCodes.MODIFY_SCENE_ACCESS, _sscene); - if (err != null) { - throw new InvocationException(err); - } + InvocationException.requireAccess(caller, StageCodes.MODIFY_SCENE_ACCESS, _sscene); if (addObject(info, false, true)) { listener.requestProcessed(); @@ -194,11 +190,7 @@ public class StageSceneManager extends SpotSceneManager StageSceneService.ConfirmListener listener) throws InvocationException { - BodyObject user = (BodyObject)caller; - String err = user.checkAccess(StageCodes.MODIFY_SCENE_ACCESS, _sscene); - if (err != null) { - throw new InvocationException(err); - } + InvocationException.requireAccess(caller, StageCodes.MODIFY_SCENE_ACCESS, _sscene); // create our scene update which will be stored in the database // and used to efficiently update clients