sub folder in document library as rootNode for user - alfresco-share

I want a sub folder within Document library as rootNode in Alfresco Shave 4.2
For Example In Document Library the folder path is Documents > XYZ > User1. When user accesses Document Library by default the content in Documents > XYZ > User1 should be displayed instead of content in Document. If we customize rootNode property from below code which is part of toobar.get.js it should work..I replaced rootNode with XYZ and it works. But rootNode="XYZ/User1" does not work
Not sure how to speciy the sub folder ?
var docListToolbar = {
id: "DocListToolbar",
name: "Alfresco.DocListToolbar",
options: {
siteId: (page.url.templateArgs.site != null) ? page.url.templateArgs.site :"",
rootNode: toolbar.rootNode != null ? toolbar.rootNode : "",
hideNavBar: Boolean(toolbar.preferences.hideNavBar),
googleDocsEnabled: toolbar.googleDocsEnabled,
repositoryBrowsing: toolbar.rootNode != null,
useTitle: (useTitle == "true"),
syncMode: toolbar.syncMode != null ? toolbar.syncMode : "",
createContentByTemplateEnabled: model.createContentByTemplateEnabled,
createContentActions: model.createContent
}
};
model.widgets = [docListToolbar];
since edit online is not present in My Files we created a cutom site in Alfreso Share as a custom My Files section.

Maybe it's a bit late but I would suggest to create a custom site page, almost the same as document library, but with changed root node. And then you can easily replace Document Library page with custom one in site settings.
I have a quite nice example here: http://streetturtle.ninja/jekyll/update/2014/10/23/alf-custom-doclibrary-site-page/. It is almost the same as you want, but the root node changes according to the logged user.

Related

Show "Microsoft Active Directory" information table in WordPress

I have a spreadsheet in Microsoft Active Directory
Now I want to display the information in this table in WordPress
I came across this plugin according to the searches I did
But this plugin also does not have the ability to display information registered in Active Directory
What method or plugin do you think I should use to display Active Directory registered information in WordPress?
You have to call the Graph API to display user informatiom. This document is a good starting point.For example:
public function loadViewData()
{
$viewData = [];
// Check for flash errors
if (session('error')) {
$viewData['error'] = session('error');
$viewData['errorDetail'] = session('errorDetail');
}
// Check for logged on user
if (session('userName'))
{
$viewData['userName'] = session('userName');
$viewData['userEmail'] = session('userEmail');
$viewData['userTimeZone'] = session('userTimeZone');
}
return $viewData;
}
Please let me know if you have any questions.
Best,
James

Xamarin - CachedImage - Access the downloaded file

I am using the CachedImage component of ffimageloading. I have a kind of gallery with a carousel view.
All the images are loaded through an internet URL, they are not local images. I would like to add the image sharing function. But I don't want to download the file again, I would like to know if there is a way to access the file that the CachedImage component already downloaded to be able to reuse it in the share function.
try using MD5Helper
var path = ImageService.Instance.Config.MD5Helper.MD5("https://yourfileUrlOrKey")'
Thanks Jason
I share with you how part of my code is:
var key = ImageService.Instance.Config.MD5Helper.MD5("https://yourfileUrlOrKey");
var imagePath = await ImageService.Instance.Config.DiskCache.GetFilePathAsync(key);
var tempFile = Path.Combine(Path.GetTempPath(), "test.jpg");
if (File.Exists(tempFile))
{
File.Delete(tempFile);
}
File.Copy(imagePath, tempFile);
await Share.RequestAsync(new ShareFileRequest
{
Title = "Test",
File = new ShareFile(tempFile)
});
The temporary file I believe, since the cached file has no extension and the applications do not recognize the type.

DotCMIS IDocument does not give file path

I have an Alfresco 4.2 document at /Sites/swsdp/documentLibrary/Presentations/test1.txt with id workspace://SpacesStore/626216a1-5f9e-4010-a424-e2e0ec4f2663;1.0.
Here is my DotCMIS code to deal with a ChangeLog change event:
ICmisObject cmisObject = session.GetObject(
"workspace://SpacesStore/626216a1-5f9e-4010-a424-e2e0ec4f2663;1.0");
if (null != (document = cmisObject as IDocument))
{
String filename = document.ContentStreamFilename; // returns: "test1.txt"
List<String> paths = document.Paths; // returns: Empty list
}
Why is paths an empty list?
Why does it not contain /Sites/swsdp/documentLibrary/Presentations/test1.txt?
I know it is not exactly the same, but OpenCMIS documentation says this for the same method:
Returns the list of paths of this object or an empty list if this object is unfiled or if this object is the root folder
The problem is that I was using the old CMIS URL of Alfresco.
It is solved by using the new URL format:
http://<host>/alfresco/api/-default-/public/cmis/versions/1.0/atom
This isn't an answer but I can't add a comment since my rep is too low.
It works for me. I got a document's path using an Alfresco 4.2 system
btw, your code should be
String filename = document.ContentStreamFileName; //camel case
IList<String> paths = document.Paths; //IList vs List

How should I get and set a folder's group and user permission settings via Core Service?

I can get strings representing group and user permissions for a given folder with the following.
Code
// assumes Core Service client "client"
var folderData = client.Read("tcm:5-26-2", new ReadOptions()) as FolderData;
var accessControlEntryDataArray =
folderData.AccessControlList.AccessControlEntries;
Console.WriteLine(folderData.Title);
foreach (var accessControlEntryData in accessControlEntryDataArray)
{
Console.WriteLine("{0} has {1}",
accessControlEntryData.Trustee.Title,
accessControlEntryData.AllowedPermissions.ToString());
}
Output
Some Folder
Everyone has Read
Editor has None
Chief Editor has None
Publication Manager has None
Interaction Manager has None
T2011-CB-R2\areyes has All
[scope] Editor 020 Create has Read, Write
T2011-CB-R2\local1 has Read, Write, Delete
[rights] Author - Content has None
Seems like the four possible values for `AllowedPermissions are:
None
Read
Read, Write
Read, Write, Delete
All
This works great for my use case to create a folder permissions report. I can .Replace() these to a familiar notation (e.g. rw-- or rwdl).
But is manipulating these string values the right approach to set permissions as well? I'd imagine I'd want objects or maybe enums instead. Could someone point me in the right direction?
Also I noticed I get some, but not all non-applicable groups set as None. I don't specifically need them here, but I'm curious at what determines whether those get returned--did I miss something in my code?
Rights and Permissions are enums, indeed. You can set using the method below. If you want to set multiple rights you should do something like "Rights.Read | Rights.Write"
Keep in mind that this method will return you object that you have to save \ update \ create after
public static OrganizationalItemData SetPermissionsOnOrganizationalItem(
OrganizationalItemData organizationalItem,
TrusteeData trustee,
Permissions allowedPermissions,
Permissions deniedPermissions = Permissions.None)
{
if (organizationalItem.AccessControlList == null)
{
organizationalItem.AccessControlList
= new AccessControlListData
{AccessControlEntries = new AccessControlEntryData[0]};
}
var entries = organizationalItem.AccessControlList
.AccessControlEntries.ToList();
// First check if this trustee already has some permissions
var entry = entries.SingleOrDefault(
ace => ace.Trustee.IdRef == trustee.Id);
if (entry != null)
{
// Remove this entry
entries.Remove(entry);
}
entries.Add(new AccessControlEntryData
{
AllowedPermissions = allowedPermissions,
DeniedPermissions = deniedPermissions,
Trustee = new LinkToTrusteeData { IdRef = trustee.Id }
});
organizationalItem.AccessControlList.AccessControlEntries
= entries.ToArray();
return organizationalItem;
}

How to find files in a folder in an ASP.NET application using C#?

I have created an Asp.net application.
It contains a folder called PDF and a folder called Requirement just beneath that.
I have a link in another page called Requirement.
If i click on that link i need to find all the files in the folder PDF/Requirement.
var getFileName = Directory.GetFiles(Server.MapPath("~/PDF/Requirement")); // Collection Of file name with extention.
var getFileNameExcludeSomeExtension1 = from f in Directory.GetFiles(Server.MapPath("~/PDF/Requirement"))
where Path.GetExtension(f) != ".scc" && Path.GetExtension(f) != ".db"
select Path.GetFileNameWithoutExtension(f); // Collection Of file name with extention and filtering.
var getFileNameExcludeSomeExtension2 = from f in Directory.GetFiles(Server.MapPath("~/PDF/Requirement"))
where Path.GetExtension(f) != ".scc" && Path.GetExtension(f) != ".db"
select Path.GetFileName(f); // Collection Of file name with out extention and filtering.
I suggest to use EnumerateFiles as this Regex to find a file in folder and if you tried GetFiles dont because of performance you could see difference in this What is the difference between Directory.EnumerateFiles vs Directory.GetFiles?

Resources