[STORM-68b] Default permissions floater overhaul
Adds separated default permissions for Objects, Uploads, Scripts, Notecards, Gestures and Wearables. Compatible with Export Permission Backwards compatible with default permissions for objects on regions where AgentPreferences capability is not available (opensim users rejoice!) These changes to llfloaterperms are made available under lgpl, if there's a v3 that wants to adopt default export permission for opensim.
This commit is contained in:
@@ -47,6 +47,7 @@
|
||||
#include "llinventorybridge.h"
|
||||
#include "llinventorypanel.h"
|
||||
#include "llfloaterinventory.h"
|
||||
#include "llfloaterperms.h"
|
||||
|
||||
#include "lllandmark.h"
|
||||
#include "llviewerassettype.h"
|
||||
@@ -950,23 +951,72 @@ void activate_gesture_cb(const LLUUID& inv_item)
|
||||
LLGestureMgr::instance().activateGesture(inv_item);
|
||||
}
|
||||
|
||||
void create_script_cb(const LLUUID& inv_item)
|
||||
{
|
||||
if (!inv_item.isNull())
|
||||
{
|
||||
LLViewerInventoryItem* item = gInventory.getItem(inv_item);
|
||||
if (item)
|
||||
{
|
||||
LLPermissions perm = item->getPermissions();
|
||||
perm.setMaskEveryone(LLFloaterPerms::getEveryonePerms("Scripts"));
|
||||
perm.setMaskGroup(LLFloaterPerms::getGroupPerms("Scripts"));
|
||||
|
||||
item->setPermissions(perm);
|
||||
|
||||
item->updateServer(FALSE);
|
||||
gInventory.updateItem(item);
|
||||
gInventory.notifyObservers();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void create_gesture_cb(const LLUUID& inv_item)
|
||||
{
|
||||
if (inv_item.isNull())
|
||||
return;
|
||||
|
||||
LLGestureMgr::instance().activateGesture(inv_item);
|
||||
|
||||
LLViewerInventoryItem* item = gInventory.getItem(inv_item);
|
||||
if (!item) return;
|
||||
gInventory.updateItem(item);
|
||||
gInventory.notifyObservers();
|
||||
|
||||
if(!LLPreview::show(inv_item,FALSE))
|
||||
if (!inv_item.isNull())
|
||||
{
|
||||
LLPreviewGesture* preview = LLPreviewGesture::show(std::string("Gesture: ") + item->getName(), inv_item, LLUUID::null);
|
||||
// Force to be entirely onscreen.
|
||||
gFloaterView->adjustToFitScreen(preview, FALSE);
|
||||
LLGestureMgr::instance().activateGesture(inv_item);
|
||||
|
||||
LLViewerInventoryItem* item = gInventory.getItem(inv_item);
|
||||
if (item)
|
||||
{
|
||||
LLPermissions perm = item->getPermissions();
|
||||
perm.setMaskEveryone(LLFloaterPerms::getEveryonePerms("Gestures"));
|
||||
perm.setMaskGroup(LLFloaterPerms::getGroupPerms("Gestures"));
|
||||
|
||||
item->setPermissions(perm);
|
||||
|
||||
item->updateServer(FALSE);
|
||||
gInventory.updateItem(item);
|
||||
gInventory.notifyObservers();
|
||||
|
||||
if (!LLPreview::show(inv_item,FALSE))
|
||||
{
|
||||
LLPreviewGesture* preview = LLPreviewGesture::show(std::string("Gesture: ") + item->getName(), inv_item, LLUUID::null);
|
||||
// Force to be entirely onscreen.
|
||||
gFloaterView->adjustToFitScreen(preview, FALSE);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void create_notecard_cb(const LLUUID& inv_item)
|
||||
{
|
||||
if (!inv_item.isNull())
|
||||
{
|
||||
LLViewerInventoryItem* item = gInventory.getItem(inv_item);
|
||||
if (item)
|
||||
{
|
||||
LLPermissions perm = item->getPermissions();
|
||||
perm.setMaskEveryone(LLFloaterPerms::getEveryonePerms("Notecards"));
|
||||
perm.setMaskGroup(LLFloaterPerms::getGroupPerms("Notecards"));
|
||||
|
||||
item->setPermissions(perm);
|
||||
|
||||
item->updateServer(FALSE);
|
||||
gInventory.updateItem(item);
|
||||
gInventory.notifyObservers();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1225,22 +1275,45 @@ void create_new_item(const std::string& name,
|
||||
LLViewerAssetType::generateDescriptionFor(asset_type, desc);
|
||||
next_owner_perm = (next_owner_perm) ? next_owner_perm : PERM_MOVE | PERM_TRANSFER;
|
||||
|
||||
|
||||
if (inv_type == LLInventoryType::IT_GESTURE)
|
||||
LLPointer<LLInventoryCallback> cb = NULL;
|
||||
|
||||
switch(inv_type)
|
||||
{
|
||||
LLPointer<LLInventoryCallback> cb = new LLBoostFuncInventoryCallback(create_gesture_cb);
|
||||
create_inventory_item(gAgent.getID(), gAgent.getSessionID(),
|
||||
parent_id, LLTransactionID::tnull, name, desc, asset_type, inv_type,
|
||||
NOT_WEARABLE, next_owner_perm, cb);
|
||||
case LLInventoryType::IT_LSL:
|
||||
{
|
||||
cb = new LLBoostFuncInventoryCallback(create_script_cb);
|
||||
next_owner_perm = LLFloaterPerms::getNextOwnerPerms("Scripts");
|
||||
break;
|
||||
}
|
||||
|
||||
case LLInventoryType::IT_GESTURE:
|
||||
{
|
||||
cb = new LLBoostFuncInventoryCallback(create_gesture_cb);
|
||||
next_owner_perm = LLFloaterPerms::getNextOwnerPerms("Gestures");
|
||||
break;
|
||||
}
|
||||
|
||||
case LLInventoryType::IT_NOTECARD:
|
||||
{
|
||||
cb = new LLBoostFuncInventoryCallback(create_notecard_cb);
|
||||
next_owner_perm = LLFloaterPerms::getNextOwnerPerms("Notecards");
|
||||
break;
|
||||
}
|
||||
default:
|
||||
break;
|
||||
}
|
||||
else
|
||||
{
|
||||
LLPointer<LLInventoryCallback> cb = NULL;
|
||||
create_inventory_item(gAgent.getID(), gAgent.getSessionID(),
|
||||
parent_id, LLTransactionID::tnull, name, desc, asset_type, inv_type,
|
||||
NOT_WEARABLE, next_owner_perm, cb);
|
||||
}
|
||||
|
||||
|
||||
create_inventory_item(gAgent.getID(),
|
||||
gAgent.getSessionID(),
|
||||
parent_id,
|
||||
LLTransactionID::tnull,
|
||||
name,
|
||||
desc,
|
||||
asset_type,
|
||||
inv_type,
|
||||
NOT_WEARABLE,
|
||||
next_owner_perm,
|
||||
cb);
|
||||
}
|
||||
|
||||
const std::string NEW_LSL_NAME = "New Script"; // *TODO:Translate? (probably not)
|
||||
@@ -1281,7 +1354,7 @@ const std::string NEW_GESTURE_NAME = "New Gesture"; // *TODO:Translate? (probabl
|
||||
parent_id,
|
||||
LLAssetType::AT_LSL_TEXT,
|
||||
LLInventoryType::IT_LSL,
|
||||
PERM_MOVE | PERM_TRANSFER);
|
||||
PERM_MOVE | PERM_TRANSFER); // overridden in create_new_item
|
||||
}
|
||||
else if ("notecard" == type_name)
|
||||
{
|
||||
@@ -1290,7 +1363,7 @@ const std::string NEW_GESTURE_NAME = "New Gesture"; // *TODO:Translate? (probabl
|
||||
parent_id,
|
||||
LLAssetType::AT_NOTECARD,
|
||||
LLInventoryType::IT_NOTECARD,
|
||||
PERM_ALL);
|
||||
PERM_ALL); // overridden in create_new_item
|
||||
}
|
||||
else if ("gesture" == type_name)
|
||||
{
|
||||
@@ -1299,7 +1372,7 @@ const std::string NEW_GESTURE_NAME = "New Gesture"; // *TODO:Translate? (probabl
|
||||
parent_id,
|
||||
LLAssetType::AT_GESTURE,
|
||||
LLInventoryType::IT_GESTURE,
|
||||
PERM_ALL);
|
||||
PERM_ALL); // overridden in create_new_item
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user