On Tue, Nov 23, 2010 at 12:16 AM, Senaka Fernando <sen...@wso2.com> wrote:
> > > On Mon, Nov 22, 2010 at 6:10 PM, Manjula Rathnayake <manju...@wso2.com>wrote: > >> Hi all, >> >> In Simple Queue Service(SQS) we can share queues with other users who have >> AWS accounts registered. >> And they don't need to sign up with SQS. We can set permission to actions >> involved with queue services >> as an example, SendMessage, DeleteMessage and so on. >> >> According to the SQS wsdl, sharing a queue with other users is done by >> AddPermission() method which >> takes input parameters as >> LabelName - String >> AWSAccountIds - String[] >> ActionNames - String[] >> >> To remove permissions we can use, >> removePermission(String LabelName) >> >> So, It is assumed that for each AWSAccountIds has been given permission >> to all ActionNames. >> Is this assumption correct? please have a look and give your comments. >> >> Assuming above understanding is correct, checking user permissions to do >> actions on queue is >> implemented as below. >> >> public class PermissionLabel { >> private List<String> sharedUserList; >> private List<String> operationList; >> >> public PermissionLabel(List<String> sharedUserList, >> List<String> operationList) { >> this.sharedUserList = sharedUserList; >> this.operationList = operationList; >> } >> >> public List<String> getSharedUserList() { >> return sharedUserList; >> } >> >> public boolean isSharedForOperation(String loggedInUser, String >> operation) { >> if (sharedUserList.contains(loggedInUser) && >> operationList.contains(operation)) { >> return true; >> } else { >> return false; >> } >> } >> > > Thought of mentioning this then and there, to everybody in general; since > we actually have made similar mistakes, which was noticed during recent code > reviews. > > Minor improvement to code: > > > public boolean isSharedForOperation(String loggedInUser, String > operation) { > if (sharedUserList.contains(loggedInUser) && > operationList.contains(operation)) { > return true; > } else { > return false; > } > } > > This should be: > > > public boolean isSharedForOperation(String loggedInUser, String > operation) { > return sharedUserList.contains(loggedInUser) && > operationList.contains(operation); > } > +1 > > If you used Idea, I believe that it should've suggested the replacement > that I pointed out. > > Thanks, > Senaka. > > } >> >> >> More details of these operations is available at [1] and in the attached >> file. >> [1]. >> http://docs.amazonwebservices.com/AWSSimpleQueueService/latest/SQSDeveloperGuide/index.html?acp-overview.html#PermissionTypes >> >> >> -- >> Manjula Rathnayaka >> Software Engineer >> WSO2, Inc. >> Mobile:+94 77 743 1987 >> >> _______________________________________________ >> Carbon-dev mailing list >> Carbon-dev@wso2.org >> https://wso2.org/cgi-bin/mailman/listinfo/carbon-dev >> >> > > > -- > *Senaka Fernando* > Associate Technical Lead & Product Manager - WSO2 G-Reg; > WSO2, Inc.; http://wso2.com > * > Member; Apache Software Foundation; http://apache.org > > E-mail: senaka AT wso2.com > **P: +1 408 754 7388; ext: 51736*; *M: +94 77 322 1818 > Linked-In: http://www.linkedin.com/in/senakafernando > > *Lean . Enterprise . Middleware > > -- Manjula Rathnayaka Software Engineer WSO2, Inc. Mobile:+94 77 743 1987
_______________________________________________ Carbon-dev mailing list Carbon-dev@wso2.org https://wso2.org/cgi-bin/mailman/listinfo/carbon-dev