Create user group as subgroup in WebSphere 7 (Portal) - user-management

In a portlet running on a websphere 7 portal server I want to create a new user group that is a subgroup of an existing group.
Here is the code (that I shortend as much as possible to keep the focus):
/* vars */
final PumaController controller = ...;
final PumaLocator locator = ...;
final PumaProfile pumeProfile = ...;
final groupCn = ... ;
/* code to add group */
final List<Group> parent = locator.findGroupsByAttribute("cn", CN_OF_GROUP);
final String parentDn = pumaProfile.getIdentifier(parent.get(0));
log.debug("creating new group with cn=" + groupCn + ", parentDn=" + parentDn);
newGroup = controller.createGroup(groupCn, parentDn, new HashMap<String, Object>(0));
The debug statement prints:
creating new group with
cn=[groupCn],
parentDn=cn=[CN_OF_GROUP],o=defaultWIMFileBasedRealm
The code DOES create a group. But it looks like the parentDN argument is ignored. The group is not created as a subgroup of parent, but it is created as a top level group. (Which is the same thing that happens if I pass null as parentDn).
What am I doing wrong here?

Probably nothing. I would raise a PMR if I were you.
If you configured federated security instead of standalone security please delete the file based realm by the way. You should always delete it when configuring federated security.

Related

Fabric js select object in group

Is it possible to select a single object from a group created like this?
var r = new fabric.Rect(...);
var l = new fabric.Line(...);
var roadGroup = new fabric.Group([r,l],{ ... });
So I want to have a group, but select objects l or r separately.
The simple answer is yes, but you should make sure you take into account the purpose of a group.
To get a handle on an object that is wrapped in a group you can do something like this:
var r = roadGroup._objects[0];
var l = roadGroup._objects[1];
To select a child of a group try something like this:
fabricCanvas.setActiveObject(roadGroup._objects[0]);
soapbox:
The purpose of creating a group is to treat several objects as if they were a single one. The purpose of selecting an object is to allow user interactions with an object. If you want your user to interact with a portion of a group, you might want to consider not grouping them in the first place, or else un-grouping them prior to selecting the child object.
/soapbox
I believe _objects is to be used internally only and may thus change in the future.
To me it group.item(indexOfItem) seems to be the way
So I had this scenario where I have multiple images in a box. Those all images move along with the box (as a group) but user should also be able to select an individual image and move it.
Basically I wanted to select individual objects (in my case images) of group, I did it like this:
groupImages.forEach(image => image.on('mousedown', function (e) {
var group = e.target;
if (group && group._objects) {
var thisImage = group._objects.indexOf(image);
var item = group._objects[thisImage];//.find(image);
canvas.setActiveObject(item);
}
}));
groupImages could be list of objects which you want to select individually.

create a filter not a group filter

I am creating a custom module in Orchard , I would like to create a query programmatically.
string queryName= "Product";
var item = _orchardServices.ContentManager.New("Query");
item.As<TitlePart>().Title =queryName;
_orchardServices.ContentManager.Create(item, VersionOptions.Draft);
if (!item.Has<IPublishingControlAspect>() && !item.TypeDefinition.Settings.GetModel<ContentTypeSettings>().Draftable)
_orchardServices.ContentManager.Publish(item);
var queryPart = item.As<QueryPart>();
queryPart.ContentItem.ContentType = queryName;
string desc =" filter for the query";
string contentType = "CommonPart.ChannelID.";
var filterGroupRecord = new FilterGroupRecord();
var filterRecord = new FilterRecord()
{
Category = "CommonPartContentFields",
Type = contentType,
Position = 0,
};
filterRecord.State = "<Form><Description>" + desc + "</Description><Operator>Equals</Operator><Value>ChannelId</Value></Form>";
filterGroupRecord.Filters.Add(filterRecord);
queryPart.FilterGroups.Insert(0, filterGroupRecord);
the problem is that:I want set a filters of the query,not a filters group.
could you tell me how to improve my code?
Database structure and class declarations make it impossible. Why do you need it?
Update:
I means that you must use FilterGroupRecord at least one.
But when Query published that Filter Group will be created automatically if query have not yet Filter Group (see at QueryPartHandler). You should add your filters to this group. And not needed to create new group.
var existingFilterGroup = queryPart.FilterGroups[0];
existingFilterGroup.Filters.Add(filterRecord);
Update 2:
To avoid problems with draftable query (and several other potential problems Orchard CMS: Adding default data to fields and then querying them) it is better to move the calling Publish method to the end of your code and other part of your code should be left unchanged. And in your case would be better if you will always publish your query without checking IPublishingControlAspect and Draftable.

The Requested Resources was not found or you do not have sufficient permissions to view it

Dynamics crm when retrieving value and updating it into another entity it showing like
The Requested Resources was not found or you do not have sufficient permissions to view it
i specified update ids like
enobj.Id=(Guid)context.OutputParameters["id"];
message:create
service :update on another entity
this is my code:
Query Expression query = new Query Expression();
query.EntityName = en.LogicalName;
query.ColumnSet = new ColumnSet("new_amount");
var x = service.RetrieveMultiple(query);
Entity enobj = new Entity("new_product");
int i = 0;
foreach (var item in x.Entities)
{
i = i + (int)item.Attributes["new_amount"];
enobj.Attributes["new_grandtotal"] = i;
}
enobj.Id=(Guid)context.OutputParameters["id"];
// en.Id = enobj.Id;
enobj.Id = en.Id;
service.Update(enobj);
message:create
service :update
i have two entites product and productlineitems
in productlineitems iam creating a record with the field amount 50 after creating that value.iam updating on product entity.
again i create productlineitem 2 with the value some 90.iam adding 50+90 =140
again lineitem 3 with the value. iam taking that on product entity
message:create --- productlineitems
service :update --- product
I think you are trying to update Product with Product Line Id. Try the following:
Replace
enobj.Id = en.Id;
With
// set the field name (key) based on what you got in system
enobj.Id = (Guid)en["new_productid"];
Also, Calling Context is set to Current user. So make sure that user have permissions to update Product.

How to restrict editing in SP List only to own Items?

I'm looking for possibility to define following options for Sharepoint list. I know it can be done from interface, but how to make if from XML or code? Can I set this somewhere in List Definition or List Instance:
Contributors should be able to create items, but should not be able to modify nor delete items of other users (but edit own items - yes).
Approvers, Site administrators and Site collection administraotrs should have full control over all items
Trikks, this is one solution, but you had me thinking.Turns out, the thing I needed is WriteSecurity. I added feature receiver, and in FeatureActivated I set SPList.WriteSecurity = 2 on this list.
I found this MSDN docu, http://msdn.microsoft.com/en-us/library/dd588628(v=office.11).aspx
I suppose it's possible to set this in code, but where?
I added this part to schema.xml in ListDefinition, as in documentation, but this doesn't work. After deployment and creating new list, I go to List Settings -> Advanced Settings and check 'Create and Edit access'. Still, checked is the first option, not second.
You are most likely looking for the RoleAssignments property that is available for most scopes.
Suppose you could start with something like this
private void DoStuff()
{
SPList list = web.Lists["MyList"];
// Create custom role
SPRoleDefinitionCollection roles = web.RoleDefinitions;
SPRoleDefinition roleDefinition = roles["Contribute"];
roleDefinition.BasePermissions = SPBasePermissions.AddListItems |
SPBasePermissions.BrowseDirectories |
SPBasePermissions.EditListItems |
SPBasePermissions.DeleteListItems |
SPBasePermissions.AddDelPrivateWebParts;
roleDefinition.Update();
//Creates a new role assignment for a group
SPGroup myGroup = web.SiteGroups["Team Site Members"];
SPRoleAssignmentCollection roleAssignments = web.RoleAssignments;
// SPRoleAssignment accepts a SPPrincipal which can be a SPUser or SPGroup
SPRoleAssignment roleAssignment = new SPRoleAssignment(myGroup);
//add a new role definition to the bound role definitions for the role assignment
SPRoleDefinitionBindingCollection roleDefBindings = roleAssignment.RoleDefinitionBindings;
roleDefBindings.Add(roles["Contribute"]);
//Add the new role assignment to the collection of role assignments for the site.
roleAssignments.Add(roleAssignment);
// Stop inheriting permissions
list.BreakRoleInheritance(true);
list.RoleAssignments.Add(roleAssignment);
list.Update();
}

Cognos 8 SDK: How to get Subgroups of a Group?

I try to get the Subgroup of a Group in the standard Cognos Namespace.
Quering the Contentstore to get ALL groups works fine.
The standard methodes to get "members" of objects return the users or only the "root" group (the group I want the subgroups of). Nothing else....
Am I doing something wrong or is it just "not to be done" ?
I found a way of doing it:
Assuming you have the searchpath for the group you want the subgroups of.
Query the contentstore for it with following PropEnum:
PropEnum[] props = {
PropEnum.defaultName,
PropEnum.searchPath,
PropEnum.members };
As result you get a BaseClass[] object (with only one element though...).
Import com.cognos.developer.schemas.bibus._3.Group <--- this is part of the Cognos SDK libraries and
now you can cast the object[0] to Group.
object.getMembers().getValue()[] is an array of all members INCLUDING groups, roles, accounts.
In java it looks like this (query for the object already done):
Group group = (Group)object[0];
BaseClass obj = null;
for (int i = 0; i < group.getMembers().getValue().length; i++){
obj = group.getMembers().getValue();
System.out.println(obj.getSearchPath().getValue());
}

Resources